Erika Ehrli Cabral

Sunday, July 24, 2005

How to insert programmatically a bitmap to Microsoft Word documents

If you are trying to insert bitmaps to a Word Document from your .NET application, and you can't find how to do it, please take a look at the easy workaround I found.

Tuesday, July 19, 2005

Be gentle with the alarm clock and your computer keyboard

I have a new virtual friend from India, his name is Imtiyaz Mubarak and he shared with me the "modern interpretation" of the Dalai Lama's Instructions for the Millenium. I wrote a blog entry about this topic recently (Share your knowledge, it's a way to achieve immortality) and I am very surprised to see that people liked to find a piece of wisdom between technical stuff. So today, just to share some laughs and modern wisdom with you, I am sharing with everybody what Imitiyaz sent me:

Instructions for Life in the New Millennium From the Dalai Lama
In red, a similar instruction for “Everyday Reality”

1. Take into account that great love and great achievements involve great risk.
· Take into account that great amounts of ice cream and great amounts of pizza may make your cardiologist rich but for you they involve great risk.

2. When you lose, don't lose the lesson.
· When you lose weight, don't give away your old clothes. You will need them down the road.

3. Follow the three : Respect for self, respect for others, responsibility for all your actions.
· Follow the three : Respect for Habanero pepper sauce, respect for flashing blue/red lights, responsibility for all the voice-mail messages you leave.

4. Remember that not getting what you want is sometimes a wonderful stroke of luck.
Remember that someone losing your e-mail address is sometimes a wonderful stroke of luck.

5. Learn the rules so you know how to break them properly.
· Learn the rules so you can wait until the last moment to take care of things.

6. Don't let a little dispute injure a great friendship.
· Don't let a little remote control unit injure a great friendship or marriage.

7. When you realize you've made a mistake, take immediate steps to correct it.
· When you realize you've made a mistake, immediately hit Ctrl-Alt-Delete.

8. Spend some time alone every day.
· Spend some time away from your cell phone every day.

9. Open your arms to change, but don't let go of your values.
· Open your arms to carry the case of beer, but don't let go of your cart with the snacks for the big game.

10. Remember that silence is sometimes the best answer.
· Remember that being silent in a bar is always the best way to keep from getting punched in the nose.

11. Live a good, honorable life. Then when you get older and think back, you'll be able to enjoy it a second time.
· Eat good, honorable deserts. Then when you get older and think back, you'll be able to order them a second time.

12. A loving atmosphere in your home is the foundation for your life.
· An efficient house cleaning service is the foundation for your life.

13. In disagreements with loved ones, deal only with the current situation. Don't bring up the past.
· In disagreements with your food server, deal only with the current situation. Don't bring up the tip. Just ask to see the manager.

14. Share your knowledge. It's a way to achieve immortality.
· Share your recipes. It's a way to achieve immortality.

15. Be gentle with the earth.
· Be gentle with the alarm clock and your computer keyboard.

16. Once a year, go someplace you've never been before.
· Once a year, go to every place where you bought a membership.

17. Remember that the best relationship is one in which your love for each other exceeds your need for each other.
· Remember that the best relationship with your proctologist is one in which your love for each other exceeds your need for each other.

18. Judge your success by what you had to give up in order to get it.
· Judge the success of your diet against what you had to give up eating and drinking.

19. Approach love and cooking with reckless abandon.
· Approach open elevators and open parking places with reckless abandon.

Wednesday, June 29, 2005

Paying back some beers to the developer community

I remember many days (and nights too) when I was desperate trying to find some source code, conceptual or procedural documentation related to a specific technology and I just could not find the exact line of code that I was looking for. I remember also how grateful I felt when I found an article in a developer community Web site and I just can’t describe how thankful I was to the different authors that invested their time thinking in someone else and writing down their experiences and knowledge. By now, I owe two many beers to people that write in MSDN, Code Project, and C# Corner; however, more than buying a beer to every author who has helped me through my technical struggles, I knew that there was a better way to pay back the help and advice to the developer community: making yourself a contributor.

I started writing technical articles and published them in my Web Site, and today, my articles were just published in C# Corner. I am very excited about that for the following reasons:

  • C# Corner is a recognized developer community where many developers search for specific code samples and articles.
  • C# Corner has more hits than my Web site, so developers can find my articles quickly.
  • One of my UW teachers told me that it was nice that I had a Web site and blog; however, having your work published by a recognized community gives you more credibility.
  • Most important of all, I am now a contributor who is willing to pay back all the help and advice that some people decided to share with the developer community.

At this moment, C# Corner published the following articles:

And this is only the beginning, the more I realize I can help others, the more I want to do. So I look forward to continue writing and creating things that will improve how other people experience Microsoft technology.

Monday, June 20, 2005

Did you lose your mind and your source code?

I was trying to find the original source code for the code analysis & documentation tool that I built some time ago, and after spending some hours searching my computer and all my backup CD's, I could only find the assembly of the code project. Yes, you are right, I was very frustrated for some minutes; however, there are magical tools that can help you to remember the object model of a project as well as some implementation details.

Lutz Roeder created a class browser tool for .NET components: Reflector.NET. The tool allows you to explore the class hierarchy of an assembly and to disassemble the source code by class. The following image presents a snapshot of the information that .NET Reflector can provide for an assembly :



Figure 1. Sample disassembly of a class.


If you lost some code.....
  1. Take a deep breath.
  2. Think positive and consider that one advantage of loosing source code is that you get to start everything from scratch and you can make it much better.
  3. Find the assembly of your project.
  4. Download .NET Reflector.
  5. Open .NET Reflector.
  6. Load your assembly and there you go, your code is there, so don't be so scared.

Wednesday, June 15, 2005

.NET Code Analysis & Documentation Tool

Some time ago, I started writing a tool to document .NET code projects. I had no time to finish the tool and share a decent version with the developer community, but this week, I started to work again with my tool. I know you can work with tools such as NDoc; however, I could not find a tool that generates a document with all the information required by customers who create enterprise solutions.

The tool will help you to generate reports (Word, Excel, and HTML) that contain:

  • File analysis
  • Code statistics
  • API reference documentation
  • UML diagrams
  • COCOMO II Estimation
Note: The first version will work only with .NET projects written with C#. .NET projects written with VB.NET or J# will be considered in further versions.

I am expecting to release the first version on July 30, 2005.

Thursday, June 09, 2005

Active Directory and .NET

I just finished writing a reference guide that contains a set of tips and tricks to work with Active Directory (AD) and .NET. When I worked with AD I had a hard time figuring out how to do some tasks. I could find sample code and documentation related to some of them, but not for eveything I needed. I used full weekends to figure out how to do some tasks, so I promised to myself that one day I would publish the code samples I found and created to help other developers who are working with Directory Services. So, I wish you a happy AD.NET programming and I hope my work saves you some time.

In my reference guide you will find all the information, code samples, and workarounds that I found and created to accomplish the following tasks:

Monday, June 06, 2005

Information Design

I just published a new article that explores the concept and profession of information design. The article also presents my thoughts related to Saul Carliner's influence to technical communication.

Technical Writing & Editing Certification

I am happy to say that last week I finished my Technical Writing and Editing Certificate Program at the University of Washington. I devoted the last nine months of my life to this program and I can say that I had a wonderful experience learning interesting concepts related with:

  • Technical Communication
  • Style in Technical Writing
  • Technical Editing
  • Desktop Publishing
  • Production Editing
  • Computer Documentation
  • Information Design
  • User Assistance
I love software development, and I enjoy sharing knowledge and tricks with the developer community. One of my dreams is to write at least one technical book and I needed to improve my technical writing skills, so I enrolled to this program and I learned what I needed.

I am done with school projects (at least for a while), so I promise to devote more time to my Web site project and to share more code, samples, tools, and articles with everybody.

Monday, May 23, 2005

Free ASP.NET 2.0 Themes and Skins

When I started playing around with ASP.NET 2.0, I was surprised by its Rapid Application Development (RAD) approach for Graphic User Interface (GUI) development. ASP.NET 2.0 includes a new set of features (Skins, Styles, and Themes) that allow you to define the look-and-feel of Web Sites. I was so happy working with ASP.NET 2.0 Themes and Skins, that I decided to create the Colorful Web Site Starter Kit. The purpose of the Colorful Web Site Starter Kit is to help you to create, modify, and use ASP.NET 2.0 Skins, Styles, and Themes to define the GUI of your Web Site. The Colorful Web Site Starter Kit provides eight free sample ASP.NET 2.0 Beta 2 Themes:


  • MSN_Blue: Blue theme.

  • MSN_CherryBlossom: Pink theme.

  • MSN_Finance: Green theme.

  • MSN_Morning: Yellow theme.

  • MSN_Purple: Purple theme.

  • MSN_Red: Red theme.

  • WINXP_Blue: Windows XP Blue theme.

  • WINXP_Silver: Windows XP Silver theme.

Tuesday, April 12, 2005

Share your knowledge. It's a way to achieve immortality.

I was reading the Instructions for Life in the new millennium from the Dalai Lama, and in a list of 19 points, I was moved by some of them. Even though this is a technical blog, you can feel as inspired as I am by reading some of them, so here they are:

1. Take into account that great love and great achievements involve great risk.

2. When you lose, don't lose the lesson.

3. Follow the three Rs: Respect for self, respect for others, and responsibility for all your actions.

4. Remember that not getting what you want is sometimes a wonderful stroke of luck.

5. Learn the rules so you know how to break them properly.

6. Don't let a little dispute injure a great friendship.

7. When you realize you've made a mistake, take immediate steps to correct it.

8. Spend some time alone every day.

9. Open your arms to change, but don't let go of your values.

10. Remember that silence is sometimes the best answer.

11. Live a good, honorable life. Then when you get older and think back, you'll be able to enjoy it a second time.

12. A loving atmosphere in your home is the foundation for your life.

13. In disagreements with loved ones, deal only with the current situation. Don't bring up the past.

14. Share your knowledge. It's a way to achieve immortality.

15. Be gentle with the earth.

16. Once a year, go some place you've never been before.

17. Remember that the best relationship is one in which your love for each other exceeds your need for each other.

18. Judge your success by what you had to give up in order to get it.

19. Approach love and cooking with reckless abandon.

Tuesday, March 29, 2005

Free tool for VB.NET / C# translation

Carlos Aguilar Mares has created an incredible tool that translates VB.NET code to and from C#. You can either type the code or upload a file and the web page translates the code. You can also choose if you want beautiful colorized code or plain text.

This tool is very useful for programming and technical writers who need to write sample code in C# and VB.NET for technical documentation.

How to insert master-detail data with SQLXML from your .NET application

If you are building a .NET application that needs to perform insert operations to master and detail tables (e.g., order and order details tables related to an e-commerce application), consider using SQLXML, System.XML, and ADO.NET to reduce the amount of round-trips to a database.

I just finished and uploaded to my website a how to document that explains the steps to perform a bulk insert from your .NET application.

Monday, March 21, 2005

System.XML Improvements in .NET 2.0

The Microsoft .NET Framework 1.0 has built-in support for XML. The following list presents the great improvements done to the XML API in the Microsoft .NET Framework 2.0 according to Mark Fussel, a Lead Program Manager at Microsoft that works on XML and Web Service technologies:
  1. Better performance: The XmlReader and XmlWriter classes are twice as fast as the V1.1 release classes. XML Schema validation is 20 percent faster and XSLT performance is three to four times faster.
  2. Editing support for the XPathDocument and XmlWriter class: The XPathEditableNavigator combined with the XmlWriter class provide editing support for the XPathDocument class.
  3. XPathDocument improved as better DOM: XPathDocument class was improved and Microsoft recommends to use XPathDocument class instead of XmlDocument class as a better XML data store.
  4. Easier XPath queries to XML documents that have namespaces.
  5. Security enhancements: System.XML 2.0 allows now Code Access Security (CAS) and the XmlReaderSettings.ProhibitDtd property prohibits Document Type Definition (DTD) parsing to avoid Denial of Service (DoS) attacks.
  6. XQuery language: A new API that allows the use of XQueries in .NET.
  7. New XmlReader and XmlWriter helper methods: New methods such as:
    • XmlReader.ReadSubTree()
    • XmlReader.ReadToDescendent(string qname)
    • XmlReader.ReadToNextSibling(string qname)
    • XmlReader.ReadAsObject (System.Type type)
    • XmlWriter.WriteNode(XPathNavigator navigator, bool defattr)
    • XmlWriter.WriteFromObject(object value)

  8. Universal type support and conversion: The XmlReader, XmlWriter, and XPathNavigator classes now support CLR-XML type validation and conversion without using the XmlConvertion and XmlValidatingReader classes.
  9. Better compliance to the XML 1.0 Specification: The Create() methods for the XmlReader and XmlWriter classes enforce DTD support as well as conformance issues such as validation of element and attribute names.
  10. Static creation methods on XmlReader and XmlWriter. The use of static Create() methods provide easier configuration and enhances specialization because the instance type can be controlled.

      If you are interested for more in-depth information of System.XML improvements in .NET 2.0, I strongly recommend you to read the article: What's New in System.Xml for Visual Studio 2005 and the .NET Framework 2.0 Release.

      Friday, March 11, 2005

      Object-Oriented Programming and .NET

      I just uploaded to my web site two new articles:

      1. Object-Oriented Programming Concepts and .NET Part 1.

      2. Object-Oriented Programming Concepts and .NET Part 2.

      The articles belong to a three-part article series that presents definitions and samples for different Object-Oriented Programming (OOP) concepts and its implementation in .NET. The first part examines the concepts of classes, objects, and structs. The second part examines the concepts of inheritance, abstraction, and polimorphism.

      I am still working on the third part, which will cover the concepts of interface, multiple interface inheritance, collections, and overloading.

      Sunday, March 06, 2005

      Visual Studio 2005 Class Diagrams

      I am currently writing a set of articles about Object-Oriented Programming and .NET. I needed to create a class diagram to represent a sample for inheritance and I realized I could do it with Visual Studio 2005. One of the new features of Visual Studio 2005 is the Visual Studio Class Designer. If you need to create class diagrams with a great look-and-feel, try this cool feature.

      Data Structures in C# 2.0

      Scott Mitchell wrote recently a six-part article series about Data Structures using C# 2.0. If you need to remember computer science concepts such as Big-Oh Notation, Lists, Queues, Stacks, Hashtables, Binary Trees, Binary Search Trees, and Graphs, read this articles.

      Wednesday, February 23, 2005

      Stacks in .NET

      Hi, I just published an article about Stacks in .NET. I am currently working in a new article about Object-Oriented Programming (OOP) in .NET, which is a huge topic. I hope I can finish and upload it soon.

      Wednesday, February 09, 2005

      Welcome to my blog!

      The purpose of this blog is to share quick thoughts and my personal opinion for specific Microsoft technologies. I am currently working at my Web site .NET Treats & Tricks where I share articles and code samples.

      I have a bachelor degree related with Computer Science and I am currently enrolled to the UW Technical Writing and Editing Certificate Program. I love coding and writing, and I am having a lot of fun writing technical articles for the developer community.

      I think that the most amazing part of the software development career path is that technology is constantly evolving and there is always so much to learn by yourself, and of course, of all the talented software engineers around the world. I really enjoy sharing with other developers what I have learned, and of course to continue learning from so many people in Microsoft I have been lucky to know in the last years.

      I hope that some of the things I am planning to share will help someone else. It is not that I know a lot, in fact, I have a lot more to study and learn; however, some of the things I have done might help and that is the purpose of this space.