Wednesday, September 10, 2014

"My Youtube Channels" Android Application Changed to "My Channels" in Google Play Store

2 years back I have uploaded my android application "My Youtube Channels" to Google Play Store. You can quickly search for a particular Youtube channel based on a keyword and add it to your favorites list. You can later quickly access the content of the channel as it is already in your favorites list on the launch screen of the app. It has the following features.
  • Search for a keyword and add selected channel to your list.
  • Follow the selected video channels regularly.
  • Enjoy periodic updates from the channels you like by changing settings( Periodic new video check time interval etc.).
  •  Select multiple videos and play them at once.
  • Share the videos you like on Facebook.
It started small with fewer downloads and gradually increased after one year. Once the app started getting good downloads the app was somehow deleted from play store. Hence, I have modified it a bit and re-uploaded to play store with "My Channels" Name. Please download the "My Channels" application and rate it after you use it for some time.

Friday, April 30, 2010

Desktop Scorecard for Cricket

Most of the cricket lovers will be using their favorite site cricinfo.com for the match updates. As a huge fan of cricket I do the same. But sometimes when you are doing some important work, you may not be interested in switching the current working window to watch the score. As an example When I am watching a movie, I am not interested in pausing the movie and see the score card. This led me to think of how can I know the score without switching my window. Desktop scorecard is the solution that I came up with.

I have kubuntu running on machine. Kubuntu shows a pop-up notification message at the bottom right corner when I plug in a pendrive. I thought of using the similar kind of notification message for the cricket score card. When I searched on net, I found a cool solution with kdialog tool. It has various GUI elements like input textbox, alert windows etc. For the score card notification message it has an option called passivepopup. It takes 2 parameters. One is the text to be shown in the notification message and the other one is the time duration for which the notification message should be active. If the user does not close that message with in that time, It automatically gets closed. For example the following command produces the below passivepopup

kdialog --title "This is a passive popup" --passivepopup "It will disappear in about 60 seconds" 60


Having known how to show pop-up notification messages, my task of showing score card has become more easy. All I need to do now is that, I have to get the current score and then send that to the popup message. For this task, I have used the cricinfo.com as the source for my score card. My score card shows very little information, the current team's score and both the batsman's score. I think that is enough but if you want more you can add it.

For reading the webpage and getting the score, I have used the perl language. Finally a mix of both perl and shell scripting completed my task.

#!/usr/bin/perl
use LWP::Simple;
$numargs=$#ARGV + 1;
if($numargs < 1)
{
  print "Enter the URL as argument";
  exit;
}
$pageURL=$ARGV[0];
$filename="cricket.txt";
$scorecardfname="score.txt";
#$pageURL="http://www.cricinfo.com/world-twenty20-2010/engine/current/match/412678.html?view=live";#"http://www.google.com";
$simplePage=get($pageURL); 
if( $simplePage == /^\s*$/)
{
   print "page can not be fetched\n";
   open FHSC1,">$scorecardfname" or die $!;
   print FHSC1 "";
   close FHSC1;
   exit;
}
open FH,"> $filename" or die $!;
print FH $simplePage;
close FH;
open FH,$filename or die $!;
open FHSC,">$scorecardfname" or die $!;
@fc=<fh>;
$NOL=@fc;
$line=0;
$noofplayers=0;
$teamcount=0;
while($line < $NOL)
{
  $e = $fc[$line];
  if( $e =~ /<div class="teamText">
(.*)<\/p>/ )
  {
    if($teamcount == 0 )
    {
      $firstbattingteam = $1;
      print FHSC $firstbattingteam."\n";
      $teamcount++;
    } 
    elsif($teamcount==1)
    {
      $secondbattingteam = $1;
      $teamcount++;
    }
  }
  elsif( $e =~ /showHwkTooltip/ )
  {
    if( $e =~ /<a.*>(.*)<\/a>/)
    {
      #print $1."\n";
      $name = $1;
      $line = $line + 2;
      if( $fc[$line] =~ /<b>(.*)<\/b><\/td>/ )
      {
          $score = $1;
      }
      $line++;
      if( $fc[$line] =~ /(.*)<\/td>/ )
      {
          $balls = $1;
      }
      $line++;
      if( $fc[$line] =~ /(.*)<\/td>/ )
      {
          $fours = $1;
      }
      $line++;
      if( $fc[$line] =~ /(.*)<\/td>/ )
      {
          $sixes = $1;
      }
      $line++;
      if( $fc[$line] =~ /(.*)<\/td>/ )
      {
          $strikerate = $1;
      }
      print FHSC $name."      ".$score."(".$balls.")\n"; 
      $noofplayers++;
      if($noofplayers==2) 
      {
          last;
      }
    }
  }
  $line++;
}
print FHSC $secondbattingteam."\n";
#print FHSC $firstbattingteam."\n";
close FH;
close FHSC;

save the above code as readwebpage.pl. This takes the URL of the cricinfo webpage as the command line argument. This is perl script is executed in the below mentioned shell script. It reads the webpage and searches for the teams information and current batting players. It writes this information in to score.txt file. This file is read by the below shell script.

i=1;
url=`kdialog --title "Cricinfo Url" --inputbox "Enter the Cricinfo URL"`;
echo "Entered URL: $url";
while [ $i -ne 0 ]
do
  ./readwebpage.pl $url;
  sha=`cat score.txt`;
  if [[ $sha == "" ]]
  then
    exit;
  fi
  kdialog --title "scorecard" --passivepopup "$sha" 10;
  sleep 11;
done

Save the above snippet as showscore.sh. When you run this shell script, it opens a window containing a input text box asking for the URL. Go to cricinfo.com in your browser and go the score card page for which you want updates, copy and then paste it in that text box.



One important thing to note here is that always add "?view=live" at the end of the URL. For example if the page URL is http://www.cricinfo.com/world-twenty20-2010/engine/current/match/412678.html then the URL you should enter is http://www.cricinfo.com/world-twenty20-2010/engine/current/match/412678.html?view=live. After taking this URL as input it calls the above perl script with the URL as the command line argument. The perl script writes data into score.txt file. Now the shell script reads the data from score.txt file and calls kdialog's passivepop message. I have kept the 10sec time for the popup to stay alive. You can configure this as you wish. This is all fine but we want to update the score card on regular time intervals. For this purpose make the above functionality in an infinite loop but there should be some sleep time between each update. That regular interval time can be put as the parameter for the sleep command in the script. Suppose if you want to update the score for every 30 sec. then make that as sleep 30 instead of sleep 11.

This works only in Linux machines and you should have Kdialog and perl installed. Ubuntu users can get kdialog using sudo apt-get install kdebase-bin or get it through synaptic manager. Most of the Linux distributions already have perl installed. If you quickly want to try this, download the file DesktopScoreCard. Untar the downloaded file. Open a terminal and go to the untarred DesktopScoreCard folder. Then run the showscore.sh file. If all goes well you can see the popup message with the score card from the URL you have entered.
You can see the screen shot showing the score card

Wednesday, April 28, 2010

Suppress specific characters in a GWT Textbox

Some times we need to suppress specific characters in our GWT text box. Suppose you want only numbers to be allowed in your text box then you need to suppress all the alphabets in that text box. This you can do by attaching a key board listener to the text box and the method onKeyPress should do the required processing for suppressing. Below is the code for a text box which allows only numbers.

TextBox t = new TextBox();
t.addKeyPressHandler(new KeyPressHandler(){
public void onKeyPress(KeyPressEvent event) {
char keyCode = event.getCharCode();
if(!(keyCode > '0' && keyCode <'9') ) {
t.cancelKey();
}
}
});


Similarly, you can limit the number of characters a text box can take


TextBox t = new TextBox();
t.addKeyPressHandler(new KeyPressHandler(){
public void onKeyPress(KeyPressEvent event) {
if(t.getText().length() >= 5 ) {
t.cancelKey();
}
}
});


PS: For the syntax highlight of your code in a post, follow this link http://pleasemakeanote.blogspot.com/2008/06/posting-source-code-in-blogger.html

Friday, February 19, 2010

iptux - an intranet communication tool for linux


People Using a windows machine and connected to a LAN might be familiar with an intranet communication manager called IP Messenger. This is useful for messaging and transferring files from one machine to other machine over LAN. Once installed in your machine, it will automatically detect and show you a list of all the other machines which have this messenger running. You can choose any one on the list and start messaging or file transfer. You can google for IP Messenger and download it for Windows machines.





For Linux users also we have similar application called Gnome IP messenger. I have a previous post here which tells you how to install it. But it has some problem with transfering folders. This is a serious concern. To overcome this problem we have one more similar application called iptux . This is really very cool application. You have lot of features with this application and it has very rich UI. Ubuntu Users can directly get it through Synaptic manger. Just searc for iptux in your Synaptic manager. Alternatively you can download it from Ubuntu Repository and install it. There is different pakage file for different version of ubuntu. Please keep this in mind while downloading. For other flavours of linux users, you can download the tar file from google code page and follow these standard instructions for installing
  1. Untar the file and in terminal go to that folder
  2. run ./configure and if it fails, it means that something is missing in your OS for compiling the source. You can google with the error it gives and find the solution. Once you are successfull with this step move to next step.
  3. run make
  4. run make install -- after this you are ready to use your newly installed iptux
  5. run make clean -- this step is optional.
  6. To start iptux, open and termial and type iptux and enjoy intranet messaging and file transfers.

Friday, February 12, 2010

Sunday, January 10, 2010

ఎవడి గోల వాడిది........ తెలంగాణా పై...........

గత నెల రోజులకు పైగా ఆంధ్రప్రదేశ్ రాష్ట్ర రాజకీయాలు ఎటు వైపు వెళ్తున్నాయో అర్థం కావడం లేదు. ఏ వార్తా పత్రిక చుసిన, ఏ టీవీ ఛానల్ పెట్టిన కనిపించే అంశం ఒక్కటే. అది ప్రత్యేక తెలంగాణా రాష్ట్ర ఏర్పాటు. ఈ తెలంగాణా అంశం చర్చకు రాకముందు మీడియా లో నలుగుతూన్న అంశం ఓబులాపురం గనుల అక్రమాలు. ఇప్పుడు దాని గురించి పట్టించుకునే పత్రిక గానీ, న్యూస్ ఛానల్ గాని లేదు. బహుశ ఈ కోట్లు గడించే అక్రమాలను మీడియా నుండి తప్పించడానికే చాలా చిన్నదిగా సాగిన తెలంగాణా అంశాన్ని బూతద్దంలో పెట్టి పెద్దదిగా కనిపించేలా చేసారేమో. తెలంగాణా అంశం చర్చకు వచ్చిన తరువాత వచ్చిన N. D. తివారి రాసలీలలు, రాజశేకర్ రెడ్డి మరణ సంగటనలో అంబానీల హస్తం లాంటివి ఏవి తెలంగాణా అంశాన్ని పక్క తోవ పట్టించలేకపోయాయి. ఇదిలా పక్కన పెడితే........
అసలు ఈ రాజకీయనాయకులకు తెలంగాణాకు గానీ, సమైక్యాంధ్రకు గానీ మద్దతు పలికే అధికారం ఎవరిచ్చారు?? అవును ప్రజలే వారిని ఎన్నుకొని వారికి ఆ అధికారాన్ని ఇచ్చారు. కాని ఆ అధికారాన్ని ఉపయోగించి, రాష్ట్ర విభజన లాంటి అతి ప్రాముక్యమైన అంశం పై వారు స్వతంత్రంగా నిర్ణయం తీసుకోవచ్చా ?? ఒక్కసారి ఆలోచించండి?? ప్రతి రాజకీయ నాయకుడు తన స్వలాభం కోసమో గానీ, తమ పార్టీ ప్రయోజనలకో గానీ మద్దతించడం లేదా వ్యతిరేకించడం జరుగుతుంది. నిజంగా ఎంత మంది రాజకీయ నాయకులు తమ నియోజకవర్గ ప్రజల అభిప్రాయాలను సేకరించి నిర్ణయం తీసుకున్నారు?? ప్రజాస్వామ్యం అంటే ప్రజలు తమను తామే పరిపలించుకునే ఒక వ్యవస్థ అని ఎంత మంది రాజకీయ నాయకులకు గుర్తుందంటారు..........

Tuesday, June 9, 2009

My experience with a programming error

Today I spent hours just because of a blunder in my programming. I am working on Esterel language and did some programming in that for last 6 months. In Esterel, a condition checking is done using '=' operator and the operator for assignment is ':='. There is limited support of data types in Esterel, hence, to get the support of structure kind of data types it takes support form C as the host language. I am programming some part of my project in C as the host language for Esterel. Here comes the blunder that took hours of my time. As I was doing programming mostly in Esterel for last several months I used the same '=' operator for condition checking in if condition in C. As we all know '=' operator in C stands for assignment. Since an assignment operator in an if condition is valid in C, the compiler does not generate any error. I spent hours checking my logic but all that was right even if I check for 20 times. Now my question is How do we get to know such kind of programming blunders we do????? I think the best possible option is that the compiler should give a warning but not an error. Generating a warning in this case is reasonable as most of the programmers do condition checking more often than an assignment in an if condition.

Here is a possible solution to get rid of such kind of errors apart from C compiler generating a warning. When you are in such kind of situation that all your logic is correct and the compiler does not generate any errors but still the program does not behave as you expect, ask one of your friend to check the code and there is a high probability that he will definitely catch those kind of silly programming errors.

Monday, June 1, 2009

ISRO written test paper(Computer Science)

I attended ISRO written test this year(2009). Before attending the exam I tried to get some ISRO papers to prepare but I didn't find one. So, I thought of sharing my paper so that it helps later year students to prepare well and get some idea of the question paper......
Here is the link to download the paper ISRO written test paper(CS)

Sunday, February 22, 2009

Installing Gnome ip messenger in ubuntu

Download debian package file of gnome ip messenger here or from this page. Once you download the file, double click on it. It gets installed through GDebi package installer. You have to add the ip messenger applet to your panel. To do this go to your main panel and right click on it. Choose Add to panel and select the ip messenger applet.

Friday, February 20, 2009

ఓం నమఃశ్శివాయ ----- శివరాత్రి శుభాకాంక్షలు

This song is one of my all time favorites. It has beautiful lyric,music and well sung by shankar mahadevan. I was trying to get the lyric in telugu but I was not managed to get it. So, I have written the telugu lyric in lekhini.org and posting here.

ఓం మహా ప్రాణ దీపం శివం శివం
మహొంకార రూపం శివం శివం
మహ సూర్య చంద్రాగ్ని నేత్రం పవిత్రం
మహ గాఢ తిమిరాంతకం సౌరగాత్రం
మహ కాంతి బీజం మహ దివ్య తేజం
భవానీ సమేతం భజే మంజునాథం
ఓం నమశ్శంకరాయచ మనస్కరాయచ నమశ్శివాయచ శివ తరాయచ భవహరాయచ
మహా ప్రాణ దీపం శివం శివం
భజే మంజునాథం శివం శివం
అద్వైత భాస్కరం అర్థ నారీశ్వరం
త్రిదశ హృదయంగమం
చతురుదధి సంగమం
పంచభూతాత్మకం
షట్చత్రు నాశకం
సప్తశ్వరేశ్వరం
అష్టసిధ్ధీశ్వరం
నవరస మనోహరం
దశ దిశా సువిమలం
ఏకాదశోజ్జ్వలం ఏకనాథేశ్వరం
ప్రస్తుతివ శంకరం
ప్రణథ జన కింకరం
దుర్జన భయంకరం
సజ్జన శుభంకరం
ప్రాణి భవతారకం
పృకృతి హిత కారకం
భువన భవ్య భవ నాయకం
భాగ్యాతంకం రక్షకం ఈశం సురేశం ఋశేశం పరేశం నటేశం గౌరీశం గణేశం భూతేశం
మహా మధుర పంచాక్షరీ మంత్ర మార్చం
మహా హర్ష వర్ష ప్రవర్షం సుశీర్షం

ఓం నమో హరాయచ స్మరహరాయచ పురహరాయచ రుద్రాయచ భద్రాయచ ఇంద్రాయచ నిత్యాయచ నిర్నిత్యాయచ
మహా ప్రాణ దీపం శివం శివం
భజే మంజునాథం శివం శివం
డండండ డండండ డండండ డండండ డక్కాది నాద నవతాండవాడంబరం
తథిమి తకథిమి దిథిమి థిమిథిమి
సంగీత సాహిత్య సుమ కమల బంబరం
ఓంకార హ్రీంకార శ్రింకార ఐంకార మంత్ర బీజాక్షరం మంజునాథేశ్వరం
ఋగ్వేద మాద్యం యజుర్ వేద వేద్యం సామ ప్రగీతం అథర్వ ప్రభాతం
పురాణేతిహాస ప్రసిద్ధం విశుద్ధం
ప్రపంచైక సూత్రం విబుద్ధం సుసిద్ధం

నకారం మకారం శికారం వకారం యకారం
నిరాకార సాకార సారం మహాకాల కాలం మహానీలకంఠం
మహా నందనందం మహాట్టాట్టహాసం
జటాజుట రంగైక గంగా సుచిత్రం
జ్వలత్ ఉగ్ర నేత్రం సుమిత్రం సుగోత్రం
మహాకాశభాసం మహాభాను లింగం
మహా వర్తృవర్ణం సువర్ణం ప్రవర్ణం
సౌరాష్ర్ట సుందరం సోమనాథేశ్వరం
శ్రీశైల మందిరం శ్రీమల్లికార్జునం ఉజ్జయినిపుర మహా కాళేశ్వరం
వైద్యనాథేశ్వరం మహాభీమేశ్వరం అమరలింగేశ్వరం రామలింగేశ్వరం కాశీవిశ్వేశ్వరం పరం ఘృశ్మేశ్వరం
త్ర్యంబకాధీశ్వరం నాగలింగేశ్వరం
శ్రీకేదార లింగేశ్వరం
అగ్ని లింగాత్మకం జ్యోతి లింగాత్మకం వాయు లింగాత్మకం ఆత్మ లింగాత్మకం అఖిల లింగాత్మకం అగ్ని సోమాత్మకం
అనాదిం అమేయం అజేయం అచింత్యం అమోఘం అపూర్వం అనంతం అఖండం
ధర్మ స్థల క్షేత్ర వర పరం జ్యోతిం
ఓం నమః సోమాయచ సౌమ్యాయచ భవ్యాయచ భాగ్యాయచ
శాంతాయచ శౌర్యాయచ యోగాయచ భోగాయచ కాలయచ కాంతాయచ రమ్యాయచ గమ్యాయచ
ఈశాయచ శిరీషాయచ శర్వాయచ సర్వాయచ

*******************
చిత్రం: శ్రీ మంజునాథ (2001)
సంగీతం: హంసలేఖ
సాహిత్యం: మహర్షి వేద వ్యాస్
గానం: శంకర్ మహదేవన్


Saturday, January 3, 2009

kill any application in linux through terminal

Here is a small shell script to kill any application in Linux through terminal. Of course you should have the permission to kill that process.


EXPECTED_ARGS=1
if [ $# -ne $EXPECTED_ARGS ]
then
echo "Usage: appkill.sh [application name]"
exit 0
fi
pid=`ps -el | grep $1 | awk '{print $4}'`
echo $pid
kill -9 $pid

Save it as, say appkill.sh . Now make the file executable using the following command

$> chmod +x appkill.sh

Now one can kill any application by giving its name as an argument to the script

$> appkill.sh applicationname

Example: To kill firefox use

$> appkill.sh firefox

Saturday, December 20, 2008

My interview experience

I thought, I would start my blog with my interview experiences as the first post.
Here are the questions.

AVAYA
  • Written Test

    2 sections

    • Aptitude and English
    • Technical (around 15 questions and all are multiple choice questions)

    (I didn't remember the exact no.of questions because I have written 4 exams back to back on that day:-D)
    My suggestion for written test is to go for technical section first and then to aptitude.

  • Interview 1

    The panel consist of 2 interviewers.

    • How was the written test?

    I said “I did the tech part and aptitude part good and english part average”.

    • Started with my MTP(Mtech Project) and since I am doing in robotics, he asked the various sensors available on firebird?
    • About my course project of DBMS “Implementation of materialized views”. What is a materialized view? what is the advantage over a view? asked me a real world example where this is useful?
    • I gave a talk on linux commands in Prabhat-08, So, he asked me about grep and how to make it case insensitive? How to find the network interfaces of a computer?
    • What are the layers of OSI model?
    • In which layer is error control implemented?
    • what is TCP and UDP? differences?
    • If I have sufficient bandwidth why can't I use TCP for every application?(important one and can be expected in any interview)
    • Write a program for matrix multiplication;-)
    • At the end they completed with a puzzle

    There are 10 bags, numbered form 1 to 10, each bag has 10 coins, and each coing weighs 10 gms except one bag which contatins all 9 gms coins. You are given a digital balance and using only one weighing we need to find the 9 gms coings bag no.
    (As a already know this I told them but the general technique to follow here is that even if you know the answer don't answer it immediately, think for 1 or 2 mins. and then answer.)
    It was like a normal interview, without any tricky questions. And the best thing about AVAYA is only one round of interview. Thank God ;-)!!!!!