Blogging from InfoPath

I’m trying to Blog from InfoPath. There’s a fantastic InfoPath
template available here:
I have tried Word 2007’s new blogging feature. It works
fine for posts without code. But if you insert code, the code looks
super horrible when the blog gets published. Even the “Copy as
HTML” can’t give you good output. Also no image upload
support.
I am thinking what if there was a nice addin for MS Word which
can make a document publish as blog by automatically uploading
pictures in it and nicely formatting code blocks, it could make us
so productive. Mankind has invented so many great tools, but a
really good Blogging tool that works for all is still
missing.

Send a message individually to all recipients using Outlook

Say you have written a message which has lots of users in the
recipient list. Now you don’t want to send the mail to all those
users who can see each others email address. You want to send the
message one by one. Here’s what you do:

  • After composing the message save it to make it go to Drafts
    folder.
  • Select the message
  • Press ALT+F11 to bring the Visual Basic Editor.
  • Now paste the following code:

Sub SendIndividually()

Dim objItem As MailItem
Set objItem = Application.ActiveExplorer.Selection.Item(1)

Dim objTo As Recipient
Dim objClonedMail As MailItem

On Local Error Resume Next

For Each objTo In objItem.Recipients

Set objClonedMail = objItem.Copy()
objClonedMail.To = “”
objClonedMail.Recipients.Add objTo
objClonedMail.Send

Next

End Sub

  • Hit F5 and wait for a while. You will see Outbox is full of
    copy of the message with individual recipient in the “To”

Read my previous post on how to generate a message with all the
sender’s email address from all the message in a folder. You can
combine both approach to send everyone important notice.

Get email address of all users from all mails in Outlook Folder

Sometimes you want to send some important notice to everyone who
has ever mailed you. Let’s say you have a folder named “Friends” in
Outlook where you store all the emails from your friends. Now you
want to get all of their email addresses. Pretty difficult work if
you have thousands of such mails. Here’s an easy way.

  • Select the folder in Outlook and press ALT+F11. It will open
    Visual Basic Editor.
  • Double click on ThisOutlookSession from the Project tree.
  • Paste the following function:

Sub GetALLEmailAddresses()

Dim objFolder As Folder
Set objFolder = Application.ActiveExplorer.Selection

Dim dic As New Dictionary
Dim strEmail As String
Dim strEmails As String

Dim objItem As MailItem
For Each objItem In objFolder.Items

strEmail = objItem.SenderEmailAddress
If Not dic.Exists(strEmail) Then
strEmails = strEmails + strEmail + “;”
dic.Add strEmail, “”
End If

Next

Debug.Print strEmails
End Sub

Hit F5 and it will run for a while. Then press Ctrl+G. You will
see the email addresses in the “Immediate
Window”.

Copy the whole string and you have all the email addresses from
all the emails in the selected Outlook folder. There will be no
duplicate address in the list.

Mac OSX vs. Windows Vista

Today we purchased an iMac (Intel Dual Core) in order to test
Safari 2.0 support for Pageflakes. My first impression, I
am totally blown away by its performance. The UI is unbelievable
well done and the visual effects you see are 10 years ahead of
time. I was comparing OS features of Mac OS X 10.4.X.X with Windows
Vista. To be honest, I am suffering from inferiority complex now.
Windows Vista is so lame compared to Mac OS X. Vista copied all OS
X’s concepts for which at least I feel ashamed whether Microsoft
feels or not. But it did not make anything better after copying.
Normally Microsoft copies others ideas and makes them really better
in all possible ways. But Mac OS X is so seriously better than any
other OS. The widgets you see with the OS X are mind
blowing. Vista side bar goes nowhere near to it. Also the
concept of switching to regular mode and widget mode is by far the
best idea. We normally don’t want to occupy desktop space with
widgets. That’s why in OS X, the whole screen switches to widget
view when you press middle button.

OSX kernel is made from Unix. So, it’s
seriously powerful and stable. The command line tools are very
feature rich. Those who love *nix command line, will feel at home
in OSX. Vista still offers those poor command line tools from
Windows XP/2003. Nothing improved much.

If somehow OSX can run Windows apps like Visual Studio, MS Word
etc, I will undoubtedly switch to OSX. Even Windows Vista won’t be
able to compromise me.

Best of all, you can buy an iMac with Intel Processor and use
dual boot to run both Windows and Mac OSX. So, when you work, boot
on Windows. When you want to have fun, go to OSX.

Cache-Control header cannot be set properly in ASP.NET 2.0 – A solution

Do you know that you cannot set Cache-Control: max-age header in
ASP.NET 2.0? No matter how many combinations you try, you will
always end up with “max-age=0” for sure.

I found solution to the SetMaxAge problem in HttpCachePolicy.
Here’s the code of the function in HttpCachePolicy
(decompiled):

public void SetMaxAge(TimeSpan
delta)
{

if (delta < TimeSpan.Zero)

{

throw new ArgumentOutOfRangeException(“delta”);

}

if (HttpCachePolicy.s_oneYear < delta)

{

delta = HttpCachePolicy.s_oneYear;

}

if (!this._isMaxAgeSet || (delta < this._maxAge))

{

this.Dirtied();

this._maxAge = delta;

this._isMaxAgeSet = true;

}
}

Someone is setting maxAge already to 0. So, if I assign a higher
value it does not get set.

I am not sure why the “(delta < this._maxAge)" condition is necessary. If I somehow set a lower maxAge, I can never increase it!

So, I have made an HttpModule which does this:

void context_EndRequest(object
sender, EventArgs e) {
if (HttpContext.Current.Items.Contains(“SetMaxAge”))
{

FieldInfo maxAge =
HttpContext.Current.Response.Cache.GetType().GetField(“_maxAge”,
BindingFlags.Instance | BindingFlags.NonPublic);

maxAge.SetValue(HttpContext.Current.Response.Cache,
(TimeSpan)HttpContext.Current.Items[“SetMaxAge”]);


// SetMaxAge does not
work.
//HttpContext.Current.Response.Cache.SetMaxAge((TimeSpan)HttpContext.Current.Items[“SetMaxAge”]);

HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.Public);
HttpContext.Current.Response.Cache.SetExpires(DateTime.Now.AddMinutes(5));
HttpContext.Current.Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches);
}
}

If someone sets “SetMaxAge” to a Timespan in the Context.Items,
it will get set to the response and the end of the request. This
ensures, no matter who does what with cache object, maxAge will
definitely be set.

Although this is not a Atlas specific problem, it seems to be a
problem in ASP.NET 2.0 itself.

Now I can cache AJAX call responses on the browser and prevent
roundtrips.

Pageflakes #1 Start page in Web 2.0 awards

Pageflakes won the Web
2.0 Award for #1 Start Page. See the “Start Page” category
from:

http://web2.0awards.org

#2 is Google’s IG and #3 is Microsoft’s Windows Live.

Pageflakes is developed using ASP.NET 2.0 and Microsoft
Atlas.

Here’s what Pageflakes say:

Pageflakes is your personalized Internet. You can add what you
like and remove what you don’t like – and it’s totally simple. What
you see on the site right now is just a selection of a few standard
modules (“flakes”, as we call them) that allow you to read blogs,
do web searches, create a to-do list, check your Gmail account and
read the latest news. Normally you’d have to go to a different web
page for each of those things. With Pageflakes, you have it all on
one page! And it’s all free.

Note: You can now create public sites and share your page with
your friends! Setup a personal site very easily and collaboratively
work together

Stickout – .NET 2.0, Outlook Word Excel Add-in, VSTO, Remoting, you name it

StickOut is a desktop sticky note application with multi-user
support and Outlook integration. It is a .NET Framework 2.0 Windows
Forms application that uses .NET Remoting to communicate with other
StickOut users and exchange sticky notes with them. It uses the new
.NET Framework 2.0 IPC Channel for communicating between Microsoft
Outlook and the StickOut process. The Outlook Add-in allows you to
stick anything out to the desktop from Outlook including e-mails,
notes, tasks, appointments, etc., as sticky notes. Care has been
taken to reduce the memory footprint of a .NET application
significantly and to make a fast and smooth user experience. This
article chronicles my first day of planning the application,
through subsequent design, development, testing, and deployment
days, revealing the evolution of the application, and the
complications I dealt with at each step. You will read about lots
of .NET tricks, deployment and versioning problems, Visual Studio
tricks, and some other non-development–related tricks that
might help you to boost your daily development work.


http://msdn.microsoft.com/netframework/default.aspx?pull=/library/en-us/dnwinforms/html/stickout.asp

Hope you enjoy it!