flipkart

Saturday, November 1, 2014

Convert Rectangle (Square) images to Circle using GIMP tool

Today i faced one problem i download one image from google but that image shape is rectangle , i want circle after download image lot of online tools is there for converting one shape to another shape but it not safe why means they will save our images into their data base in this situation i like to explain my real experience in online.

After completion my graduation i prepared my resume through open office after preparing resume i will carry resume through pen-drive but where ever i open it showing little bit modifying original one i decided to convert pdf . I done through online .doc to .pdf conversion now my problem is solved.
After some day gone i am searching some suddenly i socked because my resume is opened that i understood they our contents into their data bases so take care .

now will move this post main aim " conversion rectangle image to circle image " today i found out some offline tool GIMP

I will explain step by step procedure with help of some images

My image name image.jpg



Step 1:First select image and right click om image next select open with ->GIMP Image Editor 


Step2: now it GIMP tool is opened now select which shape you want (ex: circle) goto Tools->Select Tools->Ellipse select

 

Step3: After selecting shape click Layer->Mask->Add Layer Mask->Selection



Note: select size of circle according to your customize 

Now press once Enter button in keyboard  save image .xcf extension 

Step 4:For saving image and customize format click File->export and save image as your wish 



Now our rectangle image converted to circle image with safety.




Friday, October 31, 2014

Changing IP address of SVN Host (Server)

Daily i am using SVN for code submitting to my superiors  but one day unfortunately i am try to submit code to SVN but it showing some error after some i identified my SVN system IP address is changed .
I don't know to change IP old to new IP address for that solution is following command line we can change IP address of SVN


$svn switch  relocate http://old_ip_address/svn/project_name http://new_ip_address/svn/project_name



above command working in Ubuntu terminal 

For Solving two equation through online

In our daily life we busy with developing new application and writing new code but unfortunately some times we need to solve some equations solving equations is some what tricky

examples:

solving two straight line equations is very easy process but solving two ellipses equation little tricky process so for that some online website is there . This website we have to enter two equation they will give intersection between two equation

link is http://www.wolframalpha.com/

Tuesday, July 15, 2014

JSON parsing in Android application

Today i will explain how to parse JSON (Java Script Object Notation) in android application.
Following file my source code

MainActivity.java
  1. package com.example.jsonparcer;

    import java.io.BufferedReader;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import org.json.JSONObject;
    import android.app.Activity;
    import android.os.Bundle;
    import android.util.Log;
    import android.view.Menu;
    import android.view.View;
    import android.view.View.OnClickListener;
    import android.widget.Button;
    import android.widget.TextView;

    public class MainActivity extends Activity {

        BufferedReader bReader = null;
        TextView name,date,hours;
        Button data;
     
    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);
    name=(TextView) findViewById(R.id.name);
    date=(TextView) findViewById(R.id.date);
    hours=(TextView) findViewById(R.id.hours);
    data=(Button) findViewById(R.id.data);
    data.setOnClickListener(new OnClickListener() {

    @Override
    public void onClick(View v) {
    try {


    InputStream work = getApplicationContext().getResources()
                   .openRawResource(R.raw.work);

    bReader=new BufferedReader(new InputStreamReader(work));
    StringBuilder quesString = new StringBuilder();
            String aJsonLine = null;
            while ((aJsonLine = bReader.readLine()) != null) {
                    quesString.append(aJsonLine);
            }
           
            Log.d(this.getClass().toString(), quesString.toString());
            String workjson=quesString.toString();
            JSONObject quesObj = new JSONObject(quesString.toString());
            JSONObject TimeTable  = quesObj.getJSONObject("TimeTable");
            name.append(TimeTable.getString("name"));
            date.append(TimeTable.getString("date"));
            hours.append(TimeTable.getString("time"));
           
    } catch (Exception e){
             
           } finally {
                       try {
                               bReader.close();
                       } catch (Exception e) {
                               Log.e("", e.getMessage().toString(), e.getCause());
                       }

           }

    }
    });



    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
    }

    }
AndroidManifest.xml

  <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.example.jsonparcer"
  android:versionCode="1"
  android:versionName="1.0" >

  <uses-sdk
  android:minSdkVersion="8"
  android:targetSdkVersion="19" />

  <application
  android:allowBackup="true"
  android:icon="@drawable/ic_launcher"
  android:label="@string/app_name"
  android:theme="@style/AppTheme" >
  <activity
  android:name="com.example.jsonparcer.MainActivity"
  android:label="@string/app_name" >
  <intent-filter>
  <action android:name="android.intent.action.MAIN" />

  <category android:name="android.intent.category.LAUNCHER" />
  </intent-filter>
  </activity>
  </application>

</manifest>

activity_main.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:paddingBottom="@dimen/activity_vertical_margin"
  android:paddingLeft="@dimen/activity_horizontal_margin"
  android:paddingRight="@dimen/activity_horizontal_margin"
  android:paddingTop="@dimen/activity_vertical_margin"
  tools:context=".MainActivity" >

  <TextView
  android:id="@+id/name"
  android:layout_width="wrap_content"
  android:textSize="20dp"
  android:layout_height="wrap_content"
  android:text="@string/Employ" />

  <TextView
  android:id="@+id/date"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:textSize="20dp"
  android:layout_alignLeft="@+id/name"
  android:layout_below="@+id/name"
  android:layout_marginTop="23dp"
  android:text="@string/Date" />

  <TextView
  android:id="@+id/hours"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:textSize="20dp"
  android:layout_below="@+id/date"
  android:layout_marginTop="26dp"
  android:text="@string/Time" />

  <Button
  android:id="@+id/data"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:layout_alignParentBottom="true"
  android:layout_centerHorizontal="true"
  android:layout_marginBottom="126dp"
  android:text="@string/Data" />

</RelativeLayout>


strings.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>

  <string name="app_name">Jsonparcer</string>
  <string name="action_settings">Settings</string>
  <string name="hello_world">Hello world!</string>
  <string name="Employ">Ename :</string>
  <string name="Date">Date :</string>
  <string name="Time">WHours :</string>
  <string name="Data">Data</string>

</resources>

work.txt

{
  "TimeTable":{
  "name":"Vamsi",
  "date":"8-07-2014",
  "time":"8hours"
  }
}

Above codes are my source code for parsing json object using android . After running above code following screenshot will be generated


After button pressing it will retrieve data from work.txt next it will show using Textview on screen




Monday, July 7, 2014

Creating JSON file programitically

JSON stands for Java Script Object Notation. It is user for data saving .Today this post explain creating JSON file and writing values inside file using android programming.


MainActivity.java


 package com.example.jsonwriter;

import org.json.JSONException;
import org.json.JSONObject;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
JSONObject object = new JSONObject();
 try {
   object.put("name", "vamsi krishna");
   object.put("score", new Integer(44));
   object.put("current", new Double(40));
   object.put("nickname", "vk");
 } catch (JSONException e) {
   e.printStackTrace();
 }
 System.out.println("------"+object);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}

}

AndroidManifest.xml, layout file are same after creating project change accordingly as your date in MainActivity class  

After running above my application it will give following screenshots


Above picture logcat showing out of application(Green color lines)


Tuesday, May 20, 2014

JNI Development using eclipse

Hi, every body knows programming of C language so they write already code in C language. This post i will try explain how to use C function in Java using eclipse.Following explain is based on Ubuntu operating system


First create java project 


File -> New -> Java Project

After created java project add java source file

right click on src folder select New->class

Write java source code file and save it

Right click on project folder select new -> folder

Give folder name as jni after press finish

Once press build project

Right click on project press Build project

Next go Run -> External tool configurations 

It's opened one window select program next click new 

Location field is javah exceutable file path

working directory is present project bin folder

Arguments is "-jni -classpath ${workspace_loc:/Hello/bin} -d ${workspace_loc:/Hello/jni} Hello " 

it's created java header file inside jni folder use that file for creation c source file before that one move C/C++ perspective

Right click on project New -> Other -> Convert to a C/C++ Project 

After selecting press Next inside select C project or C++ project after Shared library next press finish button

Before writing C source code right click project select Build Path -> Configure Build Path after it opend window inside window 

C/C++ Build -> Settings ->Includes -> select New after give path /usr/lib/jvm/java-6-openjdk/include

Next press OK button and Create New C source file using java Header file

After Build C/C++ perspective next return Java perspective

Once Build project

Right click project Run as -> Run Configurations 

Select inside Java Application -> project name -> Arguments -> 

Field VM arguments -Djava.library.path=$UR_PATH/project_name/Debug/

Monday, May 19, 2014

Multiple colours inside a TextView in android

Set color of TextView span in Android  or Highlight text view in android

Hi this post will explain customized TextView in android using Spannable that means using TextView will show Multiple colors in message.

Following file are my source code:

activity_main.xml


<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" >

    <TextView
        android:id="@+id/textview"
        android:textSize="35dp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/hello_world" />

    <TextView
        android:id="@+id/textView1"
        android:clickable="true"
        
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="157dp"
        android:text="TextView" />

</RelativeLayout>


MainActivity.java


package com.example.helloworld;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.style.ForegroundColorSpan;
import android.view.Menu;
import android.view.View;
import android.widget.TextView;

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TextView tv=(TextView)findViewById(R.id.textview);
Spannable wordtoSpan = new SpannableString("Algorithms run on OBU, Messages displayed on Android according to the priority.Applications listed on Android based tab");        

wordtoSpan.setSpan(new ForegroundColorSpan(Color.BLUE), 15, 30, Spannable.SPAN_INCLUSIVE_INCLUSIVE);
wordtoSpan.setSpan(new ForegroundColorSpan(Color.MAGENTA), 35, 45, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
wordtoSpan.setSpan(new ForegroundColorSpan(Color.LTGRAY), 50, 55, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
wordtoSpan.setSpan(new ForegroundColorSpan(Color.CYAN), 60, 65, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
wordtoSpan.setSpan(new ForegroundColorSpan(Color.YELLOW), 70, 75, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
wordtoSpan.setSpan(new ForegroundColorSpan(Color.GREEN), 80, 85, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
tv.setText(wordtoSpan);

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}

}

After running above code using eclipse it will give following screenshot. It will print text different colors (BLUE,MAGENTA,LTGRAY,CYAN,YELLOW,GREEN).


Thursday, May 15, 2014

How do I make links in a TextView clickable in Android?


Current days everybody using web for searching their needs so web-search engine is most popular.
This post is is clearly explainedhow do I make links in a TextView clickable in Android.

Following is my source code .

MainActivity.java

package com.example.hid;

import android.app.Activity;
import android.os.Bundle;
import android.text.method.LinkMovementMethod;
import android.view.Menu;
import android.widget.TextView;

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}

}



activity_main.xml


<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" >

    <TextView
        android:autoLink="web"
        android:linksClickable="true"
        android:id="@+id/text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:textSize="20dp"
        android:layout_centerVertical="true"
        android:text="@string/web" />

</RelativeLayout>


strings.xml


<?xml version="1.0" encoding="utf-8"?>
<resources>

    <string name="app_name">hid</string>
    <string name="action_settings">Settings</string>
    <string name="hello_world">Hello world!</string>
    <string name="web">http://www.google.com</string>

</resources>

After wrote code I am running in my mobile phone using eclipse it giving following screen

                                                     


After clicking user above on link it will trying to open google browser based on internet speed
Above screen is trying to open google page it opened some seconds difference


Finally i got google web page using my application it will useful when ever you need links in your application.