Month: September 2010

SQL Server Database Diagram Creation Error

Recent database backup restore come-up with new error while tried to create database diagram “Database diagram support objects cannot be installed because this database does not have a valid owner.  To continue, first use the Files page of the Database Properties dialog box or the ALTER AUTHORIZATION statement to set the database owner to a valid login, then add the database diagram support objects.” After doing googling I found solution and it is really simple. I got 2 ways for that 1. Right click on datbase and go to properties .. than click on file .. set owner to...

Read More

PIMPL (the beauty marks you will want your libray to have :) )

Private-Implementation is a Software Engineering paradigm which allows us to enhance encapsulation, reduce compilation times and retain binary compatibility. The idea here to add another layer of abstraction between the library and the user code. The Story Consider that you are create a library which you will be shipping to customers when done. Since Software is never perfect and always extensible, after you shipped you Version 1.0 you plan to change the way your memory allocator functions . So you start updating the library and ship another version. You don’t change the signature of the function, just the internals. So at the backbox view, everything is same, just the feeling this version would be better than the previous since its Version 2.0. But, there is always a ‘but’, you have to add some private member in the .h file. So along with the Version 2.0 library you also ship update .h file. Now let’s say that I am one of the users of your great library. I use it to develop UI framework for my mobile device. So now when you release Version 2.0, there are two options for me. Either I stick to older less efficient version of upgrade to 2.0. I decide to upgrade to 2.0, I place the new .h and library to correct location and start compiling my code. Now to my surprise I see...

Read More

php mail() and godaddy windows hosting !

Recently come up with new error while writing function to send email using PHP Mail() function , Windows hosting with godaddy Warning: mail(): SMTP server response: 451 See http://pobox.com/~djb/docs/smtplf.html. in path_to_php_file on line # So I decided to write here the solution for the next time I encounter it and I thought it might also help other people. $to_address = "recivers@emaild.id"; $subject = "Email subject"; $message = "message  line1 message line2 message line3"; $headers  = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/plain; charset=iso-8859-1\r\n"; $headers .= "To: <".$to_address.">\r\n"; $headers .= "From: Sender <".$sender_email_address.">\r\n"; mail($to_email, $subject, $message, $headers); This works really nice with apache running with linux .. but windows system doesn’t recognize LF sequence .. so for $message we have to change it to following $message = "message line1\r\n message line2\r\n message line3"; OR $message = "message line1\r\n"; $message .= "message line2\r\n"; $message .= "message line3"; Happy coding...

Read More