|
December 4, 2007
Posted on December 04, 07 @ 10:02 am under Diary and has no comments.
After a long time, I am free from projects now. I got some time to learn new things. I am planning to take up PHP as my career. But I think i need to learn other things too, especially Java. By the way, Chiranjeevi is going to enter politics. Telugu cinema actress, Rasi's husband is directing a telugu film, Maharajasri. Etcetra things are happening all over. 
Error logging in SQL Server
Posted on December 04, 07 @ 04:27 am under Databases and has no comments.
Error Logging in SQL Server procedures
SQL server offers a programming base, called Stored Procedures, where in you can execute a sequence. But some times, there will be errors when executing statements in bulk. So we need to track those errors too.
Error logging involves 3 steps:
- Creating a table to log errors (one time activity)
- Creating a seperate procedure to log necessary information
- Using that procedure, at appropriate stages, by passing necessary parameters
———————————
Creating a table to log errors
——————————–
Let us first figure out the data we needed to track errors. We need to know the name of the Procedure; in that, the sql statement which gave the error; the error code; the message related to the error code; and time at which the error occured. So our database table can be
CREATE TABLE [Error_Log](
[Record] [bigint] IDENTITY(1,1) NOT NULL, –for serial numbers
[Error_Object] [varchar](50), –the name of the stored procedure
[Execution_Pointer] [varchar](100) NULL, –the stage at which the error occured
[Error_Code] [int] NULL, — the error code generated
[Error_Message] [varchar](1000), –the message of the error
[Error_DateTime] [datetime] NULL, –the moment the error occured
CONSTRAINT [PK_Error_Log] PRIMARY KEY CLUSTERED ( [Record] ASC ) ON [PRIMARY]
) ON [PRIMARY]
Execution_Pointer is a marker used after sql statements. Tracking this will help the programmers to trace the sql statements. We will see the implementation shortly.
—————————————————-
Creating a seperate procudure to log necessary information
—————————————————-
Now we need to write a generic procedure to log errors.
create procedure ksp_log_error
@p_procedure_name varchar(50),
@p_pointer varchar(100),
@p_error_code bigint
as
begin
declare
@v_error_message varchar(1000)
–know the error message from sysmessages table
select @v_error_message=description from master..sysmessages
where error= @p_error_code
–if no message exists, use error code
if @v_error_message is null
set @v_error_message=@p_error_code
–insert into table
insert into Error_Log(Error_Object, Execution_pointer, Error_Code, Error_message, Error_Datetime)
values(@p_procedure_name, @p_pointer, @p_error_code, @v_error_message, getdate())
end
————————–
Using the above procedure
————————–
Finally the procedure should be called. For this, I will give you an example. Suppose, we need to register a user into the database. For this we will use transactions and @@ERROR variable. Transactions are useful, especially when dealing with data. @@ERROR has the last occured error number. Using these two I will construct a procedure. I have written the comments where ever necessary.
create procedure register_user
@p_user_id varchar(50),
@p_password varchar(50),
@p_name varchar(100),
@p_email_id varchar(150)
as
begin
declare
@v_count int,
@v_proc_name varchar(50),
@v_pointer varchar(50),
–set primary variables
set @v_proc_name=’register_user’ –name of this procedure
–check if the user is already registered. This is useful to avoid primary key conflicts while inserting
select @v_count=count(*) from Users where User_ID=@p_user_id
–if the user is already registered, stop proceeding
if(@v_count<>0)
begin
select ‘User already registered’ as [Error]
return –stop the execution
end
–if the user is not registered, register him/her.
begin tran
–issue the insert statement
insert into Users values(@p_user_id, @p_password, @p_name, @p_email_id)
set @v_pointer=’insert statement -1′
–check if there is some error
if(@@ERROR<>0)
begin
rollback tran
–call the error logging procedure and pass parameters
exec ksp_log_error @v_proc_name, @v_pointer, @@ERROR
–stop
return
end
–if ok, commit tran
commit tran
–send back the message
select ‘User added successfully’ as [Message]
end
As a programmers perspective, I think this explanation would be enough for another programmer to understand. If you are a beginner, I strongly recommend searching information further till you understand.
If you want to know about Error Logging futher, go to http://www.sommarskog.se/error-handling-I.html

WeddingQuery -SQL Style
Posted on November 30, 07 @ 02:31 am under Jokes and has no comments.
CREATE PROCEDURE MyMarriage
BrideGroom Male (25) ,
Bride Female(20) AS
BEGIN
SELECT Bride FROM india_ Brides
WHERE FatherInLaw = 'Millionaire' AND Count(Car) > 20 AND HouseStatus ='ThreeStoreyed'
AND BrideEduStatus IN (B.TECH ,BE ,Degree ,MCA ,MiBA) AND Having Brothers= Null AND Sisters =Null
SELECT Gold ,Cash,Car,BankBalance FROM FatherInLaw
UPDATE MyBankAccout SET MyBal = MyBal + FatherInLawBal
UPDATE MyLocker SET MyLockerContents = MyLockerContents + FatherInLawGold
INSERT INTO MyCarShed VALUES ('BMW')
END
GO
Then the wife writes the below query:
.
.
.
.
.
.
.
.
.
.
DROP HUSBAND;
Commit; 
November 25, 07
Posted on November 25, 07 @ 08:22 am under Diary and has no comments.
Ubuntu linux is rocking on my system. I feel that Ubuntu will become the ultimate choice for desktop, due to its simple to use synaptic package manager, easily configurable applications.. etc.. etc. I can play MP3s, MPEGs easily. I am feeling relaxed to work in linux now. Apache, PHP, MySQL, Komposer all work smoothly. Really, I recommend ubuntu on your systems too. My thanks to ubuntu people for developing linux for my desktop. 
Upcoming Telugu top 50 Block Busters....
Posted on November 22, 07 @ 03:48 am under Jokes and has no comments.
Upcoming Telugu Block Busters
1) IT Rajyam!!
2) Job ochina kothalo....!
3) A Company aithe naakenti..!?,
4) Job vachindhi kaani.....!
5) Fire aina Mogudu - Job vachhina pellam
6) Priyudu nerpina PASCAL,
7) Pellam PM aithe!!?,
8) Project dorakani Papa,
9) Company pettalani vundhi..!
10) Iddaru programmerla muddula tester
11) Job-e-naa pranam!,
12) Oracle dada-DBMS!,
13) Toli project...!
14) Yevandi mailochindi,
15) Project kosam,
16) Coding Ramudu
17) Intlo baava - Office lo Java,
18) Aaruguru programmerlu!!!,
19) Pandanti Project!
20) COBOL kaatesindi,
21) Programmer malli puttadu..!,
22) Sri SAP Swamy Mahatyam...!!,
23) Offshore lo puli - Onsite lo pilli
24) ...Nee Password Naaku Telusu !
25) Amma,Nanna,O'software engineer!!
26) Srivaariki Oka E-Mail,
27) Review cheddam raa,
28) Naakuuu...Project kaavaali..!
29) ...Sorry... naaku already job vundi,
30) Testing ante ideraa
31) Vaddu Bava....Java!!
32) Pavitra project!!
33) Basics Nerpina Bava...!!
34) Mogudu,Pellam,.. O'project!!
35) Ammo! Project Delivery!?
36) Premalo....PM,Programmer!
37) PM..! Vastunnadu jaagratha!!
38) Onsite andagaadu - Offshore Sundari,
39) Evadi coding vaadidhi!!
40) Repati Programmerlu..!
41) Vaadu Proggrammer Kaadu....!
42) Adirindayya Tester!!!
43) Programmer,Tester Madhyalo Bug!!
44) Developer....Chandra kanth!!
45) Wipro Mogudu,Infy Pellam!!
46) Avunu! Vaalliddaru Testerlu!!
47) Tester No:1
48) Nuvvu,Nenu...Project!
49) Project Chesi Choodu!!
50) PM Chebithe Vinaali!!! 
Interop b/w PHP and windows
Posted on November 20, 07 @ 05:14 am under PHP and has no comments.
I found this PHP video, which is a Powerpoint narration of PHP on windows. The presenter is in Microsoft and focuses on different points, which i thought, would be helpful for people working on php-windows.
http://asp.net/learn/videos/video-31.aspx
The video is wmv file with 8MB in size. It is worth seeing and knowing good things.
The narrator also shows how PHP will work with ASPX. Though they are too basic, you might get some ideas while implementing. 
November 18, 2007
Posted on November 20, 07 @ 05:09 am under Diary and has no comments.
With lot of people talking great about linux, today i tried the first flavour of linux, Ubuntu 7.10. Downloading the ISO image all the day, I ran it in the evening. Though I had little glitches, its OK. I wish to participate in the linux migration movement, by testing out the society favorite Ubuntu. 
Take off my clothes
Posted on November 19, 07 @ 03:49 am under iSpecial Jokes and has no comments.
My wife came home the other night and told me to take off her blouse.
Then she told me to take off her skirt.
Then she told me not to wear her clothes anymore. 
Drying him
Posted on November 19, 07 @ 03:48 am under Jokes and has no comments.
Ralph and Edna were both patients in a mental hospital.
One day while they were walking past the hospital swimming pool, Ralph suddenly jumped into the deep end. He sank to the bottom of the pool and stayed there. Edna promptly jumped in to save him. She swam to the bottom and pulled Ralph out.
When the Head Nurse became aware of Edna's heroic act she immediately ordered her to be discharged from the hospital, as she now considered her to be mentally stable.
When she went to tell Edna the news she said, "Edna, I have good news and bad news. The good news is you're being discharged; since you were able to rationally respond to a crisis by jumping in and saving the life of another patient, I have concluded that your act displays sound mindedness. The bad news is, Ralph, the patient you saved, hung himself with his bathrobe belt in the bathroom. I am so sorry, but he's dead."
Edna replied "He didn't hang himself. I put him there to dry. How soon can I go home?"

Who told you to stop your studies?
Posted on November 10, 07 @ 08:59 pm under Mind Views and has no comments.
I remember the day when i went for my first marriage looks. the bride was still studying and said many times that she was not willing to stop her studies. I wanted to ask her one question. "Who told you to stop your studies?". Ofcourse i could not ask her at that time, i was thinking what would have happened if i have asked her. ok let me screenplay my creativity and my mind views.
I will ask her "who told you to stop your studies? your parents or your relatives or your friends?" she will say some answer and she will ask me why. Then i will tell, "there are three reasons why people suggest or scare you to stop your studies.
1) If it is your parents, they feel that if you study much, then you will try to be independant and might not be interested to live with your husband as you will be confident in going out and finding a job. If you will not study much, then you have to depend on your husband. thus, even if you fight with your husband you will not leave him, as you are not independant.
2) if it is your relatives, they feel that you might be attracted to some other guy in your college and your husband will leave you. they dont want their relative to be badly named in such case.
3) if it is your friends, they strongly suggest that you should study and be indepandant. because depending on others is not what youth wants. if you take divorce, you should be able to go out and look for a job and survive yourself."
then some one will ask, "why are you so concerned about divorce conditions before marriage" I will pause for a moment and turn to the bride and tell her that "there are two kinds of people. one, who will be silent till the other person completes his statement. two, who interrupts the speaking person and declares his views to become popular. any way i will justify my statement. to pass a 10th class examination, you should be concerned about maths a lot. because its a bottle neck subject and passing it is a big thing. similarly people who are getting married are thinking for ways, not to get divorced.
a man wants a wife who will be in a home, (ofcourse, that is almost impossible in this generation) because after working for a whole day he comes back to home. When his wife comes with a cup of coffee and sits besides him and talk a few affectionate words, the man will feel relaxed. if it is a working wife, and husband asks her a coffee, she will ask to make it for himself and also give her a cup too. because she will be frustrated with the work in her office.
second, a man feels that his woman is attracted to someone else in her office. man can share any thing but not the love.. then everything appears artificial to him. and this leads to divorce. which is not what he wants."
then her parents will ask, "then you should have opted for a girl, who has already completed her studies. and why do you need a bcom girl in particular?" then i will say, "a bcom girl knows how to make a budget and can think about necessities of a family much more than a normal girl. plus, man will not be able to make the home budget because he will be thinking about his work rather than other things. and woman can handle things in a better and effective way. even a boss will have a lady as his secretary, because ladies can manage things better. if it is combined with an economic sense, what else is needed. "
after telling that "her" people will think i am a hero and i will be so popular among them. they will only look for a good girl for me. hmm.. the screenplay looks good, but it would work even better when this conversation happens in reality. 
Pages: 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - 15 - 16 - 17 - 18 - 19 - 20 - 21 - 22 - 23 - 24 - 25 - 26 - [27] - 28 - 29 - 30 - 31 - 32 - 33 - 34 - 35
|