Where is that azman dll ? :)
November 1, 2006
When using azman, it’s better to reference the following dll, rathing than browsing in the list of registred COM components. You’ll get a much more friendly namespace.
Azman reference path:
C:\WINDOWS\Microsoft.NET\AuthMan\1.2\microsoft.interop.security.azroles.dll
Should I use Page_Init or OnInit ?
November 1, 2006
I came across an interesting issue last friday.
There was an empty Page_Init method in some web control. I removed it, thinking that it would not do any harm.
Well, in fact, it was actually hidding the base class Page_Init method which used not to be executed. Of course, after my change, the base method was called and that caused a crash in the application
What I have learned from that:
When creating a base class that requires initialization, it’s better to use the OnInit method, rather that the Page_Init.
When using OnInit, the derived class will have to explicitly use the override keyword, which may help other developers avoiding this kind of issues.
How can I get…
November 1, 2006
… the sid for the current user:
use WindowsIdentity.GetCurrent().Owner.Value
… the token for the current user:
use WindowsIdentity.GetCurrent().Token
AzMan utility project
October 9, 2006
I have recently worked with the Authorization Manager. The easiest way to interact with AzMan is to use azman.msc, the mmc snapin.
The provided UI is a good starting point but it’s missing a lot of features that would be really useful when working on reasonably sized project.
Excel can help by providing a read only view of some of the AzMan store data, but nothing really great.
Fortunately, there is an API that is available. I actually spent most of my time writing my own little tools to do most of the work.
I have just started to compile a list of the features that I would have liked. I will start to write an application that will hopefully help azman users
○ Ability to copy store from one place to another
○ Auto assign operation ID
○ Warn when operation ID are identical
○ Provide easy reverse lookup like all users that can access this operation, etc…
○ Identify unreferenced items (e.g. this operation is not used)
○ Copy from one store to another (i.e. xml -> AD). Use filters (only operations, roles, …)
○ Search in store. Add filters (only operations, tasks, roles, …)
○ Diff between 2 stores
○ Merge 2 stores
○ Support for custom principals
○ Dump text / html version of the store
○ Display graphical view of the store, or launch azman.msc
○ Generate enums/code for operation/task/roles (c# & vb)
○ Generate script that creates the store
○ Generate Excel matrix (tasks vs. operations, roles vs. tasks, users vs. roles)
Well, I guess that I will have to start by prioritizing theses features
What’s new in “VSTO v3”
June 2, 2006
A CTP version of VSTO v3 has been released on the 21th of May. This blag entry is an overview of the new features of this third version.
Be aware that V2 applications may not work if you install the v3 CTP (Office 2007 beta 2 is required)
Add-in projects for up to 10 Office applications
- Access, Excel, InfoPath, Outlook, PowerPoint, Project, Publisher, Visio, Word and SharePoint Designer
- Design time support in visual studio!
Application level customizable task pane
- In v2, solutions were bound to specific documents and workbooks (except for outlook).
- New custom panes can be made available across the entire application. They are based on the new ICustomTaskPaneConsumer interface.
New XML-based format support
- Open and accessible XML structure.
- VSTO solution manifest is stored in custom XML parts, within the document.
- New “macro free” word and excel documents: .docx and .xlsx. If you rename such a document with a .zip extension, you will be able to view its internal structure. VSTO related components are found in the vstoDataStore folder.
- Old binary formats are still supported.
New UI extensibility (“ribbon”)
- The ribbon is the new office 2007 command user interface.
- Extensibility is supported at both document and application level (implement the IRibbonExtensibility interface).
Office 12 knows about VSTO Add-ins
- Add-ins blacklisting is more finely-grained. They can be disabled one a per-add-in basis.
- Faster loading time.
Further improvements (yet to come)
- A better deployment model, converging toward ClickOnce
- A better security model, able to handle versioning.
- Improved document-level ribbon customization
- New office 2007 IU visual designers
All of this looks very promising
The end of c# vs Vb.Net war ?
March 9, 2006
The .NET world is kind of divided into 2 groups: vb.net or c# users. There is always someone to argue that their favorite language is better.
It sounds like the old and famous curly bracket question. One would prefer having it at the end of the line (like in Java), others would like having it on a new line.
The truth is that this is all about you getting used to a particular way of reading code. Both are right ! you prefer reading vb code ? so be it !
My point here is that Visual Studio should display the code the way you want to read it.
For exemple, I write some c# code, I check it into source safe. My teammate (a vb guru) gets the latest version of the file, and then visualize it as vb.net code. How does that sound ?
Technically, both languages compile to the same IL (Intermediate Language) and software like
Reflector can decompile the assembly and display the code. Visual Studio should be able to format the code the way you like it best.
By the way, why do we still use plain text to store source code when we could have some kind of standardized xml ? I can already imagine nice 3rd party tools playing with all this data
Excel pictures :)
February 16, 2006
A lot of companies actually rely on spreadsheets for some of their business logic.
But that is not the only thing we can do with excel… have a look at theses geeky things:
I made a tiny c# to generate a text file that can be imported in excel :
StreamWriter sw = new StreamWriter("output.txt"); Bitmap src = (Bitmap) Image.FromFile("source.gif");
for (int x = 0; x < src.Width; x++) { for (int y = src.Height - 1; y >= 0; y--) { Color c = src.GetPixel(x, y); sw.Write("{0};", (c.R + c.B + c.G) / 3); } sw.WriteLine(); } sw.Close();
Your can then open the text file with Excel, set the import separator to ‘;’
You’ve got the data, all you now need is to use the excel graphic wizard to enjoy nice geek pictures
CmdHere.exe
January 18, 2006
CmdHere.exe is one of the nice tools known as the “power tools” from microsoft.
It adds a context menu entry when selecting a folder in the explorer, allowing you to quickly open a cmd.exe shell right in that folder. I love it !
Binary numbers…
December 19, 2005
I just came accross some c# code wich was used to convert a number into it’s binary representation. It did work but there is already something much simpler in the framework that does exactly the same thing:
Console.WriteLine(“>> ” + Convert.ToString(12345, 2));
>> 11000000111001
Instead of base 2, you may as well put 8, 10 or 16, which might be handy
Import msn messager contacts at once
December 19, 2005
I joined my new company and I have a list of 20 people that want to add to my msn contact list. There is an import command in the “Contact” menu, asking for a .ctt file. Hum, well… Lets try to export my current contact list to have a look at the format :
<?xml version="1.0"?><messenger> <service name=".NET Messenger Service"> <contactlist> <contact>first_contact@some_domain.com</contact> <contact>second_contact@some_domain.com</contact> <contact>third_contact@some_domain.com</contact>
...
<contact>last_contact@some_domain.com</contact> </contactlist> </service> </messenger>
This is great, this is xml format ! I just need to write a file with all the new contacts I want to add and import it.
To create the file, i used Excel. I wrote “<contact>” in A1, “</contact>” in C1 and i pasted my list of new contacts in B1. I copied the A1 and C1 cells downwards, up to my last contact. I selected everything and pasted it in a notepad. Less than a minute
And it works ^^
Wow ! there is now 20 people saying hello at once ! ^^