How to make TextView in android scrollable?

A TextView cannot be scrollable by default. It needs to be in a scroll view tag in the xml file in layout folder. Following code snippet will help you fix the issue:

Copy the following code snippet in your xml file in layout:

<RelativeLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_height=”wrap_content” android:orientation=”vertical” android:id=”@+id/relativeLayout1″ android:layout_width=”match_parent”>

<ScrollView android:visibility=”visible” android:layout_height=”335dip” android:layout_width=”match_parent” android:keepScreenOn=”true” android:scrollbarStyle=”insideInset” android:id=”@+id/scrollView1″ android:scrollbars=”vertical” >
<TextView android:text=”The wesite text will be displayed here” android:isScrollContainer=”true” android:layout_width=”fill_parent” android:id=”@+id/pagetext” android:scrollbars=”vertical” android:layout_gravity=”top” android:keepScreenOn=”true” android:layout_height=”match_parent”></TextView>
</ScrollView>

<TableRow android:layout_alignParentLeft=”true” android:layout_height=”wrap_content” android:id=”@+id/tableRow1″ android:layout_width=”match_parent” android:layout_alignParentBottom=”true”>
<EditText android:text=”EditText” android:layout_height=”wrap_content” android:id=”@+id/editText1″ android:layout_width=”200dip”></EditText>

<Button android:text=”@string/read” android:id=”@+id/button1″ android:layout_height=”wrap_content” android:layout_width=”wrap_content” android:onClick=”myClickHandler”></Button>
</TableRow>

</RelativeLayout>

Posted in Android | Tagged , , , , | Leave a comment

Brief introduction of NuCaptcha

CAPTCHA

Captcha is a type of challenge response test for authentication to ensure human interaction for any given web page. CAPTCHA stands for “Completely Automated Public Turing Test to Tell Humans and Computers Apart”. It is a field related to Artificial Intelligence (AI) which is used for ‘humanoid’ evidence.

How It Works:

The users usually have to enter the text of a cluttered image for a successful login. If the entered response doesn’t match the code, the form is not submitted and the user receives an error response. It has a set or a single puzzle that needs to be solved. The puzzle generation is an automated process. The communication between the server and the Captcha system is encrypted.

Advantages:

  • Avoids “Spamming”.
  • Restricts e-mail access.
  • Allows authentic user access.
  • Prevents forum attacks.
  • Distinguishes between machine and human users.
  • Solves problems of accessibility, bandwidth, and server load.

NUCAPTCHA:

NuCaptcha is a video-based Captcha technique in which a video comprising of the security code is played and the user has to enter the text displayed in the video. It is a combination of Java-script, HTML5, and Adobe Flash.  It is easier to read and is more secure.

Features:

  1. Security
  2. Animation
  3. Behaviour analysis
  4. Human friendly
  5. HTML5 support

1. Security:

The traditional Captcha techniques are vulnerable to attacks hence still a security concern. This technology reduces the security risk to a great extent as it uses video animation as a medium to validate the user. The content in a Captcha is known as a “Clutter”. These are mainly overlapping letters, but reading them takes quite an effort from a static image. NuCaptcha makes reading of these clutters easier without compromising security.

2. Animation:

As the saying goes, “An image is worth a thousand words”, same is the case with videos. A video is always a convenient and most efficient way of communication. Thus NuCaptcha is gaining popularity for its video technology.

3. Behaviour analysis:

This is a system used to monitor the system interaction. This information is then used to tune the security level of each Captcha. Real users are given easy Captchas whereas attackers are given difficult ones.

4. Human Friendly:

NuCaptcha is very easy to use. It has a success rate of more than 90%. Every one using NuCaptcha prefers it to the complex text Captchas.

5. HTML5 Support:

NuCaptcha supports HTML5 video tags on selected platforms. If HTML5 is not compatible then it uses Adobe Flash. It can display animated GIF (Graphics Interchange Format) if the previous two are not compatible.

Conclusion:

NUCAPTCHA is here to stay as it is compatible and easy to use for any given platform and for any type of user. It is also a great tool to prevent or avoid security hacks from attackers. Video animation is user friendly and more attractive to the users. Moreover timely advancements are made in the NuCaptcha algorithm.

Posted in Security | Tagged , , , , | Leave a comment

Resize linux /tmp partition

We can increase the “/tmp” partition on Linux without reformatting the file system.

Use following steps to re-size tmp partition:

  • Change “count=2” field as per your requirement.
  • Create “/home/tmp-dir” directory in the partition with sufficient available space.
  • Change “/tmp” in last command to original path give in /etc/fstab

dd if=/dev/zero of=/home/tmpDir bs=1024M count=2
mke2fs -j /home/tmpDir
mount -t ext3 -o loop /home/tmpDir /tmp
/home/tmpDir /tmp ext3 defaults,loop 0 0

  • Set permission to 1777 for “/tmp” once it’s created.

Hope this will make your job easy for resizing /tmp partition.

Posted in Linux | Tagged , , | Leave a comment

Alpha and Beta Testing

In the development of any product, it is not a good practice to simply develop the program and release it right away. The product needs to pass a sequence of rigorous tests to make sure that the product matches the requirements of the client and has no serious problems in it.

Why Alpha and Beta Testing?

If a software application will be used by many users then it is impossible for software developer and tester to forecast how the customers actually use a program . Customer may use odd combination of data regularly. Thus most of software product vendors use a process called alpha and beta testing to uncover errors that only the end users may find. Alpha and  Beta testing is done by customers (end users) rather than testing professionals.

A] Alpha Testing

- Alpha testing is performed by Customer  at the developer’s site.

- Alpha testing is conducted in a controlled environment which means testing is conducted in development environment in the presence of developer, testers and end users.

- The developer guide the users about application and records defects and usage issues while testing. This is also called developer “looking over the shoulder” of user.

B] Beta Testing

- Many times we have heard term “Beta release/version”. It is related to beta testing .

- Beta testing is performed by end users at end user’s site.

Unlike alpha testing the developers are not present so we can say that beta testing is conducted in uncontrolled environment.

-  The users records all issues and problems occurred during use of application and reports these issues to developer regularly.

- The software engineers take care of all issues reported during beta testing and makes necessary modifications and then prepare the product for final release to the entire customer base.

Posted in Quality Assurance & Testing | Tagged , , | Leave a comment

Know SEO step by step

After you have completed the configuration settings of your blog and started posting articles on it, the next logical step would be blog promotion. The first aspect that comes to our mind for blog promotion is Search Engine Optimization (SEO). There are many factors in SEO that can help you to get at the top of a search result. You need to be patient enough to learn different techniques, implement them and watch your blog or website grow gradually. I have tried to explain a few methods that will help you to enhance SEO:

1. Article Writing/ Submission: Article writing & submission is the best way to increase backlinks and get indexed by Google. The number of articles you submit to any article directory is directly proportional to the number of backlinks you create, provided the article is approved and listed by the directory. You have to make sure that the article content is unique and well written to generate quality backlinks.

Try to get your website/ blog listed in High PR (Page Rank) article directory to ensure generation of quality backlinks. There are chances that your articles could be republished in other article directories as well. There are many blogs which allow visitors to write blogs as a guest blogger. This technique however requires high level of proficiency and excellent quality articles.

2. Link Bait: Less popular but most effective, link bait is receiving more attention by the day. It is a process to create backlinks naturally by tempting other webmasters and visitors to refer your domain at their own will. Quality content, pictures or a widget can serve as link bait.

3. Link Exchange: It is the simplest and most followed way to get backlinks. All you have to do is search for good link directories on the Internet. There are three categories in link exchange program, One Way Link Exchange, Reciprocal Link Exchange and Paid Link Exchange.

4. Deep linking: This is yet another type of link exchange in which a user points to a specific page on a website, instead of using site home page or main page.

5. Inline Linking: This is use of a linked object, often an image, from one site by website belonging to a second website. You can use inline link in following manner (<img src=”http://www.example.com/picture.jpg” />) instead of this (<img src=”picture.jpg” />).

6. Classified: You can post free classified ads on online advertising websites for increasing traffic to your website. You can create backlinks for your website which is good for your website’s SEO but not all the classified ads websites allow you to post the content along with backlinks. Although you get an increased traffic to your website it is often observed that the visitors usually on’t read your ads.

7. Social Networking: This is the new trend in internet marketing that can potentially drive traffic to your website. Social media networking continues to grow as users spend more time on Facebook than on Google. Facebook and Twitter are the most used social media networks to drive traffic. The most important fact remains that social media marketing can be used to generate traffic with no money being spent on traffic acquisition costs.

Posted in Search Engine Optimization | Tagged , , , , | Leave a comment

How to use CURL in PHP?

CURL- Client URL Library
CURL connects different types of servers and communicates with different types of protocols like http, https and ftp.

In order to use CURL, you need to install the libcurl package.

You can check whether it is installed or not using the phpinfo function. For this you can create a test php page like test.php

The following code will be included in that page and run on your server:

<?php
 phpinfo(); 
?> 

If CURL is installed, you will see the following:

If CURL package is enabled, then no need to install and you can directly use CURL function. Otherwise you need to install it or you can contact your hosting provider to install CURL package.

curl_init() function is used to start the CURL session. After initializing the CURL session, you have to define the CURL options via curl_setopt() function.
After defining the options, curl_exec() function is executed and it returns the response (TRUE on success or FALSE on failure).
curl_close($ch) function is used to close the CURL session.

For an example, you can refer the code snippets as below:

<?php 
 $chinit = curl_init("www.mysite.com/curl.php?option=test");
 curl_setopt($chinit, CURLOPT_HEADER, 0); 
 curl_setopt($chinit, CURLOPT_POST, 1); 
 url_setopt($chinit, CURLOPT_RETURNTRANSFER, 1); 
 $result = curl_exec($chinit); curl_close($chinit); 
 echo $result; 
?> 
Posted in PHP | Tagged , , , , | Leave a comment

Google Trends PHP API for Hourly Updates

We are all aware of the importance of relevant meta data for SEO hence we are constantly on the look out for the most researched keywords in search engines primarily Google. Google also provides Google Trends tool which gives insights into broad search patterns.

Google trends can be accessed here: http://www.google.com/trends

Here you can find the complete information with graphical representation on a  scale based on the average worldwide traffic of Keywords you entered in all years.

Google trends also has its PHP API which fetches top 20 hot trends. Google has restricted the access to 20 keywords. These can be fetched date wise or hourly. The sample code to fetch hourly hot trends of Google is as follows:

<?
// Fetches google hot hourly 20 trends
$trends = new GoogleHotrends();
$keywords = $trends->fetch_trends();
print_r($keywords);

class GoogleHotrends {
private $trendsurl = “http://www.google.com/trends/hottrends/atom/hourly”;

public function fetch_trends()
{
$c = curl_init($this->trendsurl);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
$responsedata = curl_exec($c);
curl_close($c);
return $this->parse_trend_feed( $responsedata );
}

private function parse_trend_feed( $data )
{
preg_match_all(‘/.+?<a href=”.+?”>(.+?)<\/a>.+?/’,$data,$matches);
return $matches[1];
}
}
?>

The above code returns the array of 20 keywords that people are searching on Google today. This can be very useful to track  the sudden change (increase or decrease in popularity of a particular keyword) and get updates hourly.

Posted in PHP, Search Engine Optimization | Tagged , , , , , | Leave a comment

Introduction and installation of RRD Tool

RRD Tool is a Round Robin database tool developed by Tobias Oetiker, a system manager at the Swiss Federal Institute of Technology.

RRD tool is mostly used to store and process the data collected via SNMP. It can be used on any operating system. The data is mostly in bytes (or bits) transferred from and to a network or a computer. It can also be used to display solar radiation, power consumption, number of visitors at an exhibition, noise levels near an airport, etc. Only a sensor is needed to measure the data and feed the numbers into the rrd tool.

RRD Tool database is mainly used for monitoring purposes. Defining any tables with columns and other parameters is not required as they are simple in structure. In RRD database, data is stored in a round robin fashion (i.e. in a circular buffer). It is implemented like a FIFO queue, that is when new data gets entered into database, the old data is removed from it. As this database is like round robin, it will always contain the fixed amount of information throughout its lifetime.

RRD Tool database works as a back end tool as well as front end tool. At back end, RRD Tool can be used as a database to store data and at front end it can be used for plotting graphs. The main advantage of RRD Tool is that the size of the database always remains constant. Whereas in linear databases, the size of the database increases as new data is always appended at the bottom of the table.

Linear databases are updated when values are supplied to it, but the RRD Tool database needs data at specific time intervals. So while using this database, it is better to use the scripts that run at regular intervals, so that RRD Tool will receive the new data at regular intervals for updating the database. If it does not receive the new data during any interval, it will store an unknown value for that interval. After all the values are updated in database, you can fetch the values and generate graphs using them. The rrd commands are executed from command prompt to fetch and update values from database and to generate graphs.

RRDtool can be used directly from languages like Perl, python, PHP etc. Cacti, SmokePing, MRTG, Zenoss, collectd, Nmon are the popular graphing programs, whose database is based on RRDtool.

Installing RRD Tool :

Installing RRD Tool is very easy and simple.

Create a folder named RRDTool on any of the drives, download the latest version of rrdtool and extract the zip file into the newly created RRDTool folder.

Then open the command prompt and type in the following command:

cd C:\RRDTool\

After this, you are ready to use rrd tool.

Generating graphs using RRD Tool :

  • For plotting graphs using rrd tool you need to create rrd file for storing the data.
  • Then you need to execute the update command at regular intervals to keep on updating the data with new values in rrd.
  • Finally, execute the graph command for generating the graph of updated values in rrd.

create : This command is used to create rrd files that initially stores the unknown data.

Syntax :- rrdtool create filename.rrd -s 60 DS:input:GAUGE:600:U:U DS:output:GAUGE:600:U:U RRA:AVERAGE:0.5:1:10080

  • DS is the name used to reference the data source from rrd.
  • RRA is round robin archive that consist of a number of data values for each of the defined data sources.

update : This command provides new data to the rrd.

Syntax :- rrdtool update filename.rrd N:value1:value2

  • It updates the filename.rrd file with two known values.

graph : This command is used to present the data from rrd to user in the form of graphs.

Syntax :- rrdtool graph filename.png –imgformat PNG –font DEFAULT:7: –lazy –height=117 –width=201 –alt-autoscale-max –lower-limit=0 –slope-mode –vertical-label=Amps DEF:IN=54_oooo_voltage.rrd:input:AVERAGE: DEF:OUT=54_oooo_voltage.rrd:output:AVERAGE: AREA:IN#00CF00:Input LINE1:OUT#0000FF:Output –end now –start end-10m –title title

  • imgformat specifies the format of the image to be created.
  • font specifies the type of font and its size.
  • alt- autoscale modifies the absolute minimum and maximum values.
  • limit specifies the upper and lower limit of y axis.
  • vertical- label specifies the vertically placed string at the left hand side of the graph.
  • LINE and AREA specifies the value and color for the line drawn and the area.
  • start and end specify the start and end of the time series that you want to display.
  • title specifies the title for graph at the top of it.

 

 

 

 

 

Posted in Tools | Tagged , , , , | Leave a comment

PHP FriendFeed API v.2 using OAuth method

FriendFeed is an interesting amalgamation of social media and bookmarking site by which users can share links, photos and videos and converse about the post with their friends.

FriendFeed has upgraded its API recently to make it simpler to use and added some new features. FriendFeed has switched from CURL authentication to OAuth authentication. OAuth makes the user experience simpler and more secure. FriendFeed supports the OAuth Core 2.0 standard.

Following are the steps to connect with FriendFeed using OAuth:

1] Create your account on FriendFeed (http://friendfeed.com)

2] Register your application using the following link:
http://friendfeed.com/api/register

3] After the registration of your application you can manage it using:
http://friendfeed.com/api/applications
(Specify proper callback urls)

4] Get your secret keys from “manage application”.

5] FriendFeed OAuth API library needs to be included to avail to the FriendFeed operations like post and view feeds. You can download the FriendFeed library by clicking on the link at the bottom of this post.

6] Create the OAuth URL using following code:

$ff = new Friendfeed($consumer_key ,$consumer_key_secret); $tokens = $ff->fetch_oauth_request_token();
$request_token = $tokens["oauth_token"]; 
$oauth_token_secret = $tokens["oauth_token_secret"]; /// Save the response in session for further use. $_SESSION["ff_oauth_token_secret"] =  $oauth_token_secret; $_SESSION["'ff_oauth_token"] =  $request_token; 
$auth_url = $ff->get_oauth_authentication_url($tokens); 
echo '<a href="'.$auth_url.'">Login to frienfeed </a><br>';

7] After successful authentication, FriendFeed redirects you to the callback url specified while creating the application. You need to save the tokens in the database that are provided to you in the URL. The code is as follows:

$oauth_token = $_GET['oauth_token'];  // Provided you in URL $_SESSION["ff_oauth_token_secret"] =  $oauth_token_secret; //  Retrive ff_oauth_token_secret from session stored in step 6. $ff = new Friendfeed($consumer_key ,$consumer_key_secret); # Get access token $arr = array('oauth_token' => $oauth_token,'oauth_token_secret' => $oauth_token_secret); $db_tokens = $ff->fetch_oauth_access_token($arr);  // Save the tokens in $db_tokens in database for further use.

8] Fetch FriendFeed profile using the following URL:

$Ff = new FriendFeed($consumer_key, $consumer_key_secret, array ('oauth_token' => $db_tokens['oauth_token'], 'oauth_token_secret' => $db_tokens['oauth_token_secret'])); $resp = $Ff->fetch_feed('me', array ('num' => 500)); print_r($resp)         // Prints your profile.

9] Use the following code to update the status:

$ff = new Friendfeed($consumer_key ,$consumer_key_secret); $Ff = new FriendFeed($consumer_key, $consumer_key_secret, array ('oauth_token' => $rowList['access_token'], 'oauth_token_secret' => $rowList['access_token_secret'])); $Feed = $Ff->post_entry($bookmark_title,$bookmark_url,'me'); print_r( $Feed) // Check the response to validate status is updated successfully.

The API requires OAuth library to execute OAuth related operations; you can click here to download OAuth library and FriendFeed library.

Posted in API, Programming | Tagged , , , | Leave a comment

Types of Software Testing

Testing is finding out how correctly the product works. In other words it is a process that is used to identify correctness, completeness and quality of software. In this post we will discuss various types of software testing. Let us first understand Manual and Automation testing:

MANUAL TESTING:

Manual testing is done by a person carefully going through application screens, trying various input combinations, comparing the results with the expected behavior and recording their results. Manual tests are repeated in the whole development cycles for code changes.

Manual testing advantages:

  • Early Testing – Test Cases can be prepared for testing as soon as the requirements are finalized.
  • Useful for small duration projects.
  • Useful for projects whose GUIs constantly change

AUTOMATION TESTING:

Automated testing is performed by using automation tool which is able to playback pre-recorded scripts and predefined actions to compare the results to the expected output to report pass or fail. Once automated tests are created they can be used to retest the application again.

Automation testing advantages:

  • Reduces repetitive work load
  • Less resources required
  • Execution is faster
  • Quick Reporting

Different types of Testing:

1. Unit Testing:

This part of testing is considered the basic level testing that focuses on the smaller building blocks of a program or system separately. Unit Testing is the earliest stage of testing and is the most important stage in removing defects. Unit testing permits the testing and changing code of small units, thus providing a better way to manage the integration of the units into larger units. The detailed unit design is used as a basis to compare how and what the unit is able to perform.

Unit testing will be conducted by the Development Team and also prepare test cases for Unit Testing.

2. Integration Testing:

Prior to the beginning of System Testing, groups of units are fully tested. Units are added, one or more units at a time to the already integrated modules. The goal of integration testing is to verify that modules interact correctly and the hardware and software are integrated adequately.

Preparation of test cases and Integration Testing is conducted by the Testing team.

3. System Testing:

This phase of testing is performed prior to User Acceptance testing. Its purpose is to test the system as a whole for functionality based on the system test plan. The goal of System testing is to verify that the requirements are implemented correctly and include usability testing, performance testing, functional testing, and error checking.

4. Defect Verification Testing:

If an issue or problem is encountered during any testing activity a defect will be entered into the Defect Management Tool. If the defect or problem no longer exists, the defect can be closed. However, if the problem has not been corrected, the defect is reassigned back to the Development team for further investigation and analysis.

5. Regression Testing:

One of the aspects of software development that can affect the operational status of an application is the effect of making changes to a software system. For example, one module is developed and thoroughly tested. Then a change is made to another module, which has a major effect on the thoroughly tested portion. Either the incorrectly implemented change caused a problem, or the change introduced problems in a previously tested module. Regression testing retests previously tested functions to ensure that they still function properly after a change or update has been made. Regression testing is performed after each new delivery in test environment by testing team. Regression testing involves rerunning tests that have been previously executed to ensure that the same results can be achieved currently as were achieved when the system was last tested.

Posted in Quality Assurance & Testing | Tagged , , , , , | Leave a comment