Monday, August 12, 2013

Knowing the Command you used in eclipse to run a program

I was working on a combination of scala with hadoop. After getting addicted to usage of eclipse IDE, It became too difficult to run the same job on command line. You can get the command you used in eclipse by following below simple steps.


  • Run a Program
  • open debug perspective mode.
  • wait till the job complete or terminate it
  • In debug right click on <terminated : exit value 1> and select properties.



Saturday, July 27, 2013

Scala Regex

Match Groups

val imageurlpattern = """data-context-item-id="([^"]*)""".r
println((imageurlpattern findFirstMatchIn singleMovieDetail).get.group(1))

Tuesday, June 18, 2013

google maps v2 illegalStateException

java.lang.IllegalStateException: Not connected. Call connect() and wait for onConnected() to be called.

This happens when you request for locationupdates before the actual location connection is established. Instead use a boolean variable to check if connection is established or call for locationupdates as below in onConnected.

@Override
        public void onConnected(Bundle connectionHint) {
                Toast.makeText(this, "Connected", Toast.LENGTH_SHORT).show();
                mLocationClient.requestLocationUpdates(mLocationRequest, this);
         
        }

Wednesday, March 20, 2013

Creating HyperLinks in Large Text (TextView) - Android

String.xml

------------

<string name="totalText">Hello <u>World</u></string>



public void hyperlinkWordsInText()
{
 Spanned sequence = html.fromhtml (context.getstring (r.string.totalText));
 Spanablestringbuilder strbuilder = new Spanablestringbuilder(sequence);

 Underlinespan [] underlines = strbuilder.getspans (0, sequence.length (), Underlinespan.class);
  For (Underlinespan span : underlines)
  {
  int start = strBuilder.getSpanStart(span);
  int end = strBuilder.getSpanEnd(span);
  int flags = strBuilder.getSpanFlags(span);
  ClickableSpan myActivityLauncher = new ClickableSpan()
  {
   public void onClick(View view)
   {
    // do wat ever u want on click
   }
  
  };
  strBuilder.setSpan(myActivityLauncher,start,end,flags);
   
   
  }
txt.setText(strBuilder);
txt.setMovementMethod(LinkMovementMethod.getInstance());
}

Tuesday, March 5, 2013

Learning jquey (Tutorials)

Reading styled data from String.xml - Android


<string name="my_text">
  <![CDATA[
    <b>Autor:</b>Prashanth Madi<br/>
    <b>Contact:</b>prm0080@gmail.com<br/>
    <i>Copyright © 2012-2013  </i>
  ]]>
</string> 
From our Java code we could now utilize it like this:
TextView tv = (TextView) findViewById(R.id.myTextView);
tv.setText(Html.fromHtml(getString(R.string.my_text)));