Friday, May 19, 2006
Wednesday, December 28, 2005
Sharepoint and Email... Am I Missing Something?
One of the BIGGEST limitations I've had to work around however is the inability to send automated emails to users. Alerts though present are very different; because a user needs to sign up for his own alerts and manage them himself. On the other hand forced emails sent to the person in the "Assigned To" column is only a function of the issue list and as far as I realized most of this code is in Camel and not open source so it's pretty ugly to use an issue list for all scenarios just to utilize this email feature.
We've been working around this using multiple approaches - some of which are:
- Have JavaScript functions which are invoked on certain events firing - these functions just link using "mailto://" protocol and works like a charm for basic emails.
- Another idea I had was to have a ASP.NET component that uses Mail APIs to send mail. This could be invoked by web parts and parameters could be passed to it using query string. To generate Meeting Request the component could generate ICS files and then send them to the users.
Any better ideas or approaches, Anyone? Am I missing something here? Does Sharepoint have any out of the box solutions for emails when a list (which is NOT an issue list) is updated?
Wednesday, November 16, 2005
Cool File Functions in .NET 2.0
byte[] bFile = new byte[filesize];
bFile = (byte[])ds.Tables[0].Rows[nCounter]["FILE_DATA"];
System.IO.File.WriteAllBytes(fileURL, bFile);
The WriteAllBytes is an out of the box function that just takes the file path and name along with the byte arrary and just creates the file for you IF the directories specified in the path exist. Cool huh?
Wednesday, November 02, 2005
Thinking About Generics
Basically, Generics are a nice way of creating flexible data structures or type safe classes. The basic idea is that we implement the class that providers service in a 'generic' way. A Crude example... Public Class People <T> ... considering that <T> could be a student, friend, relative.... Now we can basically have the methods within the People class essentially work for students, friends and relatives as long they use algorithms with depend on common attributes of all these objects. Possibilities? Unlimited. All arguments are welcome :)
Monday, September 12, 2005
Using XmlTextReader to read XML from Text Variables
ds.ReadXml(new XmlTextReader(new StringReader(myStringWithXml)));
[Where ds is the instance of my XMLTextReader]
This User Group provides more information
Sunday, September 11, 2005
Exciting Times…
Beta 2 has been a Dream come true for me all the way! In fact the entire .NET world seems to be maturing so VERY fast! A couple of days ago I went hunting for OR (object Relational) frameworks in .NET and to my surprise I found over 10 of them to choose from! I settled for nHibernate (I understand Microsoft is developing ObjectSpaces whose’ release has been delayed till Long Horn release).
As I coded away I faced a few problems e.g. converting nHibernate classical lists to Generics. Again to my surprise I found quite a few articles in news groups where people had already tired similar things and had ideas on how to achieve this. I posted my questions and by the next day I had an answer from a MVP in my inbox! The guy is now helping me review my code and hopefully will come up with few more suggestions and enhancements.
What really excites me is not just features in Visual Studio 2005 (yes, Generics, Auto Generations of class diagrams and their auto update features, Refactoring, Code Snippets, Templates are AMAZING features) but what is really exiting about this times is the people who are getting involved in the Microsoft World!
There are TONS of REALLY SMART guys writting open source frameworks like nHibernate... There are authors who reply to you! MVPs who go out of their way to answer your questions and articles out there that teach you everything without a dime! These are REALLY exciting times.
Friday, July 08, 2005
Some more 'HOT' features of studio 2005
- Code Snippets - Sleek and smart!!! The way the snippets are inserted is cool but what really blew me off was the way varaible names changed when i changed specific part of the pre-insterted template!
- Refactoring - Some mind blowing features here. What i like most if i no longer need to type the same lame code to create properties.
- Partial Classes - Sleek and neat organization of code. Now two of us could be working on the same class at the same time but still stay on seperate files without worrying about screwing up each others work. The only thing that made me knit a brow slightly was the fact that i had to declare all my fields in a single file or else studio kept firing a warning. hmmm... must be some reason behind it i cant catch.
Custom Classes are NOT Value Types...
Employee rajivpopat = new Employee();
rajivpopat.EmployeeName = "rajivpopat";
rajivpopat.EmployeeDOB = System.Convert.ToDateTime("11/24/1981");
rajivpopat.AdditionalContactDetails = "AdditionalDetails";
Employee chetanpopat = rajivpopat;
chetanpopat.EmployeeName = "chetanpopat";
MessageBox.Show(rajivpopat.EmployeeName);
This shows and output "chetanpopat" - because change of chetanpopat.EmployeeName = "rajivpopat" has changed the vallue that rajivpopat.EmployeeName was referencing!!!
Structs however, work with a different concept and are Value Types! The Same code would return "rajivpopat" if Employee was defined as a struct! You'll not be able to initialize values of fields in struct and they will all be initialized by default value!!!
Thursday, June 23, 2005
Generics in Visual Studio.NET 2005
Struck by the sheer amount of time some of us have wasted by not playing around with Visual Studio.NET 2005!!! For the next few days I'll be publishing all new features of Visual Studio.NET 2005 as I play around with them. After installing Visual Studio.NET 2005 (and NOT being able to install MSDN Locally!) Generic Classes was the first thing I could lay my eyes on. I quickly wanted to write up a Generic Class and understand what I can and cannot do with them! The Below code snippet attempts to describe:
When Would I use Generic Classes?
From what I gathered I Would use Generics when I want a Type to accept any Generic Type and perform action on it! This requires some code to explain (the MSDN Code of Linked List implementation was slightly complicated):
/// <summary>
// Takes Any Generic Class.
/// </summary>
/// <typeparam name="T"></typeparam>
public class CurrentObject<T>
{
private T data;
/// <summary>
/// return the added object of the class to the calling program.
/// </summary>
/// <returns></returns>
public T returnObject()
{
return data;
}
/// <summary>
/// Allows addition of object of that Generic class
/// </summary>
/// <param name="objectData"></param>
public void AddObject(T objectData)
{
data = objectData;
}
}
We now introduce two new methods returnObject and AddObject. AddObject allows me to pass an object of the class I declared earlier. Once we have the object we just assign it to the object we created internally in the CreateObject class. In return Object we just return the class.
Lets take a quick preview of how we use this Generic Class. First thing we do is we create a quick class with two field that we will use with this Generic Class that we created!
/// <summary>
/// A Class That Will be passed to the Current Object object
/// </summary>
public class Customer
{
public string CustomerFirstName = "";
public string CustomerLastName = "";
}
Now the interesting part:
static void Main(string[] args)
{
// Create and Instance Of CurrentObject Generic Type
CurrentObject<Customer> currentCustomer = new CurrentObject<Customer> ();
Customer tmpCustomer = new Customer();
tmpCustomer.CustomerFirstName = "rajiv";
tmpCustomer.CustomerLastName = "popat";
// The Below could be a complex Linked List or Similar Implementation!
currentCustomer.AddObject(tmpCustomer);
Customer finalCustomer = currentCustomer.returnObject();
// Print the results obtained from the Generic type!
Console.WriteLine("Customer First Name is : " + finalCustomer.CustomerFirstName);
Console.WriteLine("Customer Last Name is : " + finalCustomer.CustomerLastName);
Console.ReadKey();
}
So basically the same collection we design works for virtually ALL classes and types!!! MIND BLOWING!!!
Wednesday, June 22, 2005
Uninstalling Visual Studio.NET 2005 Beta 1
If you see an error removing J# .NET Redistributable Package 2.0 from Add/Remove Programs, please run "msiexec /x {9046F10C-F5E7-4871-BED9-8288F19C70DF}" from a command line window
If you see an error removing .NET Framework 2.0 from Add/Remove Programs, please run "msiexec /x {71F8EFBF-09AF-418D-91F1-52707CDFA274}" from a command line window
Even if there were no errors and the Beta 2 keeps complaining that you have old J# Redistributable and Framework 2.0 still present in your computer EVEN after removing these from Add / Remove Programs the above tips are basically life savers!
Tuesday, June 07, 2005
Validating Date inputs for specific format.
System.Globalization.DateTimeFormatInfo dtFormat = new System.Globalization.DateTimeFormatInfo();
dtFormat.LongDatePattern = "MM'-'dd'-'yyyy HH':'mm";
try
{
DateTime dt = DateTime.ParseExact("02-24-1995 5:00","MM'-'dd'-'yyyy HH':'mm", dtFormat);
}
catch(Exception ex)
{
MessageBox.Show("The Following Exception Was Trapped While Validating Date:" + ex.Message);
}