Archive

Archive for April, 2010

Debugging Assembly Loading Failures

April 21, 2010 2 comments

There are situations sometimes when .NET loads wrong assembly or can’t load one at all. Usually we can see “Could not load file or assembly” in that case.

In one of my project we had a situation that gave a real world example for post I was thinking about quite long time. There was a reference of enterprise library in the project and everything worked fine in local & production environment. But one day due to the power problem, production server was rebooted and system stopped picking assembly of enterprise library. There can be many situations like that, when in our opinion all is perfect but isn’t and .NET fails with loading assembly or loads incorrect one.

.Net framework has given a wonderful tool “Fusion – Assembly Binding Log” to diagnose such problems. If you will take a look into .NET Framework directory you will see a fusion.dll. This inconspicuous file is responsible for finding locating the correct assembly and, what is more important, can produce a log of that. As a pair for that we have simple tool named fuslogvw.exe that can be found in Visual Studio directory. This small tool is an Assembly Binding Log Viewer and is able to get logs created by fusion.dll, save them on disk and of course display.

Turning on Fusion Logging

Type “Fusion” in the Start Menu. The Assembly Binding Log Viewer, or “Fusion Log Viewer” which will tell the CLR to load assembling binding/loading activities to a folder, then let you see them. Be sure to run it as Administrator if you want to change the Settings, otherwise they’ll be grayed out. Alternatively, just set the Registry keys your self. (I just memorized them, as I set them all the time.) Set HKLM\Software\Microsoft\Fusion\ForceLog registry value to 1 and HKLM\Software\Microsoft\Fusion\LogPath registry value to C:\FusionLogs or some path that exists.

Now you can run code/program that causes the problem and click Refresh when it will finish. You should see a log file on the path specified for fusion logs. Double click on any log entry will open whole log for that assembly. Information you can find there is sometimes amazing. By analyzing that information you should be able to find the problem and don’t forget to turn logging of when you finish.

Plone – An Amazing CMS

Plone (http://plone.org/ ), a Python based Content Management System (CMS) built on top of the open source application server Zope, is one of the best Open Source CMS among paid & open source CMS available.

One of its great feature is, it allows you to write Python script / create templates / any customization thru the web (TTW ) & run instantly.

You can never lose you changes as it maintains the complete history of changes and you can compare the differences among different versions online.

Another cool feature is you can write the rules for  any content type when it is created/update/delete/moved/copies etc using the Rules Engines to manage your content or initiate any approval workflow etc.

Some of its nice features are as below:

Authentication & Authorization
Flexible Authentication back-end, can be integrated with LDAP / Active Directory or any other source
Security
Users, groups & permission management
Live Search
Multi-lingual support
Content Publishing
Workflow
Caching
SEO URLs
RSS Feed
Commenting on any content type
Moderation
Page / Content Templates
Drag & Drop Re-ordering of content
Multiple Views of content type
Automatic image scaling and thumbnail generation
Rich ecosystem of free add-on products
Cross-Platform
Inline Editing Support
Cut / Copy / Page Operation support on content
Collaboration and sharing
Versioning, history and reverting content
Full Text Search on documents like Word / PDF
Collections
Automatic Sitemap Generation
Rules engine for Content
Custom Forms
Portlets like Calendar / RSS Feed / Search etc.
Themes
Customization
Connection to external databases

There is a long list of functionalities.

Many other features can be added to Plone by deploying & Installing the Add-on products like Blogs/ Forums etc . You can create your own add-own product and deploy.

Categories: Technology Tags: ,

Create OpenXML Packaging API for .NET 1.1 & .NET 2.0 – Part 1

April 15, 2010 Leave a comment

The adoption of XML (Zipped) as the native file format for Word/Excel/PowerPoint 2007 has opened up a new set of opportunities for software developers to integrate & generate Office files across the platform.  There is absolutely no need to use OLE Automation etc in VB or .NET.

Microsoft System.IO.Packaging comes with .NET 3.0.

About Open XML

Open XML is a file format for representing Microsoft Office documents like word spreadsheets and presentations documents. An OpenXML document file contains mainly XML based files compressed within a zip package.

You can read more about OpenXML formats here: http://msdn.microsoft.com/en-us/library/aa338205.aspx

It is important to have knowledge of Open XML file formats, its structure, about Parts & Relationships and content types to understand this series of article.

Sometimes there are requirement to generate the office files in the software application which is based on .Net 1.1 & .Net 2.0. It cannot be upgraded to .Net 3.0/3.5 because of some internal reasons so it is necessary to build the Packing API which can work with .Net 1.1 & .Net 2.0 so that .docx, .xlsx & .pptx can be created from their system.

This article will be in parts, in part one we will define the interfaces required to build the Packing Library.

An Office file (excel, work, ppt) is a zipped file that contains the folders, xml, images etc. which is called as package and a package can have multiple element which are called PackagePart like Image, comment, notes, header, footer, chart, slide, worksheet & many more.

There is hierarchy of parts and they are related to each other. This relationship is maintained in .rels file inside _rels folder.

Content Type information like xml, text, image, mp3, wav is also stored inside the ZIP Office Package in the Content_Types.xml file.

So based on the structure of Office File Format we can define the following abstract / inherited classes

/// <summary>

/// Abstract Package Class – It represents an office 2007 document (Excel / Word / PPT)

/// </summary>

public abstract class Package

{

}

/// <summary>

/// Abstract PackagePart Class – Holds in the information for a Package Part like Header, Footer, Hyperlink, Image, Chart etc.

/// </summary>

public abstract class PackagePart

{

}

/// <summary>

/// PackageProperties Class – To store the Package core & other Properties like

/// </summary>

public class PackageProperties

{

}

/// <summary>

/// PackageRelationship Class – Stores all relationships

/// </summary>

public partial class PackageRelationship

{

}

/// <summary>

/// ZipPackage Class: Implementation of Package Class.

/// </summary>

public class ZipPackage : Package

{

}

/// <summary>

/// ZipPackagePart Class – Implementation Class for PackagePart

/// </summary>

public class ZipPackagePart : PackagePart

{

}

Package & PackagePart can have multiple implementations based on which ZIP Library you use to zip/unzip your package file.

Gmail Mobile API – how to log out

April 14, 2010 2 comments

If you are trying to use gmail mobile API to create a light weight JavaScript based gmail application by posting requests to https://mail.google.com/mail/m/12345, it saves login info in cookies…

To logout and login again from some other user you need to logout first by deleting the existing cookie, something like this:

netscape.security.PrivilegeManager.enablePrivilege(“UniversalXPConnect”);

var cookieMgr = Components.classes["@mozilla.org/cookiemanager;1"].getService();
cookieMgr = cookieMgr.QueryInterface(Components.interfaces.nsICookieManager);
cookieMgr.remove(“mail.google.com”, “S”, “/mail”, false);
cookieMgr.remove(“mail.google.com”, “GMAIL_AT”, “/mail”, false);
cookieMgr.remove(“.mail.google.com”, “GX”, “/mail”, false);

Categories: Technology Tags:

S M Macario keeps increasing customer base even during slowdown

April 13, 2010 Leave a comment

We are able to make some good progress during the slowdown period; it could be because of our belief in our vision and the quality of the work being done by our team.

We have entered in manufacturing (fashion), and health-care adding to our existing list of industries.

Categories: General
Follow

Get every new post delivered to your Inbox.