Tuesday, March 19, 2013

ECLIPSE Shortcut for converting lower case to upper and vice versa

Just a quick short cut which is very useful for developers to convert the selected lower case text to Upper case and vice versa

Lower case: CTRL+SHIFT+Y (CMD+SHIFT+Y on Mac OS X)
Upper case: CTRL+SHIFT+X (CMD+SHIFT+X on Mac OS X)

The good thing here is you can select one or multiple characters/word/lines by using Using + ->/<-/DownArray and then convert all of it at once.

Sunday, December 2, 2012

Android Installation problem [Can not complete the Install ] Solved


Problem
Cannot complete the install because one or more required items could not be found.
  Software being installed: Android Hierarchy Viewer 18.0.0.v201203301601-306762 (com.android.ide.eclipse.hierarchyviewer.feature.group 18.0.0.v201203301601-306762)
  Missing requirement: Android Hierarchy Viewer 18.0.0.v201203301601-306762 (com.android.ide.eclipse.hierarchyviewer.feature.group 18.0.0.v201203301601-306762) requires 'org.eclipse.core.runtime 3.6.0' but it could not be found

Please note same message for  "Android DDMS","Android Development Tools" and  "Android Traceview"

Or Duplicate Repository problem where as creating the new Android Project option doesnt appear 


Head over to Help -> Install New Software. Click on Available software sites. Delete the Android repo. Uncheck Indigo & Eclipse updates & recheck them. Now head back to Help -> Check for updates. Once done, add the Android repo again. Accept the license & you should be good to go.
(Had to do the same yesterday after getting Indigo)
Source: StackOverFlow: Pasting here as this Solution worked for me after trying a lot of solutions posted over net 

Sunday, August 26, 2012

TCS fiasco and How to keep your account safe while changing mobile no


  24th August and the morning news came out as Techie steals Rs 49L from 3 bank accounts in Chennai. This news was definately worth the attention as while working with multiple service /Product companies techies like me  do get exposed to sensitive information. Here is what heppned in short and how the fraud was done



TCS Fraud protype

















                         

 Now the account and details related to it are in total unsafe hands and is     exposed to the variety of fraud which can be done . Now though the likelihood of having access to Bank DB is very less but even a person in million having access  to bank DB with malicious intention can give any bank a very hard time. The only way for the bank to trace back in these situation is to trace  the user            Machine IP where query was executed and me myself being a techie can say it for sure , its a cake walk to  mask my IP and give the Bank guys even a harder time trying to trace the origin of fraud.
  The point worth mentioning in this TCS fiasco is ,the techie was caught only becasue he/She  gone greedy and started withdrawing large amounts. However if they had kept a little control on their greed, it was close to impossible to figure out . And we will never know if the employee had done small such malicious activity in past and the amount was not big enough to draw attention of bank officials.

  Looking at the pattern however , it exposes the seriousness with which customer's private data is maintained, and the low level of security practises banks follow in order to save their customers hard earned money.this also brings the necessity  of a strong and capable Real Time online fraud monitoring system where multiple such incidents are coded as  a part of online transaction as well as card swipe process and is capable to stop transaction in any of the possible fraud scenario and is part of core banking system . 

  it will be interesting to see in indian market where changing the mobile number  is such a common process , if one gets access to telecom DB and does a intersection and imaginary scenario something like this 

The received out put list is the list of customer whoose transaction should be immideatly blocked until the new number is updated other wise in a matter of second and effort of two software engineers (One working for Bank and one working for Telecom ) is capable of adding multiple zeroes in the 49Lakh amount fraud..
  For customers , they should immediately give standing instruction to bank/Credit card company to stop doing any sort of transaction unless  they have a working number again.The process might look a little cumbersome to follow but as we all know it for a fact that its always  “better to be safe than sorry“.











Sunday, June 24, 2012

Count The No of Inversion in merge Sort

Algo:

 i have followed to do the same


  1. Merge sort array A and create a copy (array B)
  2. Take A[1] and find its position in sorted array B via a binary search. The number of inversions for this element will be one less than the index number of its position in B since every lower number that appears after the first element of A will be an inversion.
    2a. accumulate the number of inversions to counter variable num_inversions.
    2b. remove A[1] from array A and also from its corresponding position in array B
  3. rerun from step 2 until there are no more elements in A.
Here’s an example run of this algorithm. Original array A = ( 14, 8, 12, 3, 2)
1: Merge sort and copy to array B
B = (2,3,8,12,14)
2: Take A[1] and binary search to find it in array B
A[1] = 14
B = (2,3,8,12,14)
14 is in the 5th position of array B, thus there are 4 inversions. We know this because 14 was in the first position in array A, thus any lower value element that subsequently appears in array A would have an index of j > i (since i in this case is 1).
2.b: Remove A[1] from array A and also from its corresponding position in array B (bold elements are removed).
A = ( 14, 8, 12, 3, 2) = (8, 12, 3, 2)
B = (2,3,8,12,14) = ((2,3,8,12)
3: Rerun from step 2 on the new A and B arrays.
A[1] = 8
B = ((2,3,8,12)
8 is now in the 3rd position of array B, thus there are 2 inversions. We know this because 8 was in the first position in array A, thus any lower value element that subsequently appears would have an index of j > i (since i in this case is again 1). Remove A[1] from array A and also from its corresponding position in array B (bold elements are removed)
A = (8, 12, 3, 2) = 12,3,2
B = (2,3,8,12) = 2,3,12
Continuing in this vein will give us the total number of inversions for array A once the loop is complete

Try to code as per Algo , it gives a complete result
i am not sharing code as its against the fair code Stanford rule and will share only once the date for submitting assignment is expired
however am okay if u need any help in completing this exercise and Java is teh language i prefer to code in 


Friday, May 11, 2012

Basic IP Check with Ping using Java



import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.InetAddress;
import java.net.UnknownHostException;


public class testIp {

public static boolean checkIp (String sip)
  {
      String [] parts = sip.split ("\\.");
      System.out.println("Parts length is "+parts.length);
      if ( parts.length != 4 )
      {
          return false;
      }
      for (String s : parts)
      {
          int i = Integer.parseInt (s);
          if (i < 0 || i > 255)
          {
              return false;
          }
      }
      if (pingIp(sip))
      return true;
      else
      return false;
  }

private static boolean pingIp(String sip) {
// TODO Auto-generated method stub
try {
InetAddress adr = InetAddress.getByName(sip);
boolean stat= adr.isReachable(2000);
return stat;
} catch (UnknownHostException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

return false;
}

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("Enter the IP to be chacked");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try {

String line = br.readLine();
boolean status=testIp.checkIp(line);
System.out.println("Status is "+status);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}
}




Thursday, May 10, 2012

EMMA Report Comparison Shell Based Utility


Here i am pasting the Symbolic code for comparing two EMMA Reports where Assumptions are
1.before.txt ---> the actual report
2.after.txt----> report after modification

This Script will get in to those twpo reports and show block by Block Comparison
The idea behind sharing this is that using this Logic a Extensive User Utility script can be developed which can be used to compare EMMA Reports



function retLineNobefore()
{
Str=$1
while read Line
do
val=$(grep -n "$Str" | sed -n 's/^\([0-9]*\)[:].*/\1/p')   # this is to Extract just the Line no
break
done < before.txt
}

function retLineNoAfter()
{
Str=$1
while read Line
do
val=$(grep -n "$Str" | sed -n 's/^\([0-9]*\)[:].*/\1/p')
break
done < after.txt
}

rm -fr report.txt

retLineNobefore "OVERALL COVERAGE SUMMARY:"
no1=$val


retLineNobefore "OVERALL STATS SUMMARY:"
no2=$val
echo "----------------Before-------------------------- " > report.txt

awk "{if((NR>"$no1")&&(NR<$no2)) print}" before.txt  >> report.txt



retLineNoAfter "OVERALL COVERAGE SUMMARY:"
no1=$val
echo $no1


retLineNoAfter "OVERALL STATS SUMMARY:"
no2=$val
echo $no2
echo "----------------After-------------------------- " >> report.txt
awk "{if((NR>"$no1")&&(NR<$no2)) print}" after.txt  >> report.txt


Wednesday, March 7, 2012

Customized page using JIRA which can autorefresh


hello All
recently have been working on a small configuaration change in JIRA which can allow a user to write a gadget whcih can autorefresh it at a given interval .. just so that this post conversation can be helpful for others i am pasting the link as it is .
in case any problem revert back


want to create a customized page using JIRA functionality which can autorefresh it in say 15 sec interval  any direction is appreciated
 By Manish Ranjan (1 karma) on Mar 02 at 5:22 a.m.
jira
jira-plugins
answer my own question | add comment
edit|poke atlassian answer my own question | add comment 0

 4 Answers:
oldest answers
newest answers
popular answers ↑
oldest answers
newest answers
popular answers ↑

I think you have to explain this a little bit more. I have no idea what you want to do... Sorry
 By Thomas-S (616 karma) on Mar 02 at 5:57 a.m.
add comment
permanent link add comment

actually i want to write a plugin which will ahev a customized landing page and the page needed to be be refresh at an interval of 15 sec .
(Mar 02 at 06:16 AM)
Manish Ranjan

actually i want to write a plugin which will ahev a customized landing page and the page needed to be be refresh at an interval of 15 sec .
(Mar 02 at 06:16 AM)
Manish Ranjan 0


Is this a jira dashboard you are trying to get to refresh every 15s?

The old skool approach would be to have an HTML page with frames & a piece of javascript that reloaded your target page every 15s but that would be nasty!
 By Matthew Cobby (1.4k karma) on Mar 02 at 11:38 a.m.
add comment
permanent link add comment

may be i will have my own gadget doint it for me .. but as of now i am facing another problem where i am able to see my gadget in plugins but not able to add it to the newly created dashboard.

can you also please help me in how can i add my own custom page to JIRA dashboard .. That would be in form a gadget right ?

also say i want to modify the "Assign to me" gadget providded by JIRA for a time less than a min rather than the options provided by JIRA which is atleast 15 mins.. how can i do that ?


(Mar 03 at 08:13 AM)
Manish Ranjan

may be i will have my own gadget doint it for me .. but as of now i am facing another problem where i am able to see my gadget in plugins but not able to add it to the newly created dashboard.

can you also please help me in how can i add my own custom page to JIRA dashboard .. That would be in form a gadget right ?

also say i want to modify the "Assign to me" gadget providded by JIRA for a time less than a min rather than the options provided by JIRA which is atleast 15 mins.. how can i do that ?


(Mar 03 at 08:13 AM)
Manish Ranjan 0

 Why not just a meta tag, please see http://en.wikipedia.org/wiki/Meta_refresh
 By Dieter (3.1k karma) on Mar 03 at 9:05 a.m.
add comment
permanent link add comment

but to embed the meta tag i need to figure out the source of "assigned to me" jsp right ? i tried but couldnt do the same. i have been doing research on this since wednesday so if i asking something silly am sorry,just to add i have not been able to add my own Custom page to JIRA as mentioned above so i am kinda stuck ..
(Mar 03 at 09:22 AM)
Manish Ranjan

but to embed the meta tag i need to figure out the source of "assigned to me" jsp right ? i tried but couldnt do the same. i have been doing research on this since wednesday so if i asking something silly am sorry,just to add i have not been able to add my own Custom page to JIRA as mentioned above so i am kinda stuck ..
(Mar 03 at 09:22 AM)
Manish Ranjan
Oh sorry, i hadn't seen your comment that you want to override the refresh period of the gadget. My answer was meant for a classical webwork action page, so probably this anwer is not useful.
(Mar 03 at 11:59 AM)
Dieter
Oh sorry, i hadn't seen your comment that you want to override the refresh period of the gadget. My answer was meant for a classical webwork action page, so probably this anwer is not useful.
(Mar 03 at 11:59 AM)
Dieter
1
you should search through all gadget.xml files in the Atlassian source tree to find the html and js code that makes up the assigned to me gadget.
(Mar 03 at 12:04 PM)
Dieter
1
you should search through all gadget.xml files in the Atlassian source tree to find the html and js code that makes up the assigned to me gadget.
(Mar 03 at 12:04 PM)
Dieter

when you say altassian source tree you mean in Jira installtion which is at /opt/atlassian/jira right ??i have been trying to backtrace the xml file but no success yet .. will try harder .. thanks for your help .. any pointer to search the same will be really helpfull. Manish
(2 days ago)
Manish Ranjan

when you say altassian source tree you mean in Jira installtion which is at /opt/atlassian/jira right ??i have been trying to backtrace the xml file but no success yet .. will try harder .. thanks for your help .. any pointer to search the same will be really helpfull. Manish
(2 days ago)
Manish Ranjan
1

no i mean the source code that you can get when you buy a commerical license. You will not find anything in the installed distribution since the gadget.xmls live in JAR files.
(yesterday)
Dieter
1

no i mean the source code that you can get when you buy a commerical license. You will not find anything in the installed distribution since the gadget.xmls live in JAR files.
(yesterday)
Dieter

okay cool .. i do have a commercial license , will look in to that . Thanks for your help
(yesterday)
Manish Ranjan

okay cool .. i do have a commercial license , will look in to that . Thanks for your help
(yesterday)
Manish Ranjan 0


If it's the assigned to me gadget that you want to change the refresh rate, then there is a really simple answer if you also have Confluence. Edit a page, bring up the macro browser & insert the gadget you want.  At the bottom should be an option to refresh, set it anything, it doesn't matter.  Save.



Then look at the macro that has been created in your page.  It should have a refresh parameter. Change this to be your new rate e.g. refresh=1 for every minute.  If you put something like refresh=true then it will refresh as fast as it can & will massively increase the load on your jira server.
{gadget:url=http://jira.xxxxxx.com:8080/rest/gadgets/1.0/g/com.atlassian.jira.gadgets:filter-results-gadget/gadgets/filter-results-gadget.xml}filterId=filter-11027&num=10&columnNames=--Default--&isConfigured=true&refresh=1{gadget}