Tuesday, May 29, 2012

.NET 4.0 Fails When sending emails with attachments larger than 3MB



SMTPClient class throws "System.IndexOutOfRangeException: Index was outside the bounds of the array." exception while sending mails with attachment file size more than 3MB.
Recently I encounter a bug in .net while testing mail sending feature in our app. Upon little googling, found that it is a bug in SMTPClient class available in .NET 4.0.

Check below link for details of the bug:
https://connect.microsoft.com/VisualStudio/feedback/details/620785/important-bug-system-net-mail-smtpclient-send-mailmessage-causes-index-was-outside-the-bounds-of-the-array-because-of-the-content-of-an-attachment?wa=wsignin1.0

http://stackoverflow.com/questions/9703675/random-index-was-outside-the-bounds-of-the-array-as-an-smtpexception

Below is the link for Hot fix for .NET Framework to fix this issue:
https://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=30226




Wednesday, May 16, 2012

Using XML path to get the emailaddress of contacts


 CREATE TABLE #Email
            (
              FKGUID UNIQUEIDENTIFIER,
              EmailAddress VARCHAR(2500)
            )  
               
        CREATE TABLE #EmailAddressTable
            (
              EmailAddress VARCHAR(2500),
              IsDefault INT DEFAULT ( 0 ),
              FKGUID UNIQUEIDENTIFIER
            )  


  INSERT  #EmailAddressTable ( EmailAddress, FKGUID )
                                SELECT   EmailAddress ,
                                        EmployeeGUID
                                FROM    dbo.Employee


 INSERT  #Email
                SELECT  fkGUId,
                        SUBSTRING(( SELECT  ',' + s.EmailAddress
                                    FROM    #EmailAddressTable s
                                    WHERE   ISNULL(s.EmailAddress, '') != ''
                                            AND a.FKGUID = s.FKGUID
                                    ORDER BY s.EmailAddress
                                  FOR
                                    XML PATH('')
                                  ), 2, 200000)
                FROM    #EmailAddressTable a
                WHERE   ISNULL(a.EmailAddress, '') != ''
                GROUP BY a.FKGUID

The temp table #Email contains all the email addresses of each employee.



Saturday, April 21, 2012


Is Silverlight dead?
Microsoft has recently released Silverlight 5 though it is moving away from Silverlight to HTML5. So, is this the last release of SilverLight?The big question is "Is Silverlight dead?"
Silverlight is a browser plugin which works well on a desktop environment. But as we are now in the world of smart phones/tab devices where plugins are considered as evil, Silverlight would have hard time to survive.Though silverlight is cross platform but only for desktop environment. As we are now in the world of smart phones/tab devices, the meaning of cross platform solution has changed. HTML5 is the true cross platform solution for everything. So, it might be good to consider HTML5/css3.

Monday, April 16, 2012

Integrating Security into Development, No Pain Required

Integrating Security into Development, No Pain Required
Sponsored by IBM

Developers and security have traditionally been like oil and water. For developers, their key concern is making deadlines and enabling new lines of business. Meanwhile, the state of coding flaws, bug announcements and undiscovered zero day vulnerabilities are driving most security professionals to the brink. While both groups know they should be working together to improve code, development processes and application management, this type of coordination is still the exception rather than the norm.

Read more on clicking the link below.
http://www.sans.org/reading_room/analysts_program/ibm-appsec.pdf

Thursday, March 8, 2012

How to get the full-text search working for Office document (docx) in SQL Server


Run the following query in SQL Server Management Studio.

SELECT document_type, class_id,[path] FROM sys.fulltext_document_types

WHERE document_type = N'.docx';

SELECT *

FROM TableName

WHERE FREETEXT(*, 'ram') and filetype='docx'

If the free text is not giving the result for documents(docx), then download the Microsoft Filer pack from the following links.

Microsoft Office 2007 Filter Packs

http://www.microsoft.com/downloads/details.aspx?FamilyId=60C92A37-719C-4077-B5C6-CAC34F4227CC&displaylang=en


Microsoft Office 2010 Filter Packs

http://go.microsoft.com/fwlink/?LinkId=179530

1. Download and install Microsoft Filter Pack,

2. Enable IFilters, and then run the following command in that instance:

sp_fulltext_service 'load_os_resources', 1

3. Restart the SQL Server service.

4. Refresh the document Catalog of the database.

5. Disable and Re-enable the Full Text Index of the table.

For more information, please see

How to register Microsoft Filter Pack IFilters with SQL Server 2005 and with SQL Server 2008

If you had registered, I think we need to verify whether the file name extension correct.

Outlook 2010 App crash

The Outlook view control (OVC) which is used in the windows application works fine with Outlook 2007 but crashes when used in Outlook 2010. This is mainly due to the shutdown change behavior of Outlook 2010. When a user exits Outlook 2010, Outlook now shutdowns completely. This affects the outlook view control and results in app crash.

However, if the outlook 2010 is running separately in Background, then everything works fine.


Sources:

http://social.msdn.microsoft.com/Forums/en-US/outlookdev/thread/d206a642-95e3-42d2-98e0-98bf15dbc38f/

http://support.microsoft.com/kb/2511230

http://social.msdn.microsoft.com/Forums/en-US/outlookdev/thread/8e60581f-7a10-47c5-9dd5-7205c7628537/

http://social.msdn.microsoft.com/Forums/da-DK/outlookdev/thread/f2f5cb0f-5ce6-4d57-930c-43bd2a07f6a1

Friday, December 3, 2010

* Office Toilet Manners- When Will We Learn?

We spend most of our living hours at office and still do not follow basic toilets habits and manners. In simple words, it is shameful and more importantly ill-concern for personal hygiene for fellow office colleagues. And the fact that office toilets are in use throughout the day, makes it critical that everyone using it must follow some basic hygiene habits and bathroom etiquettes:




* Cleaning the bathroom after use: Why should other person use the washroom that has been dirtied by another person in the first place! Men specially have a problem in terms of “lack of accuracy” and if their “aim” was not correct, then least they can do it to clean up with water and dry it with tissue paper after the use. For those who feel this is a “dirty” job, it will be nice to remember that colleagues following them in using the toilet will be using the same “dirty” toilet and even catch infection! Those who do not wish to do this “dirty” clean-up job should be careful that they always “aim” correctly! In very direct language, please do not sprinkle on the seat, clean it if you do and always remember to lift the lid before leaving the toilet.
* Flushing after use: NEVER forget to flush the toilet after the use; it is not other person’s job to do this for you.
* Toilet paper and soap: These two are the most used items in any office washroom. What you do after using them also determines how clean the office toilet is! One should only use as much toilet roll as one needs and ensure that the used paper is properly disposed into dustbin. There is nothing more disgusting then used toilet paper roll lying around in the office toilet. Talking of soap, ensure to let the tap run for 2-5 seconds extra so that wash basin is cleaned of soap. Ensure to clean the wash basin after you have used it.
* Office bathroom – make-up and hair-styling: There is no doubt that this is one of the places in the office that offers privacy for make-up – Hair and face. But do ensure to clean all the hair and remains of make-up lying around the bathroom before you leave it
* Office toilet maintenance – If you find that basic toilet necessities like paper roll and soap are finished or lights are not working or toilet is dirty, it becomes your duty to inform the maintenance or office boys. They will ensure supplies are immediately provided. Supplies also include a good sized dustbin and bathroom freshener like “odonil”
* Limited time use please- Some people use office toilets for their private phone calls and sometime read to relieve stress! Well you come to office for work. Limit the use to 2-3 minutes, especially in the evening hours when everybody is in a hurry to leave for home!
* Office bathrooms are not gossip rooms: Bigger offices have bigger bathrooms and over a period of time, they become favourite gossip place for some of us. Well, not only is it not right, you run the risk of others hearing your gossip! And where it is single use bathrooms, at times colleague’s gossip with each other across the door, with one inside and other outside. Well, there has to be a difference between office and home and doing such actions goes against the basic office etiquettes.
* Wash your hands after use – Remember that you are in office and not at your home. Maintaining personal hygiene is not only for self but also important for other colleagues.

Here is “All the Very Best” for a nice, hygienically clean, nice smelling office bathroom and its hygiene conscious users.