Friday, October 7, 2016

Palindromic String

You have been given a String S.You need to find and print whether this string is a palindrome or not. If yes, print "YES" (without quotes), else print "NO" (without quotes).
Input Format
The first and only line of input contains the String S. The String shall consist of lowercase English alphabets only.
Output Format
Print the required answer on a single line.

 
SAMPLE INPUT
aba
SAMPLE OUTPUT
YES
Code:

#include<stdio.h>
#include<string.h>

int main()
{
int i,j,a;
char s[100],p[100];
gets(s);
i=0;
a=strlen(s);
for(i=1,j=a;i<a;i++,j--)
{
p[i]=s[j];
}
if(strcmp(s,p))
{
printf("YES");
}
else
{
printf("NO");
}
}

Toggle String

                                        Toggle String

 You have been given a String S consisting of uppercase and lowercase English alphabets. You need to change the case of each alphabet in this String. That is, all the uppercase letters should be converted to lowercase and all the lowercase letters should be converted to uppercase. You need to then print the resultant String to output.
 
Input Format
The first and only line of input contains the String S



Output Format
Print the resultant String on a single line.
 
SAMPLE INPUT:
abcdE
SAMPLE OUTPUT:
ABCDe


C code:
#include <stdio.h>
int main ()
{
     int c = 0;
     char ch, s[1000];
     gets(s);
     while (s[c] != '\0')
   {
     ch = s[c];
     if (ch >= 'A' && ch <= 'Z')
         s[c] = s[c] + 32;
     else if (ch >= 'a' && ch <= 'z')
         s[c] = s[c] - 32;  
     c++;  
   }
    printf("%s\n", s);
    return 0;
}











 Explanation:
        We know that for every alphabet there is an decimal value associated with it (List is available in the last of this post).We have used this concept to cinvert lower case into upper case and vice versa.
     -First of all we done declared the values.
     -Using gets function we can accept the string input while executing.
     -After that we are comparing whether the position is the end of the string.
     -We have applied logic that if the input character is in between A and Z then it is added with value 32 which converts it into lowercase and in the same way we compare whether the value is in between a to z and  subtract 32 from it to convert it into uppercase.
 

SymbolDecimal
A65
B66
C67
D68
E69
F70
G71
H72
I73
J74
K75
L76
M77
N78
O79
P80
Q81
R82
S83
T84
U85
V86
W87
X88
Y89
Z90


SymbolDecimal
a97
b98
c99
d100
e101
f102
g103
h104
i105
j106
k107
l108
m109
n110
o111
p112
q113
r114
s115
t116
u117
v118
w119
x120
y121
z122



Thursday, October 6, 2016

How to deal with jmeter scripts with huge post body

    Jmeter is one of the best open source resource for testing.Many of the testers will be familiar with jmeter.   In this blog I will explain how to deal with jmeter scripts with massive post body which may effect the performance of the jmeter.    

     First of all while recording itself make note of HTTP sampler names in which post body is huge so that it may be reference for you during editing.Now after recording just save the file in your desired location.Now disable the transaction which are having huge post body and run the .jmx file.Now according to that post body apply the correlations to extract data to be replaced in post body.Note down the variable names.

     Now open this saved .jmx file in notepad(better if it is notepad++). Now search with the sampler name along with sampler number which you have noted during scripting.There you can see the post body inside string elements with " replaced by &quot; as it encodes the value so don't get confused.Now copy that post body and paste it in another notepad page.Now here do the modification like replacing with correlated values and copy that modified post body and replace the same in the main file.
     But be careful not to change the format of the .jmx string element because it may show you an error, eventually jmeter will not open it.

Wednesday, October 5, 2016

Trees talk to each other

Have you ever thought of how trees communicate.You might be curious to know,the same curiousity made me to search about this topic and I found it.
         I have seen a TEDx talk which explains how trees actually communicate.I came to know that trees actually communicate through roots in form of carbon molecules sharing.This has been proved in the canadian forest by that person who gave the talk.She planted 80 replicas of three types of plants together with plastic covers over them and then she injected different types of carbon isotopes into that plastic bags and left them for an hour so that the plants can absorb the carbon gas and start photosynthesis.After an hour she tested the plants then she came to know that two plants shared carbon dioxide through roots because there is not other way for the carbon gas to enter except through roots because she covered plant with plastic cover.She came to know that same type of communication happens in forests also,it's like a internet beneath the surface of forest,where giants helps small plants to grow by suppling carbon dioxide.She also proven that the tree of one species recognise the same type of child tree and supplies more carbon dioxide like mothers caring their childrens.One of the best part is if an old tree is about to die it sends the carbon molecules into the network so other trees can utilize it,because trees are not selfish like humans.They even provide enough space for the same type of child plant to nourish their roots.
    So there is network in forest which is a biological network which helps for plants to upload and download data in form of carbon molecules.