I thought split and save blob is a great idea until i found the link
http://blogs.microsoft.co.il/blogs/gilf/archive/2009/02/05/back-to-basics-zip-in-net.aspx
Like my grandfather said : Better answer is available if you search for it.
Posted by dotnetinfo on March 12, 2009
I thought split and save blob is a great idea until i found the link
http://blogs.microsoft.co.il/blogs/gilf/archive/2009/02/05/back-to-basics-zip-in-net.aspx
Like my grandfather said : Better answer is available if you search for it.
Posted in C#, Database | Leave a Comment »
Posted by dotnetinfo on March 12, 2009
In one of projects we use extensive amounts of javascripts to modify HTML on runtime. It is very difficult to troubleshoot ex: when an user says we see a small white color shade on the right side of the screen whatever code we check in visual studio will not provide an answer.
Now comes a tool that helps it is call IE Developer ToolBar from Microsoft- http://www.microsoft.com/downloadS/details.aspx?familyid=E59C3964-672D-4511-BB3E-2D5E1DB91038&displaylang=en
good tool to help and increase your productivity. Thanks
Posted in C#, Tools | Leave a Comment »
Posted by dotnetinfo on March 12, 2009
I had tried to install MVC RC 2.0 process failed because of unknown errors. I got frustrated, lucky me Phil Haack article explanined the issue http://haacked.com/archive/2009/03/06/hotfix-for-installing-aspnetmvc.aspx
I uninstalled clone detective MVC installed ok and i am able to create a project.
Thanks
Posted in C#, MVC | Leave a Comment »
Posted by dotnetinfo on February 10, 2009
I was assigned to write a code to evaluate some rule and role based data from database and create entitlements.
I thought it will be easy process to eval the string expressions, then i came to know c# (2.0) does not have eval .. Do i need to write my own compiler..
Noooo google is your friend i came across the code that matches my requirement:
http://www.egilh.com/blog/archive/2006/10/02/3062.aspx thanks eglih.
I modified 2 lines of code as mentioned in the document
CodeDomProvider provider = CodeDomProvider.CreateProvider(“JScript”);
…..
CompilerResults results;
//results = compiler.CompileAssemblyFromSource(parameters, _jscriptSource);
Posted in C# | Leave a Comment »
Posted by dotnetinfo on October 29, 2008
What method to follow to save a BLOB from .NET to Oracle if the content is more than 32K?
If the content is a string convert the string the Bytes System.Text.
Encoding.ASCII.GetBytes(stringValue) and Split the Binary to 32k chunks using append logic to add or update
ex: First time calling the chunk insert then update
Posted in C#, Database | Leave a Comment »
Posted by dotnetinfo on October 29, 2008
The article explains how to use reflection to view resource data or how to use verbs to display design time help documents
As always thousand ways to implement something so use the document as a path not as a pattern
Step 1 : Create a HTML/XML/ …. file and Set Build Action to Embedded Resources
Step 2 : Create a windows form with the example code to read the data from assembly
private void LoadData(string ResourcePath)
{
try
{
if (!String.IsNullOrEmpty(ResourcePath))
{
Assembly assembly = Assembly.GetExecutingAssembly();
StreamReader sr = new StreamReader(assembly.GetManifestResourceStream(ResourcePath));
if (sr == null)
MessageBox.Show(“Resource is null for “ + ResourcePath);
string partialContent = sr.ReadToEnd();
DataDetails.Text = partialContent;
GenericHelp.ActiveForm.Activate();
}
else
{
MessageBox.Show(“ResourcePath not assigned for display”);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
}
Step 3: In VersionControlDesigner in Designers add a new control desginer
public class SomeControlDesigner : ControlDesigner
{
public override System.ComponentModel.Design.DesignerVerbCollection Verbs
{
get
{
DesignerVerbCollection v = new DesignerVerbCollection();
v.Add(new DesignerVerb(“Help link”, new EventHandler(HelpVerbHandler)));
return v;
}
}
private void HelpVerbHandler(object sender, System.EventArgs e)
{
OpenForm();
}
// write process to open web form
private void OpenForm()
{
// Resource Path need to be passed with intialization
GenericHelp gh = new GenericHelp(“Full file name – Case Sensitive”);
gh.ShowDialog();
}
Step 4 : In SomeControl.cs add a attribute –
[Designer(typeof(NameSpace.SomeControlDesigner))]
Step 5 : In Designer mode , view property window you will see a link and Click on the link will open window form
Posted in C#, Design Time, Reflection | Leave a Comment »
Posted by dotnetinfo on September 10, 2008
.NET 2.0 provided an attribute to add to custom control. The Attribute used for the Help Link is Designer. The Designer is used in calendar control to create custom links. The idea can be used in multiple ways. The code explains an idea how to create help links on your custom controls.
Note: Code is not a complete code; the code provides an idea how to achieve the functionality. I might have renamed some objects to hide proprietary company names.
[Designer(typeof(CustomLabelDesigner))]
[HelpAttribute("http://internalsite.company.com/CustomLabel")]
public class CustomLabel : System.Web.UI.WebControls.Label
In CustomLabelDesigner.cs Inherited from ControlDesigner
public class CustomLabelDesigner: ControlDesigner
{
……………
…………..
………….
public override System.ComponentModel.Design.DesignerVerbCollection Verbs
{
get
{
DesignerVerbCollection v = new DesignerVerbCollection();
v.Add(new DesignerVerb(“Help link”, new EventHandler(HelpVerbHandler)));
return v;
}
}
private void HelpVerbHandler(object sender, System.EventArgs e)
{
// Creates a new form.
CustomLabel myLabel = new CustomLabel ();
// Gets the attributes for the collection.
System.ComponentModel.AttributeCollection attributes = TypeDescriptor.GetAttributes(myLabel);
//retrieve HelpAttribute
HelpAttribute attrib = (HelpAttribute)Attribute.GetCustomAttribute(typeof(CustomLabel), typeof(HelpAttribute));
//Display Data
System.Diagnostics.Process.Start(attrib.Url.ToString());
}
………………
Add a new HelpAttribute.cs
using System;
using System.Collections.Generic;
using System.Text;
namespace SomeName.Company.Code
{
[AttributeUsage(AttributeTargets.Class)]
class HelpAttribute : System.Attribute
{
public readonly string Url;
public HelpAttribute(string url) // url is a positional parameter
{
this.Url = url;
}
}
}
Pictures :
Posted in C# | Tagged: C#, Design time Support, Verbs | Leave a Comment »