Archive for the 'Uncategorized' Category

11th Sep 2009

Efficient Usage Of FCKEditor

Table of Contents

  • Introduction
  • What is FCKEditor?
  • When Should We Use FCKEditor?
  • The features that attracts the user to use it
  • What are improvement needs in it?
  • Integrate FCKEditor    Step by Step
  • How to apply Themes
  • How to apply Language
  • Conclusion
  • Bibliography
  • References
  • History

Introduction

There are many editors available in the market. Each editor has its own features, benefits and drawbacks. FCKEditor is top one of them in Open Source category. In this article, I will explain some of good features.

What is FCKEditor?

FCKEditor   is HTML text editor brings to the web much of the power of desktop editors like MS Word. FCKEditor is powerful tool which provides the html editing, theme to suit your web interface, multiple language supports, selection of tools to be displayed as per requirement, image upload, flash file upload and many more. It’s lightweight and doesn’t require any kind of installation on the client computer.

The features that attracts the user to use it

  1. Open source
  2. User friendly and easy to integrate
  3. Toolbar selection facility
  4. Support of multiple language
  5. Support of skin to suite web page UI
  6. Light weight
  7. Image and flash file upload

The improvement which could be done

  1. Inbuilt facility to select theme at client side
  2. Inbuilt facility to select language at client side
  3. More font type and font size to improve user interface

Integrate FCKEditor Step by Step

  1. Download FCKEditor  source code from following link: http://sourceforge.net/projects/FCKEditor /files/FCKEditor /2.6.4.1/FCKEditor _2.6.4.1.zip/download
  2. Create new/ Open existing web project/ website 1.CreateWbsite
  3. Copy FCKEditor source code folder and paste it to website root directory. 2.Pastfckeditor
  4. Copy FCKEditor  FredCK.FCKEditor V2.dll file from source code and paste it to website Bin folder 3.DllPaste
  5. You have to register FCKEditor to use it in your page. There are two way to register it. Manual: Following script will register it.  You have add this script in every page you want to use FCKEditor. 4.PlaceFckeditorFrom Toolbar: : You can Otherwise, you can browse FCKEditor by right click on Toolbar >> Choose Items. A dialog box will appear as shown in following image. Select .Net Framework Components >> Click on Browse button located at right hand bottom. Choose the .dll of FCKEditor from the bin directory of your application. An item called FCKEditor will be added to your Toolbar. Now you are ready to drag and drop editor in your page. If you place editor in your page, it will also add same code in your web page as we have done in manual method. ChooseFckEditorfrom
  6. Run website, you can see the FCKEditor in your browser with default theme and default English language. 5.RunFCKEditor

How to apply Theme?

FCKEditor   having a great themeing feature. User can apply the theme in two ways. One way is dynamically and another statically. The site of FCKEditor provides 3 themes to be downloading. There are many third party open source themes available to download. I have shared few themes with this article.

[1]. Default Theme

DefaultTheme[2]. Office2003 Theme

Office2003Theme

[3]. Silver ThemeSiverTheme

Now, how can assign default theme and apply dynamic theme?

Answer is here:

First of all you can set default theme from fckconfig.js, look at below image:

1.setdefaultTheme

You can also set the language from .aspx /html /php page where you have declare FCKEditor  .

Just set the SkinPath Property.

2.applytheme

Now run the application you can view the office2003 theme in FCKEditor as you have set in above page.

3.ThemePreview

How to apply Language?

FCKEditor   provides a great multiple language support feature. User can able to change the language dynamically or set default language as per website language.

FCKEditor provides 56 languages that is you can use as per your requirement.

Now, how can assign default language or apply dynamic language?

Answer is here:

First of all you can set default language from fckconfig.js, look at below image:

1.configsetting

You can also set the language from .aspx /.html /.php page where you have declare FCKEditor.

Just set the DefaultLanguage Property.2.Setlanguage

Now run the application you can view the Arabic language in FCKEditor as you have set in above page.

3.LanguagePreview

Conclusion

FCKEditor   is very simple, easy to integrate and can be used in almost all the web application as html editor/ rich textbox editor.

Bibliography

FCKEditor

References

FCKEditor

History

4th September, 2009: initial post

  1. Run
  2. website, you can see the FCKEditor in your browser with default theme and default English language.

Posted by Posted by amit.shah under Filed under Uncategorized Comments 3 Comments »

01st Sep 2009

How To Create Mirror Partition In Linux System

This article shows how to configure raid 1 mirroring into your linux server

you must have two hard drive installed on your linux server with the same capacity

You can listed them using the following command

fdisk –l

This will display your currently installed hard drive on your linux server

/dev/hda/

/dev/hdb/

Then you have to create a logical partition on both hard drives with same capacity

Following command willl create a new partition on your linux server , for first hard drive (/dev/hda)

fdisk /dev/hda

This will ask for primary or extended partition

Type e for extended partition

Next will ask for cylinder size of your partition , don’t change anything

Next will ask for actual space for your extended partition

Type +10000M

Type w for write partition table

Now you have to create a logical partition using the following command

fdisk /dev/hda

N for new partition

L for logical partition

Just enter with the default configuration (cylinder size)

Type the size of your logical partition +5000m

Type w for write partition table

Remember by default when you create a new partition linux uses partition id number 82 .

You have to change this partition id fd for raid configuration with the following command

fdisk /dev/hda

Type l for change partition id

This will ask you which partition id would you like to change type your partition number

For example 5

Type fd for raid partition id

Type w for write partition table

You have to complete the same procces on second hard drive

Now you can start your raid 1 configuration using the following command

But before do this please check mdadm rpm package is installed or not

You can check this using rpm –q mdadm

You can also install this package using the following command

Type rpm –ivh mdadm

Now run the following command to create raid array

Type mdadm –create /dev/md0 –level=1 /dev/hda5 /dev/hdb5

This will create a raid partition on your linux server

You can see the details using the following command

Type mdadm –detail /dev/md0

Now you have to format this partition to use them

Type mkfs –t ext3 /dev/md0

This will write ext3 file system on your raid partition

Then you have to mount this raid partition on some directory using

Type mount /dev/md0 /raid1

If one of the hard drive faild on raid 1 type the following command to remove them from raid1

Type mdadm /dev/md0 –f /dev/hda5 (to fail your harddrive in raid1 )

Type mdadm /dev/md0 –r /dev/hda5 ( to remove your hard drive from raid1 )

Now you can join a new hard drive create logical partition with same capacity & join into you raid1 partition using the following command

Type mdadm /dev/md0 –a /dev/hdc5


You can see raid1 will syncs the data with the new hard drive using

Type mdadm –detail /dev/md0

Posted by Posted by bhumish.shah under Filed under Uncategorized Comments No Comments »

13th Aug 2009

How to perform stress testing in QTP

1. Record the script which you want to perform for stress testing.

For Example:  if you want to add 1000 records then just record add functionality  script.

2. Now just add a loop for that script which contains add record functionality. See below example

For i=0 to 1000

Put your add record script code here. It will repeat the add record loop till 1000 entries will be done.You can insert  1000 records using For.. Next loop.You can also insert more than 1000 or more.Just change your for loop condition for that.

Next will increase your loop counter

Next

Below code is a full example of the stress testing:

For i=0 to 1000

Below code will insert first name jigar. For unique name you can pass value of  i so it will insert unique name each time.

Browser(”PMS”).Page(”PMS_3″).WebEdit(”txt_Name”).Set “Jigar” & i

Below code will enter address in the address field.

Browser(”PMS”).Page(”PMS_3″).WebEdit(”txt_Address”).Set “Surat”

Below code will enter mobile number  in the mobile number field.

Browser(”PMS”).Page(”PMS_3″).WebEdit(”txt_No”).Set “9992426690″

Below is code to save the details

Browser(”PMS”).Page(”PMS_3″).Link(”btn_save”).Click

Next

This is a script to add 1000 records.

Posted by Posted by mehul.brahmbhatt under Filed under Uncategorized Comments No Comments »

21st Jul 2009

Database Connection in QTP

How to connect database with application running in QTP to check data in DB dynamically?

An example is shown connecting QTP with SQL Server

A simple script is shown below with necessary comments :

Dim con,rs,column_count,column_name,i,column_value

Set con=createobject(”adodb.connection”) // Its a connection object
Set rs=createobject(”adodb.recordset”) // A record set should be defined

// Necessary connection string should be their
con.open “provider=sqloledb.1;server=.\SQLEXPRESS;database=DBNAME;user id=XYZ;password=XYZ”

// Finally the record set is defined to fetch the value of particular fields according to the query passed.

rs.open”select * from tbl_newsMaster where username=’admin’”

// Checks the record set till the end until any record is found.If any record is found then it stores the values in “rs” record set.
Do while not rs.eof
For i = 0 To rs.Fields.Count -1
‘ msgbox rs.Fields.Count //counts the number of records in record set “rs”
column_value=rs.Fields(i).value //Fetches the value of particular field stored in record set “rs”
column_name=rs.Fields(i).name
Msgbox “Record Exist :” & column_name&” ” &column_value
next
rs.movenext
Loop

Posted by Posted by jigar.parvatia under Filed under Uncategorized Comments No Comments »

13th Jul 2009

How to Install Spell Checker and Definition lookup in Firefox

How to Enable/Install Spell Checker in Firefox:

(1) Go to https://addons.mozilla.org/en-US/firefox/addon/3497

(2) Browse through the page and click add to Firefox.

(3) Software installation Dialog box will appear and click install.

(4) After installation completed, click restart Firefox.

In order to enable/disable spell check Right Click on the composing area and click spell checking to enable or disable it.
How to lookup for Definition:

(1) Go to https://addons.mozilla.org/en-US/firefox/addon/2083

(2) Browse through the page and click add to Firefox.

(3) Software installation Dialog box will appear and click install.

(4) After installation completed, click restart Firefox.

While composing select the word, right click on it and select “Inline Definitions” From popup menu. You will see the meaning of word.

Posted by Posted by gaurang.tripathi under Filed under Uncategorized Comments No Comments »

27th Jun 2009

Watch albums of strangers on Facebook!

Facebook has always been touted to have strong privacy controls.  To most extent it is true and it is much better than most of the other social networks. But as a biggest social network they do have loopholes which can be easily exploitable by atleast developers like us.

Today I am going to talk about one such exploit:

How to view albums of people who are not your friends?

So when we search for interesting people on Facebook most of the time you will find their profile having restrictions. Mostly you will be able to see their profile photo and will be able to send message to them. So to see their full profile or albums we have to send “add friend” request and if they approve then and then only we can see their photos and profile.

But here is one way to bypass this:

First you have to add developers application in Facebook which can be added from following link:

Link:  http://www.facebook.com/developers/?ref=sb

Then go to this link

http://developers.facebook.com/tools.php

It will open below page and choose you response formate and also method = photos.getalbum as shown in below image.

facebook1

So after that enter facebook user id whose photos you want to see, in “uid text box” as shown in below image and then press “call method button”.

Get the facebook id from the address bar/url bar or find the “add as a friend” link in the web page and move your mouse cursor over it and you will get facebook id in the status bar as shown in image.

facebook3

And you will get details of all the albums of that user if he or she have albums as shown in below image in right side box.

Just you have to copy link content from right box and paste it to another browser or tab and press enter and then you can see all photos from that album without adding the user as a friend.

facebook2

Note: I have changed all the ids they are not real.

I hope with the help of this article and community, facebook will notice this bug and will resolve it.

So enjoy peeking on stranger’s albums. :)

Update: It seems that Facebook has resolved this bug now.

http://www.facebook.com/developers/?ref=sb

Posted by Posted by divyang.shah under Filed under Code, Security, Uncategorized Comments 7 Comments »

27th Jun 2009

Customized Radio button & Check Box

Here is the customized design that would give a new look to your radio buttons & check boxes.
You can use different images you show the checked/unchecked check boxes & selected/unselected radio buttons.

Here is how your customized Check box & Radio buttons will look.

customized checkbox

customized checkbox

customized radio button

customized radio button

View Demo

You can change the images (the css has the image paths) to give that different look to your radio button & check box elements.

Browser Compatibility: Script is compatible & checked in Firefox, IE 6 7 & 8, Safari 2.0, Opera 9.0 & above & Google Chrome.

Click to download the .zip file with the script, css, html page & images; to give that much needed customized look to your form elements.

Script reference taken from: www.flog.co.nz

Posted by Posted by Supriya Agnihotri Jagani under Filed under Uncategorized Comments No Comments »

15th Jun 2009

Introduction to .Net Remoting

This Article is just an introduction to .Net Remoting. We will see in which situation .Net Remoting is useful and technical view of .Net Remoting.

What is .Net Remoting?

In General, Remoting is communication between two application domains. One application domain can communicate with other application domain with help of some kind of medium. This is how .Net Remoting works.

Now let’s see how .Net Remoting is useful in our real life scenario.

Suppose there is one company name ‘ABC‘.

It main office is in Ahmedabad city location. And there are some branches are in Ahmedabad city only but in different areas. And Outside Branches also there may be in different cities like Surat, Baroda, and Mumbai etc.Now all the branches are connected with main office and all the transaction done through main office only. So all the branches in all the places should connect with main office and communicate their data also.

So in this kind of situation .Net Remoting is very useful technology.

.Net Remoting works on three tier Application.

1.    Client
2.    Interface
3.    Server

In this Client side, generally UI is there where user can directly interact with the application. They put some input and get some output in any format like reports, graphical or any.

And in Server side all the business logic is there. If user input some data then all the transaction is done in server side. And last one is interface. Interface is medium to connect server and client. So many clients are connected with one server only through interface.

For example,
In above situation of ‘ABC’ company.

Server application is installed in Ahmedabad main office only and all other branches clients are installed. So all clients are connected with server means Ahmedabad main office. In main office there is main server is there and database is also there.

So when one client application sent some request through interface then that will come into the main server machine and then if they want to some data from data base then go to database and get it back to server application and back data to the client. If data is huge then data base server is installed in different machine other than different machine where server application is installed so transaction gets very fast.

Now we understand how .Net Remoting works internally.

DCOM is replace by .Net Remoting. By using .Net remoting, we can make remote object calls which lies in different application domain.

What is Application Domain?

Before we start to understand .Net Remoting, we just go through what is Application Domain?

Generally process used their owned security boundaries. In the Process there are number of application can run and one process has its own virtual memory and does not effect or overlap to other processes virtual machines. So one process can’t crash with other process. So same thing this concept used in .Net and more over ahead of this, concept of Application Domain are used. In Application Domain, Multiple Application can run in same process without influencing each other.  In that, if one application domain throws errors it does not affect or stop whole process and not effect with other application domain. To invoke method in an object running application domain .Net Remoting is used.

General Concept of .Net Remoting and its Architecture

Remoting has at least three sections:
•    Interface
•    Client
•    Server

in .NET Remoting, the client does not call the methods directly. A proxy object is used to raise methods on the remote object. All the public methods that are defined in the remote object class are also available to be called from clients.

This method of calls is called Message. These messages are serialized using formatters and then send message through channel from client. Thus Client channel communicate server channel and there server channel receive message and de serialised through server formatter and sent to the server remote objects.Generally .Net Remoting can be used across any protocols.

Any objects are created outside to the boundaries of Application Domain then it is called remote object to the AppDomain.  These remote objects can access by references or by value.

What is marshalling and different kind of Marshall?

Marshalling is used when object are converted. So these objects can travel throughout the network by channel and formatter.
There are two types of marshalling in the .net remoting.

•    Marshall-By-Ref
•    Marshall-By-Values

In the MBR, create proxy to communicate with other side of the network or remote object and create ObjRef instance that itself serialized.

ObjRef Returns by all Marshall () methods and it contains location of remote object, Hostname, Port Number and Object name etc.

For example:

MarshalByRefObject obj  =(MarshalByRefObject)RemotingServices.Connect(typeof(Ilogin), “tcp://LOCALHOST:65101/ITestEndPoint”);

// Set a reference to the service. After this, you use testRemoteReference
// just as if it was a local instance of ITestImplementation.

loginreference = obj as Ilogin;

Whereas in MBVs objects, Copy of the object is created on the other side (i.e. server side). The object to marshal is stored in to a stream, and a stream is used to crate copy of the object.

So Marshalling is a process of packing object and a call and its arguments made by an AppDomain on a remote object into a unit that’s easily transferable across the network. In other we can say that Marshalling is process to transfer message from one place to other means its destination. Once marshal reached its destination, an unserialized process is taken place and returns its original data by this.

Difference between MBV and MBR

MBVs is that they get serialized with all the private and public data members. But that may be cause problem if a client intercepts the serialization/de-serialization phase to harm application.
While MBRs, only clients decide which objects can travel across there network. He doesn’t have to load entire copy of the object if he wants to call some functions or some procedures only. And MVB execute in its original native places only where it governed by CLR. So Application May misbehaviour in some cases but that is happened vary rarely.

In .Net Remoting there are two ways to create remote objects.

Server activated objects (SAO)
Client activated objects (CAO)

SAO has two modes named ‘Single call’ and ‘Singleton’.

Single call is an object that object created with every method all or server trip. So all these objects are stateless. And after use of that object it is destroyed and every time creates new objects. Single Call objects are useful in scenarios where the objects are required to do a finite amount of work.

While in other side, in Singleton the object is created only once and the object is shared with all clients. So this kind of objects is used for share object through out the application. So singleton objects are useful in many applications like chat application etc.

CAO is not stateless compare to SAO. Client holds proxy to the server object on the client side which is created on server object on server side.

Example of Single call and Singleton:

Singleton:

// Register the interface and end point.
//
// Each service has a unique endpoint and this endpoint is how a client
// accesses a specific service on a remote server.

Type ilogin = Type.GetType(”login”);
RemotingConfiguration.RegisterWellKnownServiceType
(ilogin,”IloginEndpoint”,WellKnownObjectMode.Singleton);

Singlecall:

// Register the interface and end point.
//
// Each service has a unique endpoint and this endpoint is how a client
// accesses a specific service on a remote server.

Type ilogin = Type.GetType(”login”);
RemotingConfiguration.RegisterWellKnownServiceType
(ilogin,”IloginEndpoint”,WellKnownObjectMode.SingleCall);

In next article we will see more about .Net Remoting like Channels and Formatters, Object Activation and Lifetime and simple example of .Net Remoting .

Posted by Posted by Brijesh Patel under Filed under Uncategorized Comments 2 Comments »

10th Jun 2009

SQL SERVER – DECLARE Multiple Variables in One Statement

SQL Server is great product and it has many feature which are very unique to SQL Server. Regarding feature of SQL Server where multiple variable can be declared in one statement, it is absolutely possible to do.

Method 1: Multiple statements for declaring multiple variables

DECLARE @Var1 INT
DECLARE
@Var2 INT
SET
@Var1 = 1
SET @Var2 = 2
SELECT @Var1 'Var1', @Var2 'Var2'
GO

Method 2: Single statements for declaring multiple variables

DECLARE @Var1 INT, @Var2 INT
SET
@Var1 = 1
SET @Var2 = 2
SELECT @Var1 'Var1', @Var2 'Var2'
GO

From above example it is clear that multiple variables can be declared in one statement. In SQL Server 2008 when variables are declared they can be assigned values as well.

Reference : Pinal Dave (http://www.SQLAuthority.com)

Posted by Posted by pinaldave under Filed under Uncategorized Comments No Comments »

05th Jun 2009

Top 25 Most Dangerous Programming Errors

1     Improper Input Validation
2     Improper Encoding or Escaping of Output
3     Failure to Preserve SQL Query Structure (’SQL Injection’)
4     Failure to Preserve Web Page Structure (’Cross-site Scripting’)
5     Failure to Preserve OS Command Structure (’OS Command Injection’)
6     Clear text Transmission of Sensitive Information
7     Cross-Site Request Forgery (CSRF)
8     Race Condition
9     Error Message Information Leak
10   Failure to Constrain Operations within the Bounds of a Memory Buffer
11   External Control of Critical State Data
12   External Control of File Name or Path
13   Untrusted Search Path
14   Failure to Control Generation of Code (’Code Injection’)
15   Download of Code Without Integrity Check
16   Improper Resource Shutdown or Release
17   Improper Initialization
18   Incorrect Calculation
19   Improper Access Control (Authorization)
20   Use of a Broken or Risky Cryptographic Algorithm
21   Hard-Coded Password
22   Incorrect Permission Assignment for Critical Resource
23   Use of Insufficiently Random Values
24   Execution with Unnecessary Privileges
25   Client-Side Enforcement of Server-Side Security

If you want to go through with example then please Refer below link:

http://www.softwaretestinghelp.com/top-25-common-programming-bugs-every-tester-should-know/#more-353

Posted by Posted by hardik.gohil under Filed under Uncategorized Comments No Comments »