Object writer utility

I generally try to make my application/code  to be run from Command line. There  its nice to print the object value also. (From test case you see pass or fail Sad smile  only )

 

So here is my utility here and you are free to enhance it. I have create a Object Writer util for print my object  .

image

 

 

Object Writer :

image

 

Output:

image

 

 

Hope this will help someone. You can also down load code files from here :

https://skydrive.live.com/embed?cid=1F188D9EA75A6E2B&resid=1F188D9EA75A6E2B%21416&authkey=ALKQRzGPEmFUYkc

Use Internet Explorer within Google Chrome

I am a big fan of Google chrome .

I have found a very interesting ‘web tool’ ‘ie Tab’. Now I can run internet explorer within my Chrome !!

Please see the details If you want to try this …

1. My Google chrome Details

2. Get a the web tool from here

https://chrome.google.com/webstore/detail/miedgcmlgpmdagojnnbemlkgidepfjfi?hl=en-US

3.After installation you will get an icon on your Google Chrome

4. Now yu ar e ready to roll . Click on this icon and you get another Address Bar … (FOR IE)

Pretty Cool Isn’t it !!!

Automate SQL Server operations by batch file

Many times we need to perform many repetitive actions on our sql server . Many of those are literaaly repetitve or many of them we really do not do every day but whenever it is , it a collection of steps .

Today we will see how easily we can automate our repetitive work by batch file so that we always donot have to open SQL Server Management Studio and conect to our DB etc….

 

You can also have a look how to create a log file from batch file in my previous post

Create a batch file :

1. Open your favourite text edidor and write below lines :

 @echo off
SET SERVER=YOURSERVERNAME
SET DB=YOURDATABSENAME

SET Logfile=runscripts.log
SET InvokeSQL=sqlcmd -S %SERVER% -d %DB%  -E -b -i
echo %DATE% %TIME% %USERNAME% > %Logfile%
echo calling sql-scripts with: %InvokeSQL% %%scriptfile%% >> %Logfile%
echo. >> %Logfile%
REM START trace32.exe %Logfile%
echo.
CALL :RUNProgram 001.sql || GOTO :FAILED
CALL :RUNProgram 002.sql || GOTO :FAILED
echo no errors found – logfile = %Logfile%
GOTO :EOF
:RUNProgram
echo running %1%
echo.>> %Logfile%
echo ===================   running %1%     %     %TIME%  =======================%  %>> %Logfile%
%InvokeSQL% %1% %>> %Logfile% 2>&1
GOTO :EOF
:FAILED
echo errors found – logfile = %Logfile%

2. Save file as batch file “myFirstSQLBatch.cmd”

3. Run it !!!!

Thats it !!!

How to create log file from batch files

Many times we can do our tasks in batch mode. I personally like this approach and I use it alot in
my daily office work. In this post we will learn a very simple but very usefull trick to make our
batch files more usefull.

Scenario:
I have 3 batch files which have some operation in them (anything)
file1.cmd
file2.cmd
file3.cmd

I want to execute these batch files in one go and want to create a log file for actions happened inside the batch file.

Solution

1. Open ‘Notepad’ and create a new file. save this file as “Main,cmd” (you can choose nay name you like )
2. Create a variable which contains our Logfile name.
3. Copy an d paste below mntioned lines in this file and save it .

@echo off
 REM Create a logfile name variable
 SET LOGFILE=myLOG.LOG
 ECHO This is first log line >> %LOGFILE%
 ECHO Calling first file ‘file1.cmd’ >> %LOGFILE%
 REM file1.cmd >> %LOGFILE%
 ECHO Calling file ‘file2.cmd’ >> %LOGFILE%
 REM file2.cmd >> %LOGFILE%
 ECHO Calling file ‘file3.cmd’ >> %LOGFILE%
 REM file3.cmd >> %LOGFILE%
 ECHO Task completed >> %LOGFILE%
ECHO. >> %LOGFILE%

4. Run this file by double click on it .
Voilaa now you have new log file.

Note : If you have “Trace32” log viewer you can directly lauch it loaded with your log file
i.e.

START trace32.exe %LOGFILE%