Friday, July 4, 2008
First day of the month oracle SQL Query
select trunc(sysdate,'MONTH') from dual
Trunc Function of PL/SQL when passed with a 'Month' parameter will return the first date of a month.
instead of sysdate use the date value you want
sysdate trunc(my_birth_day,'MONTH') from My_Details
Wednesday, June 18, 2008
The Sharepoint Developer Introduction for .NET Developers
There are not much developers who are experts in MOSS 2007 Developments. This is the Microsoft's step for the .net communities to gain momentum in sharepoint development.
Video Tutorials and hands on Sessions are included and are really informative.
The Sharepoint Developer Introduction for .NET Developers
Tuesday, June 17, 2008
Architect Webcast Series
Checkout the following link
Architect Webcast series
Sunday, June 15, 2008
Software Patterns
• Highest level patterns
• Determines overall system architecture and provides the skeleton for the system
• Determines and specifies the relationship, roles and responsibilities of each subsystem
• It organizes the relationship between the sub systems
Eg.. SOA, Layered Architecture
Design Patterns
Used to fine tune the overall architecture and solve problems specific to the subsystem
It does structuring components, delegating and distributing workloads and organizing the communication and creation of components
Three Categories
• Creational Pattern
• Structural Pattern
• Behavioral Pattern
Implementation Patterns or Idioms
Defines solutions specific to a language
Even if I know the syntax in a language, to do efficient implementation one should use some specific styles that the language provides.
Tuesday, June 3, 2008
Yet Another reason why Properties should be used instead of Fields
Today, I did a little experiments on Properties VS Fields. It is better to use properties especially when that property is to interact with the other DLLs or external Assemblies.
Scenario: library.library.Name is a field in my library which I refer in my winapp. I executed it worked fine. I wanted to validate Name field for special characters so I decided to change “Name” (At present a Field in library) to a property so that I could validate it in the set property.
As the member name and the return type (string) did not change I did not recompile my winapp. But I got the following exception “Field not found” as it’s a property now.
Conclusion: When you need a member to interact with the external assemblies or DLLs or EXEs make it a property instead of field. This enables you to add validators later within your class.
Tuesday, May 27, 2008
want to use Session Variables in Sharepoint?
<httpmodules>
<clear>
<add type="System.Web.Caching.OutputCacheModule" name="OutputCache">
<add type="System.Web.Security.WindowsAuthenticationModule" name="WindowsAuthentication">
<add type="System.Web.SessionState.SessionStateModule" name="Session">
</httpmodules>
and also
<pages enablesessionstate="true" enableviewstate="true" enableviewstatemac="true" validaterequest="false">
Monday, May 26, 2008
Friday, May 23, 2008
Sick of unexpected error in sharepoint? Want to see asp.net like error page with stack trace?
"<"SafeMode MaxControls=“200“ CallStack=“true">"
"<"customErrors mode=“Off“/">"
Wednesday, April 23, 2008
Steps for creating features
Featues / "<"featuesname">" / feature.xml
Add schema to feature.xml from loc -">" web server xtn\12\template\xml\wss12.xsd
"<"feature ID=”” Title=”” Description= “” Scope = “” Hidden=”false”
"<"feature id="””" title="””" description="“”" scope="“”" hidden="”false”"">" "<"!-Note users cant activate or deactivate the feature only admin can-">"
"<"elementmanifests">"
"<"elementmanifest location="”Elements.xml”"">"
"<"elementmanifests">""<"elementmanifest location="”Elements.xml”"">"
2. Add new file Elements.xml
"<"elements">""<"elements">"
"<"module name="””" path="”url”"">"
"<"file url="””" type="”Ghostable”"">"
3. Inherit from SPFeatureReceiver class
Override the events FeatureInstalled, FeatureActivated,
Featureuninstalled, Featuredeactivated, Featureuninstalling, Featuredeactivating
4. put the DLL in GAC
5. In feature.xml ad these tags
"<"Feature ID=””
ReceiverClass=
ReciverAssembly=
Steps for Creating Item Event Handlers
- Open VS 2005 -> Select a class Library project -> Name it ____Handlers.
- Inherit the class from SPItemEventReceiver.
- override ItemAdded, ItemUpdated (Asynchronous Events)
Item Adding, ItemUpdating (Synchronous Events) - Install the DLL in GAC
- There are Two ways to register an Event Handler a. Install Features b. Through code
- To Register through code -> Open new console project
Open site -> web -> get the list through code use the following method to register - List.EventReceivers.Add(
, , );
Thursday, February 14, 2008
Friday, January 4, 2008
This Code Creates Document Library, Creates Group and users and assigns it to Sharepoint Document Library
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint;
namespace DocLibCreator
{
public class DocLibCreator
{
private SPWeb web;
private SPMember _Owner;
public SPGroup Group;
private string _utCode;
public Guid ListID;
public string utCode
{
get { return _utCode; }
set {
try
{
_utCode = value;
SPUser user;
if (Group != null)
{
user = web.Site.RootWeb.EnsureUser(_utCode);
AddUsersToGroup(user);
}
}
catch (SPException e)
{
//System.Windows.Forms.MessageBox.Show(e.Message);
}
}
}
public MercureSiteCreator(SPWeb web)
{
this.web = web;
}
private SPUser GetExistingUser(string _userString)
{
//parse the string after the delimiter '#'
int delimIndex = _userString.IndexOf("#");
string userStr = _userString.Substring(delimIndex + 1);
SPUser user = null;
foreach (SPUser thisUser in web.Users)
{ //if this is current user
if (thisUser.Name.ToLower().IndexOf(userStr.ToLower()) > -1)
{
user = thisUser;
break;
}
}
return user;
}
public SPMember owner
{
get { return web.CurrentUser; }
}
private string _groupName;
public string GroupName
{
get { return _groupName; }
set
{
_groupName = value;
Group = GetSiteGroup(_groupName);
}
}
private bool AddUsersToGroup(SPUser User)
{
if (!IsUserInGroup(User, Group.Name))
{
Group.AddUser(User);
web.AssociatedVisitorGroup.AddUser(User);
web.Site.RootWeb.AssociatedVisitorGroup.AddUser(User);
return true;
}
return false;
}
private bool IsUserInGroup(SPUser user, string grpName)
{
foreach (SPGroup group in user.Groups)
if (group.Name.ToLower().Trim() == grpName.ToLower().Trim())
return true;
return false;
}
public Guid createDocLibrary( string title)
{
Nullable
if (!id.HasValue)
id = web.Lists.Add(title, "This was created Programatically", SPListTemplateType.DocumentLibrary);
ListID = id.Value;
return id.Value;
}
private Guid? GetExistingList(SPWeb myWeb, string title)
{
foreach (SPList list in myWeb.Lists)
{
if (list.Title.ToLower().Trim() == title.ToLower().Trim())
return list.ID;
}
return null;
}
private SPGroup GetSiteGroup(string groupName)
{
SPGroup group = null;
group = GetExistingSiteGroup(web.Site.RootWeb, groupName);
if (group == null)
{
web.Site.RootWeb.SiteGroups.Add(groupName, owner, null, "");
group = GetExistingSiteGroup(web.Site.RootWeb, groupName);
}
return group;
}
private SPGroup GetExistingSiteGroup(SPWeb webs, string name)
{
foreach (SPGroup group in webs.SiteGroups)
if (group.Name.ToLower().Trim() == name.ToLower().Trim())
return group;
return null;
}
public void CreatePermissions()
{
SPRoleAssignment roleAssignment = new SPRoleAssignment(Group);
SPRoleDefinition role = web.Site.RootWeb.RoleDefinitions["Read"];
if (!roleAssignment.RoleDefinitionBindings.Contains(role))
roleAssignment.RoleDefinitionBindings.Add(role);
SPList list = web.Lists[ListID];
//Check inheritance
if (!list.HasUniqueRoleAssignments)
{
list.BreakRoleInheritance(false);
}
list.RoleAssignments.Add(roleAssignment);
list.Update();
}
}
}
Thursday, December 27, 2007
Tuesday, December 4, 2007
Assigning Lookup Field's value
if (lkupField != null)
{
System.Guid g = new Guid(lkupField.LookupList);
SPList lookupList = webTestSite.Lists[g];
SPQuery query = new SPQuery();
query.Query = "
+ "
SPListItemCollection Items = lookupList.GetItems(query);
if (Items != null && Items.Count > 0)
{
string Value = Items[0].ID + ";#" + Items[0][lkupField.LookupField];
listItemHelp[field.name] = Value;
}
}
How to initiate the stsadmin from .Net
ProcessStartInfo pi = newProcessStartInfo("stsadmin.exe");
pi.Arguments = "-o arguments"
pi.Windowstyle = ProcessWindowStyle.Hidden;
p.startInfo = pi;
p.start();
Tuesday, October 23, 2007
Google has increased the storage pool by 33%
Monday, September 3, 2007
Sunday, August 26, 2007
New Features in Visual Studio 2008
- .NET Framework multi targeting.
- Setting breakpoints and Debugging through the script code and Jscript intellisense support.
- LINQ designers and LINQDataSource Control is added.
- Split window with Design and Source page combined.
- Visual studio tools for office 2007 is fully integrated
- ASP.NET AJAX controls have been added
- Supports XAML for presentation
- You can build applications that target Microsoft Office SharePoint Server
- RAD tools to easily consume WCF Services (Added Workflow Activity in WF to consume a WCF service)
- Login/Logout, Role management and profile services for windows applications
- WF Designer and Debugger integration
- Added IronPython Programming Language.
- Windows Vista Look & Feel
Introduction to LINQ (Language Integrated Query)
LINQ is a new feature to be released as a language enhancement in VB 9.0 and C# 3.0. it is an Object relational mapper which enables an unified approach to query databases, XML files and text files.
LINQ bridge between data domain (Database and XML Files) and programming domain (Objects). it brings together the power of SQL or Query language into the programming languages like C# 3.0 and VB 9.0.
Different flavors of LINQ exists and they are
LINQ to SQL
LINQ to XML
LINQ to XSD (a wrapper around LINQ to XML)
LINQ to Dataset
PLINQ (for Parallel processing)
LINQ to Objects
LINQ to Entities (Included in ADO.NET VNext)
LINQ is not a compiler feature its a language feature any one can extend LINQ and customize them, Some of them are
LINQ to Sharepoint (Can be found in CODEPLEX open source community)
LINQ to Active directory
List of Feature .NET Framework
Features in .net 2.0
1. Webparts
2. Profile services
3. membership services & membership controls
4. Role management services
5. Master Pages
6. Sitemaps
7. Dataset designer (Enables to easily create strongly typed dataset and Data access layer)
8. Caching
SQL Cache dependency
SQL Cache dependency(with broker service)
Partial page caching
9. Annonymous delegates
10. Partial class
11. Generics
12. Personalization
13. Data controls (sqldatasource, xmldatasource, object datasource, etc)
14. New Provider Model
15. ASP.Net configuration tool
16. Reporting services
17. Type Forwarding
Note: There are even more features in .net 2.0
Features in .Net 3.0
1. Windows Communication Foundation ( The Unified Framework For Rapidly Building
Service-Oriented Applications )
2. Windows Presentation Foundation
3. Windows Cardspace
4. Windows Workflow Foundation (Tools and engine for building workflow-enabled apps )
Features in .Net 3.5
1. Ajax enabled controls
2. LINQ, DLINQ, BLINQ, PLINQ, XLINQ
3. LINQ to SQL, Linq to XML, Linq to datasets
4. Extension methods
5. Lambda expressions
6. Query expressions
7. Expression trees
8. Anonymous types
9. collection and object initializers
10. Typed local variables and arrays
11. LinqSqlDataSource control added
12. Enables debugging of javascript and intellisense for javascript
Scrum (Software Engineering Process)
Scrum is a process for building software. scrum is not a methodology.
scrum enables the members not to disturbed often by the management, To know where they are. Members are given the freedom to do what they want, they dont need approvals and other stuffs from the management for what they are doing because all my members are already experts.
So the management believes what ever they do will most probably give a good results. Members are assigned tasks and at every iterration all the management needs is result or the product. Each iterations in scrum is called as scrum sprint (Time Box).
Scrum assumes the team involved in the process are
- highly performing
- intelligient in their functional areas
- cross functional domain and business experts are involved
- self managing team with more responsibilities
- Project duration is small
Frequent scrum meeting among the team members (not with the management) happens to discuss what they have done and they have to do next.
Done here means Documented, implemented, tested Quality assured and Complete.