SQL Command to copy the result to a file

Being more Concerned about the queries and saving their results in sql i found out a way to save the results directly into a file through the command in desired format.

Here it goes:

mysql> select emp_id,emp_name from emps

into outfile ‘c:/test.txt’;

This simply produces the file without any fuss,each column output as in the table.

We can also manipulate the file by simply formatting the output of the sql,so if we wanted to output each column in the table with a comma delimeter we would have to concatenate the values together in the SQL to produce the required result.In mysql there are number of options we can use with INTO OUTFILE to change the  way data is written to the file.These are FIELDS ESCAPED BY,FIELDS ENCLOSED BY,FIELDS TERMINATED BY.So if we wanted our output to be enclosed in double quotes,with comma delimiters and a new line termination for eac row we would use.

Select emp_id,emp_name

INTO OUTFILE  ‘c:/result.text’

FIELDS TERMINATED BY ‘,’   ENCLOSED BY  ‘  ”  ‘

LINES TERMINATED BY  ‘ \n ‘

FROM emps;

That is it.....
Hope it Helps :)

Leave a Comment

Linux grep Command

I already listed few find commands in my previous post but i found they are of not much use when i want to search for a particular string/Word in a Directory.

Was really in need of such a command at ma workplace and then i encountered this  simple comamnd to do this after some browsing…And as Usual i am here to share this with you..

grep -r “String” /filepath…This would search the word in the specified path ex: “c/users/bin”

OR

grep -r “String” *..this would search in all directories

String here is the specific word with which you want to search with

FilePath is the directory where you want the command  to search the specified word.

Hope It helps…:) 🙂

Wud luv to hear comments….

Leave a Comment

Linux Find Commands

I Use Linux at my work and as i am new to it, i was trying to exlore different commands which make my work easy.Lately i was to find one files location and in that process came across few find commands which might be useful to u all:

Listing them below,Check out!!!!!

find / -name  file …this command searches thru the root directory for the file named ‘file’ and prints the location.

find . -name file …..this command would also list all the files named ‘file’ but in the current directory

find /root/home  -name file ….this command would search for the file named ‘file’ through the /root and /file directories.

find /root/file -name “file*” …….this command would search in the root/file directory for all the file names that starts with the word  file  and lists them

find /root/file -name “*.txt” ……this would list all the text files(files with extension txt) present in the location /root/file

find . -mtime -1 …….to find all the files that were modified within the last 1 hour.

find / -size +2000 ……command to find a file sof particular size,in this case it will return all the files of size greater than 2KB.

find /home -user jonde ……find every file under the directory home owned by the user jonde

find . -size 1000c …….find files with exactly 1000 characters

find . -size +599c  -and -size -701c ………find the files containg between 600 to 700 characters inclusive

find . empty ……..will list all the empty files

That’s it guys, these are the basic find commands will update the post if i find any………

Any new areas in this are welcome in the form of posts and suggestions.

Happy linuxing…[:)]

Leave a Comment

Fiddler

Usually Web tests are recorded using Web Test Recorder in Visual Studio,but some requests might not be recorded by the Web Test Recorder like AJAX requests(as discussed earlier in my previous post) and some pop-up windows.

So In this case Fiddler tool turns out to be one of the Option.

Before proceeding with how to use Fiddler, first download the Fiddler from the following link http://www.fiddler2.com/Fiddler2/version.asp

There are 2 ways in which we can Use the Fiddler recorded requests.They are:
(i)Recording the Webtests using Fiddler and integrating with VS.

(1)Go To start->All Programs->Click on Fiddler Icon(which appears after you download).

fiddler1

(2)Now open the Internet Explorer sideways and enter the URL for which you want to run the web test in address bar.

(3)Web Requests for each and every action performed in the browser are recorded simultaneously in the Fiddler as shown below.

fiddler2

(4)When you think you are done with the recording close the fiddler and  the browser.

 (5)Now Fiddler consists of all the HTTP Requests required and they should be integrated with Visual studio for furthur action.

(6)For that select all the required requests,right click->save ->sessions as->Visual studio web test as shown below.

fiddler3

(7)Give a valid name like ‘Test’  to the File  and save it in your computer at any location preffered.

fiddler4

(8)Now we have our Recorded test saved in the computer and it has to be integrated with the visual studio so that we can run the test.Now,open Visual Studio right click on the test project->Add->Existing Item.

fiddler5

 

(9)In the Add Existing Item Box that appears Search for the file you saved earlier (Test) and click on Add.

(7)That’s it !!!! Test Project now consists of the WebTest named ‘Test’ which was recorded using fiddler.Now you can Run the Test, View the Results and do modifications etc…  🙂

(ii)Manually Adding the Missing Web Requests:

Another option is to record the Web test using Fiddler and the Web test recorder simultaneously.This allows you to compare the two recordings to discover missing requests which you need to add to the Web test manually. This method is best when a small number of requests are missed by the Web Test Recorder since you can still benefit from features such as automatic hidden field tracking and filtering of dependent requests.

 

Hope It Helps!!!!!

Happy Testing 🙂

Comments (2)

Testing Ajax Web Application

Recording and Running the Webtest in Visual Studio seems easy now..(You can see creating the webtest in my previous posts).
It’s well and good if webtest doesn’t fail but what if webtest fails????
There are many reasons why the webtest fails but the most common one (or  i can say which i encountered frequently) is webtest containing the ajax controls or postback functionality fails.
             

The Reason being is that the Web test engine works at the HTTP layer, it does not directly simulate client-side scripting like JavaScript or ActiveX controls. Web tests are concerned with generating load on a server. As a result, client-side scripting that only affects the appearance of a Web page is not significant to the Web test. Client-side scripting that sets parameter values or results in additional HTTP requests (such as AJAX) does affect the load on the server and might require you to manually modify the Web test to simulate the scripting.
That means we need to modify some of the parameters in the webtest to make it to run properly.

How do We Do it??? Here goes the solution and it did work for me….

So i wanted to share this with u all hoping that it may help you. 🙂

So,Just open the window consisting of webtest in Visual Studio,expand the links(involving ajax) and there you can find the folder named Extraction Rules which has Extract Hidden Fields option.(This is where the problem lies).
If u r using Visual Studio 2008 Right Click and select Properties as shown below.

a

This Opens up a Properties window.In that Required field would be true by default.Change this Value to false.

b

 

Do this for all the Hidden files present in the web test.
But it’s the different case when  u r using vs 2005 as there is no Required option then just right click the Extract Hidden Files option and Delete the Extract Hidden Fields as shown.

c

 

That’s it! u r Done!!!! Now just Rerun the webtest after saving the changes made.Now your  Webtest should run properly without any errors.

Also we can use “Fiddler” tool  for this kind of webtests.Go through these links to know more about “Fiddler”.

http://www.fiddlertool.com/Fiddler/help/WebTest.asp

http://blogs.msdn.com/edglas/archive/2007/06/13/fiddler-2-drop-available-at-www-fiddler2-com.aspx

Hope this is useful!!!

Comments are most welcome 🙂

Comments (3)

Creating a WebTest

Last few days I was working on Load testing and in that process i came across creating a WebTest to continue with the Load Testing.

I thought I would blog on this, so that it might help the beginners in creating the  Web Test easily. Here goes the step by step procedure of creating the webtest.

(i)First Step is Creating A New Test Project.
Open Visual Studio,Go To File->New->Project,Then a New Project Dialog Box Opens.
There Expand the Visual c# node and select Test,accept the default name TestProject1 and then click OK.

1

(ii)Now having successfully created our testproject we will proceed with creating a web test.

Steps for creating the Web Test.

(1) In Solution Explorer,right click the TestProject1,Select Add and then Select Web Test.

2

(2)Web test gets added up under the Test Project and A browser Window Pops Up as shown below where u can enter the Url for which you want to run the web test.

2b

(3)In the Address Bar replace the about:blank with the url and press the Enter Key on the Keyboard.

(4)Now the user inputs are recorded and they are stored in the web test which u can playback later.After U added all the data that u want to test Click “Stop” button to Stop recording and return to the project.

(5)That’s It your webtest now contains a list of recorded actions as shown below.

3

Now having recorded the webtest next step is to run (playback) the test.

–>VS 2005 provides a Run button in the toolbar(first button with a green arrow) for this purpose.

4

–>Clicking on the Run Test will replay the test and the Test Results window will show whether or not the test was successful.If You cannot see the Test Results window,on the Test menu,select Windows,and then select Test Results.

5

That’s it guys!!!!

You are done with creating the webtest successfully.After creating this webtest you can proceed with the load test or what so ever.

Hope it helps!!!!!:) 🙂

Happy Testing 🙂

Ur Comments are valuable.

Leave a Comment

KeyBoard Shortcuts

Searching for the mouse everytime u open and close the window and also for each and every option makes the life difficult for techie guys.Most of the Times we feel lazy performing all the operations wid mouse and loty of time is wasted on it.Instead we can use the keyboard shortcuts which are convenient and easy to use.So Here iam listing almost all the firefox keyboard shorcuts that wud make our life easier.

Alt + D / Ctrl + L- Allows you to directly jump into the location bar(address bar).

ALT + Enter-Opens the address of the website u are viewing in the new tab.

CTRL + R -Reloads the page.

ESC-Stops loading the page.

F11-Full screen mode.Pressing it once will open up the full screen mode and press it again to return back to the normal mode.

Tab-This will help to navigate through all the links in the page u are viewing and hitting the enter will open up that link.

CTRL + T-Opens a new tab.

CTRL + Tab-Selects the next tab. Suppose you have opened up about five tabs to research a couple of different issues, you may need to navigate back and forth between the tabs. This shortcut allows you to move to the next tab to the right. However, you can actually navigate left and right by using CTRL + PG UP and CTRL + PG DN, respectively. Even better, you can CTRL + (1 to 8) to select a specific tab (as long as you have no more than 8 tabs open) sinceCTRL + 9 takes you directly to the last tab on the right.

ALT + Left Arrow / ALT + Right Arrow-Equivalent to clicking on the Back and Forward buttons to navigate within a website.

CTRL + D-Booknarks the current page u are viewing.

ALT + Home-This Takes u back to the Homepage i.e the page that opens when u first launch the Firefox.

CTRL + W-Closes the Current Tab.

CTRL + Shift + T-Suppose u have closed a wrong Tab by mistake!Don’t worry this tab helps u to Undo the closing of a tab.

CTRL + Shift + DEL-Clears the Private Data and keeps the cache and cookies clean.

ALT + F4-This shortcut closes the window i.e entire firefox session.

Ctrl++-Zoom in the page.

Ctrl—Zoom Out the page

Ctrl+0-Reset the page

‘-Helps u to find the specified links in the page.

/-Helps to find the specified text in the page.Can be an alternative to the Ctrl+F

Ctrl+K/CtrlCmd+E-Allows u to do the web search.

Ctrl +Home-Move Tab to beginning when Tab is focussed.

Ctrl+End-Move Tab to the End when Tab is focussed.

CtrlCmd+Shift+D-This Allows u to Bookmark all the Tabs.

CtrlCmd+J-Allows to view all the Downloads

CtrlCmd+H-History

Ctrl+Enter-adds http://www. and .com at the beginning and end of a word. i.e if we give myspace in the addressbar and press this it will fill the adress for u i.e the adress now will be http://www.myspace.com/ saving ur time in typing the whole address.

Shift+Enter-This shortcut completes the .net address.

Ctrl+Shift+Enter-This shortcut completes the .org address.

Ctrl+Shift+I-Opens up the DOM Inspector.

F7-Caret Browsing

F3-Find Again.

Guys these are the shortcuts which shd be helpful to u and shd be an good option for ur
laziness 🙂
So keep ur mouse a side and increase ur firefox productivity with these keyboard shorcuts.

Hope,i covered all the shorcuts.Am i missing anything????If yes then do temee.Will post some if i find any, till then

Happy Browsing!!!!!:)

Leave a Comment

Older Posts »