Thursday, November 1, 2012

How to find the number is Armstrong or not in Unix


#################################################
# To find the number is Armstrong or not                   #
#################################################

#!/bin/ksh
echo "This program is to find whether given number is Armstrong number or not”

# To make sure sufficient arguments
if [ $# -ne 1 ]
 then
   echo "Please provide one argument"
exit -1
fi

# Declaring and Assigning the values to the local variables
a=$1
s=0

# Logical part to find the Armstrong number
while [ $a -gt 0 ]
do
b=$(( $a%10 ))
s=$(( $s+$b*$b*$b ))
a=$(( $a/10 ))
done
if [ $s -eq $1 ]
then
 echo "The given number is the Armstrong number"
else
 echo "The given number is not Armstrong number"
fi
exit 0

How to find the sum of digits in the number in Unix


###########################################################
# To find the sum of digits in the number                 #
###########################################################

#!/bin/ksh

# Checking the required arguments
if [ $# -ne 1 ]
 then
   echo "Please provide one argument"
exit -1
fi

# assigning the arguments to the local variables
a=$1
s=0

# Logical part to find the sum of digits in the number
while [ $a -gt 0 ]
do
b=$(( $a%10 ))
s=$(( $s+$b ))
a=$(( $a/10 ))
done

echo "The sum of digits in $1 is $s"
exit 0

How to find whether string is palindrome or not in Unix


#############################################################
# To find whether the string is palindrome or not                                            #
#############################################################

#!/bin/ksh

# To make sure the sufficient arguments
if [ $# -ne 1 ]
then
  echo "Please enter one argument"
 exit -1
fi

# Declaring and assigning the values to the local variables
b=`echo $1 | wc -c `
c=$(( $b-1 ))
d=$(( $c/2 ))
flag=1
m=1

# Logical part to handle the palindrome calculations
while [ $m -le $d ]
do
    e=`echo $1 | cut  -c$c`
    f=`echo $1 | cut  -c$m`
    if [ $e != $f ]
      then
          flag=0
          break
    fi
     c=$(( $c-1 ))
     m=$(( $m+1 ))
done

  if [ flag -eq 0 ]
 then
echo "The string is not a palindrome"
else
echo "The string is palindrome"
fi
exit 0

Saturday, October 6, 2012

How to find the Largest and Smallest number in the given numbers in Unix


###############################################################
# To find the Largest and Smallest number in the given numbers      #
###############################################################

#!/bin/ksh

# To make sure sufficient arguments
if [ $# -ne 1 ]
then
  echo "Please provide the sufficient arguments"
  echo "bigsmall file_name"
  exit -1
fi

# Declaring and Assigning values to the local variables
set -A LIST `cat /clocal/fme/prod/forecast/padu/Lilly/numberlist.txt`
a=${#LIST[*]}
Small=${LIST[0]}
Big=${LIST[0]}

# Implementation of logic to find the biggest and smallest number
for i in ${LIST[*]}
do
 if [ $i -lt $Small ]
  then
  Small=$i
 elif [ $i -gt $Big ]
  then
  Big=$i
 fi
done
 echo "Smallest = $Small"
 echo "Biggest = $Big"

exit 0

How to find the biggest among 3 given numbers in Unix


##################################################################
# To find the biggest among 3 given numbers                                          #
##################################################################

#!/bin/ksh/

# To make sure sufficient arguments
if [ $# -ne 3 ]
then
echo "Please provide the three arguments"
exit -1
fi

# Declaring and assigning values to the local variables
A=$1
B=$2
C=$3

#Logical part to find the largest number among 3 numbers
if [ $A -gt $B  -a  $A -gt $C ]
   then
   echo "A $A is the biggest number"
        elif  [ $B -gt $A  -a  $B -gt $C ]
        then
        echo "B $B is the biggest number"
                elif  [ $C -gt $A -a  $C -gt $B ]
                then
                echo "C $C is the biggest number"

   elif  [ $A -eq $B -a $A -eq $C -a $B -eq $C -a  $C -eq $B ]
   then
  echo "All numbers are same"
fi

exit 0

Reverse the content in the file using Unix


#####################################################
# Reverse the content in the file                                       ##
#####################################################

#!/bin/ksh

# To make sure the sufficient arguments
if [ $# -ne 1 ]
then
  echo "Please enter the file name to be reverse"
  exit -1
fi

# Implementation of logic to reverse the content in the file
if [ -f $1 ]
  then
    rever=`rev $1`
 echo "Original file is"
 cat $1
 echo "Reverse of the file is"
 echo $rever
fi

exit 0

How to combine the files Vertically or Horizontally in Unix


########################################################
# Combine the files vertically or Horizontally                        ##
########################################################

#!/bin/ksh

# To make sure sufficient arguments
if [ $# -ne 2 ]
then
  echo "Please provide the two file names to be combine"
  exit -1
fi

# Initializing the local variables
file1=$1
file2=$2
Hori=/clocal/fme/prod/forecast/padu/Lilly/Horizontal.txt
verti=/clocal/fme/prod/forecast/padu/Lilly/Vertical.txt
echo "Please choose the combination format"
echo "1) Horizontal"
echo "2) Vertical"
read ch
case $ch in
1) cat $file1>$Hori
   cat $file2>>$Hori;;
2) paste $file1 $file2>$verti;;
*) ;;
esac
exit 0

How to display the alternative numbers in the given number in UNIX


##########################################################
# To display the alternative numbers in the given number         #
##########################################################

#!/bin/ksh

echo "Please enter one number"
read num
echo $num>temp.txt
i=1
len=`cat temp.txt|wc -c`

#Logic implementation

while [ $i -le $len ]
do
  alseries=`echo $num|cut -c $i`
  echo $alseries
i=`expr $i + 2`
done

rm -f temp.txt

exit 0

Tuesday, June 26, 2012

How to load the data using rule file in Essbase

In Essbase data can loaded into database in two ways:
                 Excel Lock & Sends.
                 Rule files.
Through Lock & Sends in excel data can be update/insert to the perticular combination of members.
Through rule file you can load the data file which consists bulk data.

Sunday, June 24, 2012

How build members in outline using rule file

Essbase outline is the hierarchical representation of the business system.
Outline has dimensions, members and attributes and many more.
Members, Attributes can be build using rule files even you can build the dimensions on the fly using rule file but this post covers how to build the members alone under the dimensions.

Friday, June 22, 2012

How to create an Outline in Essbase

In simple terms Essbase outline is hierarchical representation of the entire Business system.
It consists of Dimensions which are again categorized into two forms:
           Standard Dimension
           Attribute Dimension
Let's start simple journey to create the default outline

Tuesday, June 12, 2012

Small bug in Windows OS

I read one article in Computer Era Telugu edition last month about bugs in Windows OS.
This bug really caught my attention completely.

1) Open calculator application in the Windows OS.
2) Find the square root for 4 ( result will be 2)
3) Subtract the result from 2.
now check the result it will not be as you expected but it will be some other number.

Similarly check for the square root of 9 and subtract the result from 3 and check the result it will be some other value but not zero.

Thursday, April 26, 2012

How to copy directories alone from one directory to other


find . -type d  -depth | cpio -dumpl "Target directory path"
-depth : Always true. Causes descent of the directory hierarchy to  be  done  so  that  all entries in a directory are acted on before the directory  itself.   This  can  be useful  when  find  is  used  with cpio(1) to transfer files that are contained in directories without  write
permission.

cpio: copy files to or from archives.
Options : d : Creating a leading directories when needed.
              u : Unconditional
             m : preserve time, modifications
               l : link files
              p : In copy-out mode, cpio copies files into an archive. It reads a list of filenames, one per line, on the standard input, and writes the archive onto the standard output. A typical way to generate the list of filenames is with the find command; you should give find the -depth option to minimize problems with permissions on directories that are unreadable.
         

Why do elephants ears so big

The big ears are to help the elephants to stay cool, Elephants skin is very hard and it doesn't sweat, so to maintain the body heat elephants use their ears as Coolers, as at ears many of the blood vessels accumulated, there the exchange of heat taken place.

Saturday, April 21, 2012

My right mouse pop up no longer works in Excel?

When ESSBASE/Excel add-in is installed , the default behavior is for ESSBASE to "take over" your right mouse click.
This is because the Excel add-in provides for some additional ESSBASE functionality, the problem is that it is installed without your knowledge.
To regain the control of your right mouse pop up menu in Excel:

How fetch slice of data from one database to other database

We can fetch a slice of data from one database to other database using XREF function which intern using Location Aliases,
Here is small information how to use @XREF function in calculation script and Location Aliases in ESSBASE.

Thursday, April 19, 2012

How to do variance reporting in ESSBASE

Variance reporting property determines how ESSBASE calculates the difference between Actual and Budget data members,
The dimension should be tagged as Account then only variance reporting property becomes visible.
The member formula to calculate the variance reporting between Actual and Budget should consists either of @VAR or @VARPER
There are two types of variances
  •        Expense Reporting
  •        Non Expense Reporting.

Wednesday, April 18, 2012

What is Time Balance property in ESSBASE

Time Balance property is one of the hidden property in ESSBASE which comes into picture when you tag any dimension as a Accounts.
If an account dimension member uses the time balance property,it affects how ESSBASE calculates the parent of the member in Time dimension.
ESSBASE has three kind of TB properties:
  • TB First
  • TB Last
  • TB Average

Sunday, April 15, 2012

Know more about each file in ESSBASE

As soon as an application created in Essbase, the Analytical Services will creates different files such as Page file(.PAG), Index file (.IND) etc and each files stands for some specific purpose.
All these files are available at $ARBORPATH/app/application/database folder
.otn file (Outline file) : The files consists compile code for the outline hierarchy, member formula, Attributes and Aliases and others.

Sunday, April 1, 2012

Crazy bugs in Windows


Few bugs in windows which are funny and can't be explained by the Microsoft whole team, including Bill Gates!!!!!!

An Indian found that nobody can create a FOLDER anywhere on the Computer which can be named as "CON". This is something funny and inexplicable? At Microsoft the whole Team, couldn't answer why this happened! TRY IT NOW, IT WILL NOT CREATE A "CON" FOLDER