How to Hide/Encrypt HTML Source Code

Developers are increasingly concerned for the security of their websites. Hence most of the developers want to hide their HTML code.

Though it is impossible to hide HTML source code, you can make it unreadable by simply using encryption and decryption techniques or disable mouse right click using JavaScript.

Let’s see Right Click Disable Method with a random code as follows:

<SCRIPT TYPE=”text/javascript”>
var msg=”You cannot use right click on this page.”;
function clickIE() {if (document.all) {( msg);return false;}}
function clickNS(e) {if
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {( msg);return false;}}}
if (document.layers)
{document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
document.oncontextmenu=new Function(“return false”)
</SCRIPT>

Though this code helps you to disable right click of mouse on your page but if JavaScript is disabled on client’s browser, the right click of the mouse is enabled by default. Hence we need to take adequate security measures.

In next method, we will discuss encryption and decryption techniques in JavaScript with keys.

Following is the example with encryption and decryption of HTML source code in ASP:

<%@ Language=VBScript %>
<SCRIPT language=”javascript” runat=”server”>
function encodestr(s,k) {
var sl=s.length;
var kl=k.length;
for(encodestr =”,i=0; i<sl; i++) {
var encodedChar=s.charCodeAt(i)^k.charCodeAt(i%kl);
encodestr += String.fromCharCode((encodedChar & 0x0F) + 97) + String.fromCharCode((encodedChar >> 4) + 97);
}
return encodestr;
}
</SCRIPT>

Above JavaScript is run at server side called “encodestr” that has two parameters namely “s” which is the string to be encoded and “k” is the key for encoding.

<%
set objHttp = Server.CreateObject(“Msxml2.ServerXMLHTTP”)
objHttp.open “GET”, “http://www.google.com”, false
objHttp.setRequestHeader “Content-type”, “application/x-www-form-urlencoded”
objHttp.Send()
resp = objHttp.responseText
resp=encodestr(resp,”key”)
%>

Above code is the ASP code which collects “http://www.google.com” HTML format code and stores in “resp” variable in string format which is further encoded using “encodestr” and stored again in same variable.

<SCRIPT type=”text/javascript”>
function decodestr(s,k) {
var sl=s.length;
var kl=k.length;
for(decodestr =”,i=0, j=0; i<sl; i+=2, j++) {
decodestr += String.fromCharCode(((s.charCodeAt(i) – 97) + ((s.charCodeAt(i+1) – 97) << 4))^k.charCodeAt(j%kl));
}
return decodestr;
}
</SCRIPT>

Above mentioned JavaScript is run at the client side. The function “decodestr” also has two parameters, ”s” which is the string to be decoded and “k” is the key for decoding which must be same as used for encoding.

<SCRIPT type=”text/javascript”>
document.write(<%= “decodestr(“”"&resp&”"”,”"key”")”%>);
</SCRIPT>

The script syntax mentioned above sends the encoded string to “decodestr” and return string is written by document.write.

By using the above method you will get HTML source code in encrypted format which is not easily readable. You can use both of the above techniques for better security.

You can use your own technique for encryption and decryption but be sure that encryption code is not visible at client’s browser. For this you can use “runtat=’server’” attribute in your JavaScript function.

 

Originally posted 2011-08-22 10:59:18.

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

Introduction to Cloud Computing and Service Models

What is cloud computing?

Cloud Computing is a very comprehensive topic to understand and still in its infancy. It can be termed as the next evolution of computing. Cloud computing offers number of benefits to its users.

Depending upon the usage and advantages, there are several definitions of cloud computing. We can define cloud computing in a number of ways some of them are as follows:

1.  Cloud Computing is the use of multiple server computers via a digital network.

2.  Cloud Computing is an internet based computing environment where you pay only for resources that you use.

3.  Cloud computing is a technology which provides “Resource Optimization” where one can adjust the resource allocation by adding and removing resources dynamically to fit the need.

4.  National Institute of Standards and Technology (NIST) defined Cloud Computing as  a model for enabling convenient, on-demand network access to a shared pool of configurable computing resources (e.g., networks, servers, storage, applications, and services) that can be rapidly provisioned and released with minimal management effort or service provider interaction.


cloud computing Introduction to Cloud Computing and Service Models

Key Cloud Characteristics:

• On-demand self-service

• Ubiquitous network access

• Location independent resource pooling

• Rapid elasticity

• Pay per use

There are three service models of Cloud Computing:

1.  Infrastructure as a Service (IaaS)

2.  Platform as a Service (PaaS)

3.  Software as a Service (SaaS)

cloud service models Introduction to Cloud Computing and Service Models

These service models are not new to the IT world, the difference is only that cloud computing combines and integrate these approaches.

Infrastructure as a Service : Primary objective of an organization is to reduce time & money required to  procure, provision, and install new hardware systems. IaaS fulfills this primary objective i.e. equipment is outsourced to support operations. This is a provision model in which service provider is responsible for the housing, running and maintenance of the equipment.

Platform as a Service : PaaS provides computational resources through the platform such as Operating System. PaaS is built upon the principals of Infrastructure as a Service by providing an environment where applications can be built and deployed in a secure, rapid and high quality manner. The business needs Information Technology to rapidly develop, deploy, and maintain new applications to remain competitive and PaaS helps organizations in the same. PaaS eliminates the hardware dependency and capacity concerns. It also provides a simplified deployment model.

Software as a Service : SaaS is the most basic form of cloud computing. It includes implementation of specific business functions, customized business applications, etc. The major benefit of SaaS is that there is no licensing risk involved and neither there is any version compatibility issue. It reduces the hardware cost as well.  You pay for the software and the underlying infrastructure and does not require technical know-how. Typical examples of SaaS application software are ERP, CRM, Google Docs, etc. SaaS ensures lower capital, better cash flow and reduced IT support cost.

Originally posted 2011-10-20 13:45:21.

Posted in Cloud Computing | Tagged , , , , , , , | Leave a comment

How to repeat header rows on each page in Reportviewer (RDLC)?

In your .rdlc report there is small down arrow at the bottom right corner with red box,  you need to click on “Advanced Mode”.

1 How to repeat header rows on each page in Reportviewer (RDLC)?

By clicking, your row and column groups will expand with new fields  named “Static” as shown below:

2 How to repeat header rows on each page in Reportviewer (RDLC)?

Now, click “Static” in Row Groups list, and check the properties on the right side:

Set “RepeatOnNewPage” to “True” and “KeepWithGroup” to “After” as shown below:

3 How to repeat header rows on each page in Reportviewer (RDLC)?

Now, repeat above procedure for all “Static” rows in Row Groups list, except the “Static” rows present under the different group (encircled with black color in following figure), do same for the Details group (encircled with red color):

4 How to repeat header rows on each page in Reportviewer (RDLC)?

This enables you to view Header Row on each page of .rdlc report.

Originally posted 2011-12-20 13:30:29.

Posted in .NET | Tagged , , , , | Leave a comment

Automated testing tool QTP (Quick Test Professional)

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.

What is QTP?

QTP is an automated functional Graphical User Interface testing tool that allows the automation of user events on an application. It uses VB Scripting language to specify the test procedure, and to direct the objects and controls of the application. It works by identifying the objects in the application and performing the desired operations on them, it can also be used to capture object properties like name or Text ID etc.  Framework of QTP is designed mainly for Windows and Web-based applications. QTP is primarily used for regression testing.

Few distinct advantages QTP offers over other testing tools:

  • QTP uses VB scripting language which is more user friendly and easy to understand.
  • Better Support for VB, Java based applications due to inbuilt add-ins.
  • Able to split a single test into various actions for making debugging easier and better maintainability.
  • Enhancement of existing QTP scripts without the application being available; by using the Active Screen.
  • Ability to set up Property Recognition Order and prioritization using Object Identification menu.
  • Working with Object Repository in terms of Object Repository Comparison, Exporting Local objects, etc. in advance manner.
  • Easy integration of external function files in terms of creating Libraries.

Basic settings that need to be done in QTP before recording test scripts are:

  1. Open a blank QTP script with appropriate Add-ins.
  2. Navigate to Automation->Record and Run settings.
  3. Under Web tab select the First radio button which states “Record and run test on any open browser”.
  4. Click on Window Applications tab and select the First Radio button which states “Record and run test on any open Windows-based application”.
  5. Click on Apply button and then click on OK button.
  6. Navigate to File->Settings.
  7. Select Run on left side window.
  8. Under Data Table iterations select the first radio button which states “Run one iteration only”.
  9. Enter ’60’ in Object synchronization timeout field.
  10. Select both the check boxes which states “Disable Smart Identification during the run session” and “Save image of desktop when error occurs”.
  11. Click on Apply button and then click on OK button.

What is Keyword View and Expert View in QTP?

Keyword View: In keyword view actions which are performed by the user are shown in tree format along with the input data. Window and object details are also shown.

Expert View: In expert view script which is automatically generated by QTP in VBScript language during recording is displayed. Any changes made in the Expert View are automatically synchronized with the Keyword View.

In our next blog we will discuss about the three types of recordings (Normal, Analog and Low-Level) and also the different types of checkpoints used in QTP.

Originally posted 2011-08-20 13:45:23.

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

Advantages of using PHP Frameworks

PHP is Server Side Scripting Language compatible with all known OS like Windows ,Linux etc .Nowadays, PHP frameworks are being extensively used by programmers to address to performance tuning issues faster and with ease. They offer extensible architecture and features that make source code programming easier by providing standard templates and plug-ins.Efficiency can be drastically increased using PHP Frameworks. You can choose from a plethora of frameworks tailored to satisfy your specific coding needs. Some frameworks most commonly used are Codeigniter , Zend ,Cake PHP, Smarty, etc.

The main advantages of PHP Framworks over Core PHP are as follows:

  • Frameworks Like Codeigniter, Cake PHP, Zend,  etc. support almost all database connections like  SQL, My SQL, Oracle and ODBC.
  • These superlative PHP frameworks follow MVC (Model View Controller) architecture which is a great combination of database application (model), HTML coding (view) and input/ output instructions (controller).
  • It will make your code lightweight, sharp and secure.
  • Frameworks speed up the development process by automatically creating functionality like CRUD so that the developer can focus on creativity than base structure.
  • Using frameworks drastically reduces the time of the project as complex codes need not be typed.
  • As MVC pattern is used, the code gets optomized hence will run faster.
  • These frameworks have inbuilt Core Library, hence coding gets lighter as compared to the traditional way of PHP coding.
  • Same code can be used in different projects with some modification . Hence recycling the code is one of the most important feature provided by the PHP frameworks.
  • They have several creative functions that are prepared  to have an edge in coding.
  • There are functions for handling date formats, database connections, handling emails, editing strings, etc.
  • PHP frameworks have their own specific debugging methodologies.
  • One of the most important feature is community help.  In the ever growing community you find many people ready to offer help with the frameworks and keep updated with the latest versions to enable maximum usability .

Originally posted 2011-12-14 13:55:20.

Posted in PHP | Tagged , , | Leave a comment

What is Windows Service and How to Create it?

What is Windows Service?

Windows Service applications run for a long time and are mostly used in server environments therefore they are usually called long-running applications. Capability to create windows service is one of the powerful features of .net.

Windows Service applications do not have any user interface or they do not produce any visual output. Services can run in the background while a user is performing or executing any other task in the foreground. If any user messages are generated, they are written to the Windows Event Log.

When the computer is booted, all windows services start automatically. They do not require any user to be logged in, for executing the services. Some services may load before a user logs in to the system, so these services can’t depend on a user to be logged in to run. Most Windows Services needs to be in running state all the time. So the services can run under any user including any system. There can be various Windows Services that start at boot-up time and system maintains the list of these services.

Windows Services are controlled by the Service Control Manager that helps to start, stop or pause the windows service, as needed.

Windows services were previously known as NT Services as they were introduced as a part of Windows NT operating system. They are not available on Windows 9x and Windows Millennium Edition (Me). For using windows service, any of the operating systems in the NT generation, such as, Windows NT, Windows 2000 Professional, or Windows 2000 Server can be used. So, when Windows 2000 got introduced, the name of the NT Services was changed to Windows Services.

Examples of windows services include task scheduling, running message queues, file indexing, plug and play device detection etc.

In the source code, Windows Service extends the System.ServiceProcess.Service class. All Windows Services that are built in .NET need to extend this class. Visual studio includes the following methods by default, which are overridden by the service when it is created.

  •  Dispose - clean up any managed and unmanaged resources
  •  OnStart - control the service startup
  •  OnStop - control the service stoppage

How to create Windows Service?

  •  Select a new project from File menu.
  •  Expand “Visual Basic” tab and select “Windows”.
  •  Then select Windows Service in it and specify the name of the service.
  •  Then right click on the form and select Add Installer.
  •  Project Installer gets added.
  •  Select ServiceInstaller1, go to properties and set DisplayName, ServiceName and set StartType as Automatic.
  •  Then select ServiceProcessInstaller1 and set Account property as LocalSystem.

Originally posted 2011-10-17 11:41:02.

Posted in .NET | Tagged , , , | Leave a comment

Importance of website for online business

A good website has become an imperative for businesses today. In this tech savvy era website is the most effective medium for branding and marketing for any organization. I will discuss a few essential points for developing an effective website for your business.

Let us start with the essentials first, you will need the following:

1) Domain Name: Firstly, you need a domain name which means you need an address for your website. Your domain name can be the name of your business or the phrase which people know your business by.

2) Web Design: The next essential step is to hire a website design services company. Although there are various website building software available to help you build a website, outsourcing it will help you get a professional website which is very essential for developing a good brand name.

3) Web Hosting: You then need to choose a reliable web hosting provider for hosting your website. Web hosting is renting a space on the Internet that hosts your website. Web hosting companies provide you the required space on their server to host your website.

The following are some useful tips to build an effective website for your business:

- Define your target audience.

- Create relevant content which is both user friendly and search engine friendly. It should be interesting enough to hold the visitors interest and informative enough to answer their queries. It is a good practice to add a FAQ page and update it often as per users inputs.

- Create user friendly pages with easy navigation.

- You can also offer some free goodies to your website users like offer free e-books or special discounts to promote your business.

- Have your contact details or contact us widget on every page.

- You can also hire a search engine optimization expert that can bring your website in the top rankings in search engines like Google, Yahoo and Bing. A user friendly website with a good look and feel is an effective marketing tool for online businesses.

- Your website needs to be simple and unique.

- It should load fast.

- The website should reflect your business ethics.

- The technology used must meet your business needs.

- It is important to add a sitemap on your website.

- Most of the users are interested to know about you and your history so share it freely. Contact us, history page, clients testimonials adds credibility to your brand name.

- Add a contact page with online form, telephone number and real geographical address to make it easy for the users to communicate with you.

- You can send your clients’ online newsletters for regular communication.

- You can build a blog and forum link it with your website to communicate further and share knowledge with users.

- Add social media tabs on your website to enhance your online presence further.

These were just a few guidelines to kick start your online presence. Let’s get the ball rolling!

Originally posted 2011-10-14 14:00:43.

Posted in Tutorial | 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.

 

 

 

 

 

Originally posted 2011-08-16 12:17:40.

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

How to create Web Service in PHP

Web Services can convert your application into a platform independent Web-application. You can call web services using mobile applications (e.g iPhone, BB or android). The basic Web Services platform is XML & HTTP. To create web services you should know XML & HTML.

What are Web Services?
- Web services are application components
- Web services communicate using open protocols
- Web services are self-contained and self-describing
- Web services can be discovered using UDDI (Universal Description, Discovery and Integration)
- Web services can be used by other applications

Web services platform elements are as follows:
- SOAP (Simple Object Access Protocol)
- UDDI (Universal Description, Discovery and Integration)
- WSDL (Web Services Description Language)

Creating web service in PHP:

Using NuSoap library you can create web service in PHP.

Step1. WSDL configuration :

require_once(“nusoap.php”);
$ns=”http://192.168.1.1/nusoap”;
$server = new soap_server();
$server->configureWSDL(‘test’,$ns);
$server->wsdl->schemaTargetNamespace=$ns;

Step2. Register method :

$server->register(‘test’,array(‘amount’ => ‘xsd:string’),array(‘return’ => ‘xsd:string’),$ns);

Step3. Writing PHP function :

function test($amount) {
if($_SERVER['PHP_AUTH_USER']==”test” and $_SERVER['PHP_AUTH_PW']==”supp0rt”) // check for user &
passwd $msg = “valid user”;
else $err = “Invalid user”; // XML to return response
$strOP = “”; $strOP .= “”;
$strOP .= “”.htmlentities($err).”";
$strOP .= “”.htmlentities($msg).”";
$strOP .= “”.htmlentities($amount).”";
$strOP .= “”; // eof XML to return response return $strOP;// return response }

 

Step4. SOAP response :

// send the result as a SOAP response over HTTP if (!isset($HTTP_RAW_POST_DATA)) $HTTP_RAW_POST_DATA = file_get_contents( ‘php://input’ ); $server->service($HTTP_RAW_POST_DATA);

 

Originally posted 2011-08-15 12:57:23.

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

How to write content for your website to attract more users

To make your website unique and effective for search engine optimization, sufficient amount of time should be dedicated to write its content. If you take a look at any high traffic websites, you will notice that they have quality content on them that addresses to the need of the visitors.

The following are some important practices that can be adopted to attract more users to your website:

1) There are always exceptions to every rule, but you should have a minimum of 200 to 300 words per page. Less than these may result in less keyword density which is not good for your website, more than these will cause a long list of keywords which may attract irrelevant traffic to your website.

2) Always use appropriate images to support the text which helps to break the page and enables you to minimize the keywords in HTML by naming them to images.

3) Adding, updating or altering the website content regularly helps to increase the rank of your web pages. Alteration or addition of PDF or word documents can be used for this. Make constant efforts to incorporate only the best and unique content on your website.

4) Allow the users to add content on your pages. For example, offer them a chance to review your products and services or post on your forums. These practices help your website tremendously as search engines pay a visit every time they identify new content and reward your website with higher ranking.

5) To enable the individual pages to get a higher ranking in search engines, optimize each page with appropriate keywords and a title which makes it easier for search engines to search the page.

We need to work towards achieving targeted traffic to our website which means that the visitors of the website have found the relevant information they were looking for. There are many ways to generate traffic towards your website but without a rich quality content the visitors would leave the site rather than continue viewing other pages within the same site i.e. bounce rate would be high.

Originally posted 2011-06-14 13:27:51.

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