How to use DataGrid in Silverlight

by Naveen 5. February 2010 06:58
DataGrid is one of the most important control when it comes to displaying tabular kind of data. We all implement rendering of such data in some of table format. Developers who has been using ASP.Net are very familiar with controls like DataGrid and GridView. Good news is that there is equivalent DataGrid control for Silverlight as well. And for most part it is used the same way as you do in ASP.Net but with different syntax and different way of customizing display of it. In this post I am going to show a very plain and simple use of DataGrid control in Silverlight and then in subsequent posts I will build on top of this post to show some more advanced uses of DataGrid control.

Silverlight Tool Kit

You may already know this and already has it on your development machine, but I will mention it for sake of completness. You are going to need Silverlight Toolkit to use DataGrid. Yes, the control is not part of core Silverlight. Microsoft has developed it as part of the tool kit that has lot of usefull controls. You can read more about this tool kit and controls on the site. For now, down the toolkit and install it on your machine.

Reference assemblies

In your Silverlight project, you will need to add reference to System.Windows.Controls.Data assembly. This is the assembly where DataGrid control is defined. Now you can include DataGrid control on your XAML file. If you tried to add mark up like below on your page, you are going to get error telling you that DataGrid is not recoganized.


<DataGrid x:Name="MyGrid" />

You have to treat DataGrid control like a UserControl in ASP.Net where you have to specify a tag prefix and assembly on top of your page to indicate use of that control. In Silverllight you do this my including xml namespace tag for that silverlight control. In my case I have the following xmlns entry on my XAML file.


xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"

This tells the application that I am going to use prefix data for the controls that are present in assembly System.Windows.Controls.Data. Based on this you can now add the following like of mark up on XAML file to include DataGrid on your page.


<data:DataGrid 
  x:Name="CommentsGrid" 
  Height="300" 
  AutoGenerateColumns="True" 
  IsReadOnly="True">
</data:Grid>

Attach To Data Source

Now that we have included DataGrid control on the page, we need to attach it to some data source to show some results. Very much like ASP.Net, you will attach an enumeration to this control. The difference is that here it is done through property name ItemSource. Following line of code shows how it is done for silverlight DataGrid control.


List _unmoderatedComments = new List();

void BindGrid()
{
 CommentsGrid.ItemsSource = _unmoderatedComments;
}

As you can see that DataGrid is bound to a List of Comment objects. So far so good, very much like your ASP.Net DataGrid or GridView.

Columns to Display

In the mark of DataGrid above, I have explcitly set AutoGenerateColumn property to true. This actually is default value. What this means is that when DataGrid is bound to the collection, it will generate column for each data field or property for the objects in the collection and display them. Thsi is same behavior you see in ASP.Net data grid.

Explcitly specifying Columns

When you are dealing with some real application most of the time you control the columns you want to display and how you want to display them. Silverlight DataGrid does allow you to do so. Fisrt, you will set AutoGenerateColumns property to false. Following mark up shows how you will specify the columns that you want to display.


<data:DataGrid x:Name="CommentsGrid" Height="300" 
  AutoGenerateColumns="False" IsReadOnly="True">
 <data:DataGrid.CellStyle>
  <Style TargetType="data:DataGridCell">
  <Setter Property="VerticalAlignment" Value="Top"></Setter>
  </Style>
 </data:DataGrid.CellStyle>
 <data:DataGrid.Columns>
  <data:DataGridTextColumn Header="Comment Date" 
    Binding="{Binding CommentDate}"></data:DataGridTextColumn>
  <data:DataGridTextColumn Header="Comment Text" Binding="{Binding Text}">
  <data:DataGridTextColumn.ElementStyle>
  <Style TargetType="TextBlock">
   <Setter Property="TextWrapping" Value="Wrap"/>
  </Style>
  </data:DataGridTextColumn.ElementStyle>
 </data:DataGridTextColumn>
 <data:DataGridTemplateColumn>
  <data:DataGridTemplateColumn.CellTemplate>
   <DataTemplate>
    <StackPanel Orientation="Horizontal">
     <Button x:Name="ApprovedButton" Content="Approved" 
       Click="ApprovedButton_Click" Height="30" Margin="3"></Button>
     <Button x:Name="DeleteButton" Content="Delete" 
        Click="DeleteButton_Click" Height="30" Margin="3"></Button>
     <Button x:Name="SpamButton" Content="Mark Spam" 
       Click="SpamButton_Click" Height="30" Margin="3"></Button>
   </StackPanel>
   </DataTemplate>
  </data:DataGridTemplateColumn.CellTemplate>
 </data:DataGridTemplateColumn>
 </data:DataGrid.Columns>
</data:DataGrid>

You will need to add Columns section under your DataGrid control definition and then specify each column that you would want to display. And to bind the column to particular property or field, you will use Binding property. For this post I am going to keep the dicussion to simple binding of the column to property of the object. I will discuss more advanced use in subsequent posts. You can see it is very similar to how you are used to doing things in ASP.Net.

And to accomodate more customized view of the column, you will use DataGridTemplateColumn where you can layout the template of the view of that column. This is also similar to template column in ASP.Net.

More...

For this post I am going to leave this discussion to this simple display of data. I will be discussing more about use of Silverlight DataGrid in subsequent posts. This post should get you started with use of it now.

Views: 58

Tags: ,

DataGrid | Silverlight

How to customize Privacy Statement and Terms and Conditions pages in DNN

by Naveen 1. February 2010 06:53

While developing a web site for one of my clients, I needed to put custom Privacy and Terms & User page. After digging around I found that the text that gets displayed on these pages from default implementation of Privacy and Terms control is saved as resource in resources. When I went to look at the page where you enter the text I got ticked off. There was a tiny square text box where you needed to put the text. Yes, I know I could create the HTML for those pages in some nifty HTML editor like Expression or Dreamweaver and then paste it there. That worked fine but then there was another issue. I needed to show a common module on all pages. This default implementation did not do it for me even though I had marked a module to show on all pages of the site.

If you hover on Privacy and Terms of user link, you will see that it is pointing to pages Privacy.aspx and Terms.aspx. Then it clicked to me that if I add new pages into the system with names Privacy and Terms it may override the default implementation.

I created two new pages in the system with the names Privacy and Terms and it worked. Since I did not want these pages to be showing as menu options in top or other navigation bars, so make sure that when you add these new pages you check off the option of not including them in menu.

Views: 124

Tags: ,

DotNetNuke

WCF Error - The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state

by Naveen 15. January 2010 11:37

While working on a WCF service, I ran into the following error.


The communication object, System.ServiceModel.Channels.ServiceChannel,
cannot be used for communication because it is in the Faulted state.

This occurred when called Close method on instance of my WCF service client object. For a moment it took me by surprise. The code has been working fine and I was doing the right thing of closing connection to my WCF service after I was done using it. When I looked at the stack trace, I realized that it got thrown from a finally block of a method where I was calling a method on my WCF object. And before that there was an exception thrown. After further investigation it turned out that my WCF service was not running. So when I called method on the object, I got EndpointNotFoundException exception thrown when method was called. And in the same exception handling block I tried to call Close on client object. Since the client was already in bad state so next exception was thrown. So as a best practice, before you call Close method on your service object, check if its in Open state or not. This is exactly like a database connection object where you can check if its in open state or not. The following code snippet shows the change that I made to check for state of the WCF client object.


if (_serviceClient.State == CommunicationState.Opened)
{
 _serviceClient.Close();
}

Views: 410

Tags:

WCF

How to hide navigation controls on Bing Map Silverlight control

by Naveen 7. January 2010 17:25

Default rendering of Bing Map Silverlight Control displays few of the in-built controls like Copyright, Scale, Navigation, Logo etc. If you are not interested in displaying any of these controls, you can simply hide it by setting their visibility. Following code snippet shows how to hide these navigation controls.


void SetMapForgroundMembers()
{
 UserLocationsMap.NavigationVisibility = System.Windows.Visibility.Collapsed;
 UserLocationsMap.LogoVisibility = Visibility.Collapsed;
 UserLocationsMap.CopyrightVisibility = System.Windows.Visibility.Collapsed;
 UserLocationsMap.ScaleVisibility = System.Windows.Visibility.Collapsed;
}		}

Views: 282

Tags: ,

Silverlight

Unable to open the physical file. Operating system error 5: "5(Access is denied.)". (Microsoft SQL Server, Error: 5120)

by Naveen 6. January 2010 15:18

Recently I upgraded my development machine to Windows 7 and moved all daatabase files to it as well. When I tried to attach one of the database to SQL Server 2008, i got the following error.

Unable to open the physical file. 
Operating system error 5: "5(Access is denied.)". 
(Microsoft SQL Server, Error: 5120)

The error is very clear that it has everything to do with file system permissions on the database file. I searched around for answers to why SQL Management Studio is having issue although I am logged in as administrator on my machine. All the search results hinted that account under which SQL server is running does not have enough previlleges. So I was like so I just need to set appropriate permissions on MDF and LDF or any other database related files. The most dreaded suggestions that came across were people suggesting to give Full Control to the user account on the database folder(s). I am not going to go into discussion about this here why this is just bad. Lets just say that I am not a big fan of giving blanket full control permissions to user accounts to sensitive files without understanding what it means.

My SQL server instances were running under Network Service account. So I looked at the properties of the database folder and database files. And changed the permissions. Well that did not work. Since the error is very clear about the problem, it was time to do some old school debugging of problem. Since the error is related to file system, so it was time to fire up my good old Process Monitor tool. Now I was going to watch for Access Denied error when my database file was going to be accessed.

process monitor

What user account is used to access the database file?

If you can find the answer to this question, then all your problems are solved. So this is where Process Monitor is going to help. Start Process Monitor and try to attach the database file. Now capture the results from Process Monitor. You definitely will want to filter the results to include the entry related to your database file only. See the following image where the last entry for my database file has STATUS code of Access Denied. This is what I was looking for. Now double click on this entry and it will bring up details about that I/O operation. The following image shows the account that is being Impersonated to access this file. Yes, impersonation. When you start SQL Management Studio, it asks what kind of authentication you want to use. If you select currently logged in user or Windows Authentication that means SQL Management Studio is going to take all action on your behalf when accessing operating system resources.

sql server manager impersonation account

Fix It

Now you have two options to fix your problem.

  • If you are going to use Windows Authentication for SQL Management Studio, then you need to fix permissions on the database files to include that user with appropriate rights.
  • If you are going to use SQL Authentication, then make sure that account under which your SQL Server (and not SQL Management Studio) runs has correct set of permissions to access the physical files.

Making the above change should fix your problem and you will be able to attach the database without any errors.

Views: 517

Tags:

SQL Server

How to use Bing Map Silverlight Control and add push pins for location markers

by Naveen 6. January 2010 07:35
Bing map silverlight control sdk

In one of my earlier posts Convert IP Addresss To Geo Location, I discussed how you can query a web service or database to get geo-location of that internet service provider. Now what do you do with that geo-location or spatial information. For one of the current Data Visualization projects I am working on, I had to show these locations on the map as well. The application is a Silverlight application so obvious choice was to find a control or component that I could drop in silverlight. And you pretty much have the answer, Use Bing Map Silverlight Control.

In this post I am going to discuss some of the following topics.

  • How to use Bing Silverlight Map Control?
  • How to add push pins to bing map?
  • How to add legends or some text to Silverlight Bing Map?
  • How to add regular silverlight controls on Bing Map control?

The documentation for Bing Map Silverlight control is still maturing and lacks lot of details. So most of the discussion in this post is based on personal experience and conversations I had through news groups and forums.

Set up development enviroment

Before you can start developing your silverlight application using Bing Map Silverlight control, you will need to do following things.

  • Create a developer account at Bing portal
  • As part of registration process, you will also be required to a credential key that is used with each request that you send to Bing web service to access data.
  • Download Bing Map Control SDK and install on your development machine.

Create Project and lets roll

Microsoft has provided a good walk through on Creating a Basic Application Using the Silverlight Map Control. I will strongly recomment going through it if its first time for you in Bing Map development.

Adding PushPin to Bing Map

Now that you have a vanilla implementation of map showing in your application. Next I want to add indicztors on the map to show location of internet service providers for which I have geo corodinates. There are few ways you can do. The most basic thing that you need to keep in mind is that Bing Map control is like any other silverlight control and can act as a container for other silverlight control. That means that I can just draw any shapes or objects at given corodinates. Well, you got it. Bing Map SDK provides some of these indicator controls out of the box. And one of them is PushPin. So what you need to do is crate instances of PushPin objects, set their longitude and latitude and add them as children of map control. Following code snippet shows how I added a collection of PushPin objects to my map control.

foreach(var loc in locations)
{
	var pp = new Pushpin() 
	  {Location = new Location(loc.Latitude, loc.Longitude)};
	UserLocationsMap.Children.Add(pp);
}

Adding DataGrid to Bing Map

Next task I had to do was to provide some summary of the data on the map itself. More precisely, I wanted to show how many service provides from each country I have in my database. For demo purposes I just needed to show name and count. I decided to add a DataGrid to map to show this data. Later on I am going to handle click events in this grid to have some interaction with the map as well. Since I already knew where I wanted to place the grid and what columns needed to be shown, I could just add this through XAML file itself. Following XAML snippet from the application shows how I have added a text block and data grid to Bing Map control as children.


<m:Map CredentialsProvider="xxxxxxxxxx" Name="UserLocationsMap">
 <m:Map.Children>
  <o:ShadowText x:Name="MapTitleText" ForegroundTop="Black" ForegroundBottom="Orange"
      Text="ISP Locations" FontFamily="Verdana" FontSize="24"
      HorizontalAlignment="Left" Margin="20,75,50,10"/>
	<StackPanel x:Name="CountryListPanel" Margin="20,250,50,10" Orientation="Vertical">
	 <data:DataGrid x:Name="CountryCountGrid" Width="150" Height="250"
	   AutoGenerateColumns="False" HorizontalAlignment="Left">
	  <data:DataGrid.Columns>
	   <data:DataGridTextColumn Header="Country" Width="SizeToHeader" Binding="{Binding Name}" />
	   <data:DataGridTextColumn Header="Count" Width="SizeToHeader" Binding="{Binding Count}" />
	  </data:DataGrid.Columns>
	 </data:DataGrid>
	</StackPanel>
	</m:Map.Children>
</m:Map>

Postioning on Map control

This is something you will have to play very close attention to. There is a difference between how controls or objects placed on map control. You must have noticed that when I added PushPin to map, I used longitude and latitude to position them on the map. But when I added DataGrid and ShadowText controls, I used Margin to control the placement. Most of the indiccator or layer objects that are provided in Bing Map SDK use gro-location values (longitude and latitude) to place object. But when you add regular silverlight controls on map, then you will control the position using Margin relative to origin of map control.

Views: 605

Tags: ,

Bing Map | Silverlight

How to set silverlight column chart style programatically

by Naveen 4. January 2010 14:31

Let me wish a happy new year to all our blog readers.

This is first post of year 2010 and I decided to write my favorite topic of all times, Data Analysis and Visualization. These days I am working on a Silverlight application that involves very extensive use of charts for data visualization. And I use charting controls provided by Microsoft in Silverlight tool kit.

There are lot of examples available out there that shows you how to use these controls and how to style them. When it comes to styling and things like that, majority of the examples are focused around modifying control template or modifying styles in XAML file itself. Lot of time you make decisions about the type of chart and style of chart at run time based on data that needs to be visualized.

In this post I am going to focus on following tasks:

  • How to add a chart series programatically
  • How to set style of chart series programtically
  • How to set colors of columns in silveright charts programtically

Following image shows you a multi-series column chart. It shows three types of values at different intervals. One of the driving factor behind adding the column series was that I did not know how many different types of values are going to be returned in the data. So I could not simply add X number of ColumnSeries on XAML to say that I need to draw multi-series column chart with 3 points or things like that.

silverlight multiseries column chart

Following code snippet shows how I added column series in the main chart controls and how I specified different colors of the bars that are going to represent each type of data point.


foreach(LatencyColumnPlotData plotData in _latencyDataValues.ColumnPlotValues)
{
var series = new ColumnSeries();
var style = new Style(typeof (ColumnDataPoint));
SolidColorBrush bgBrush = (idx==1) ? 
    new SolidColorBrush(Colors.Blue) : 
    new SolidColorBrush(Colors.Orange);
var setterBg = new Setter(ColumnDataPoint.BackgroundProperty, bgBrush);
style.Setters.Add(setterBg);
series.DataPointStyle = style;
series.ItemsSource = plotData.DependentValues;
series.IndependentValueBinding = null;
series.Title = (idx == 1) ? "Average" : "Current";
idx++;
latencyChart.Series.Add(series);
}

var thresholdSeries = new ColumnSeries();
thresholdSeries.IndependentValueBinding = null;
thresholdSeries.ItemsSource = _latencyDataValues.ThresholdLatencyValues;
thresholdSeries.Title = "Threshold";
var bg = 
   new Setter(ColumnDataPoint.BackgroundProperty, new SolidColorBrush(Colors.Green));
var bgStyle = new Style(typeof(ColumnDataPoint));
bgStyle.Setters.Add(bg);
thresholdSeries.DataPointStyle = bgStyle;
latencyChart.Series.Add(thresholdSeries);

Views: 565

Tags: , ,

Silverlight

Online DNN Dotnetnuke API Help

by Naveen 28. December 2009 07:41

Every time I am doing custom DNN module development, one thing will bug me all the time is having access to DNN Core API documentation. A lot of time I do not have access to local CHM file for help. That's when I used to wish if I had some place where online help is available for core api. So this x-mas i decided to be my own Santa Clause and give myself gift of online DNN core api help site. So here it is, You can click on the following link to visit my site where I have hosted DNN 5.2 Core API Help Documentation


Views: 424

Tags: ,

DotNetNuke

How to find current logged in user in DotNetNuke

by Naveen 18. December 2009 05:33

While developing DotNetNuke modules a lot of time you need to add features that have role based access control. To authorize the access, you will need the following set of information about the current user.

  • Is it authenticated session or anonymous user?
  • If its authenticated, who is the user?
  • What role(s) this user belongs to?
  • And other permissions related about information about the user

If you are not very familiar with DNN core API, then getting this information is not very obvious. And lack on online documentation of DNN API kind of makes it hard to search API as well. The API is very well done and has appropriate method names. But if there was an index, then it will be just quickly searching and getting the information.

Anyways, in DNN core, look in DotNetNuke.Entities.Users namespace. You will find two very useful classes UserController and UserInfo classes. As you may have guessed, these are two objects that you need to get user information. UserController has a static/friend method GetCurrentUserInfo that returns a UserInfo object. You can inspect this returned object to get more details about the user. For example, following code snippet shows how to find current logged in user in DNN and if this user is in particular role or not.


Dim userInfo = UserController.GetCurrentUserInfo()
if (userInfo.IsInRole("Manager")) Then
' Do some manager related work here
End If

You can explore UserInfo object to see what all you can do with it. Here is another example code that shows how to find all the roles of a user in DNN.

Dim userInfo = UserController.GetCurrentUserInfo()
Dim userRoles = userInfo.Roles

As you can see, the method names are very intutive and implemented at right place. Its just matter of knowing where to look for. If you have any questions about any DNN API, please feel free to drop me a line.

Views: 539

Tags: ,

DotNetNuke

How to insert emoticons into google wave

by Naveen 8. December 2009 06:14
emoticon in google wave

This is .Net implementation of recently published python Google Wave robot supasmiley. This is a very simple robot that parses the text in a blip. If there is some text that matches standard character combination for emoticon display, it replaces that text with a google wave gadget to display graphical display. In this example, the robot is only looking for character combination <3. If it is found, the range of characters are removed and gadget is inserted. The gadget is a simple flash movie that display beating heart.


 void ProcessEmotions(IEvent e)
 {
  var txtView = e.Blip.Document;
  var txt = txtView.Text;
  var idx = txt.IndexOf("<3");
  if (idx == -1)
  {
    return;
  }
  txtView.Delete(new Range(idx, idx+2));
  txtView.InsertElement(idx, new Gadget("http://wave.byteblocks.com/emotions-gadget.xml"));
}

Try It

  • Add byteblocks-emotions@appspot.com into your contact list.
  • Start a new wave or you can choose an existing wave
  • Add byteblocks-emotions@appspot.com as participant in the wave.
  • Enter text and where you want to show beating heart, type <3
  • ... like the heart now....

Download Sample Project

Views: 543

Tags:

Google Wave

How to set axis properties programatically for Silverlight charts

by Naveen 7. December 2009 06:23

In my previous post How to hide gridlines in charts, I showed how you can accomplish the task from XAML. This is all good when you know that rendering behavior of you chart is not going to change or you do not have to modify the display at run time based on some computed values curing run time. And works great for design time as well. But a lot of time you want to change the behavior at run time. In that case you need to know how you can change properties of axis programatically.

Each chart has a collection of Axis. By default this collection is empty. Charting controll fills this collection if you do not provide any. And it makes it decision based on the type of values you render on these axis. For example tf you are displaying DateTime type values on an axis, control will add DateTimeAxis to its collection. I have two liner axis in my chart that display simple numeric values. Following code shows how I added two linear axis, X and Y, to my chart. Most important property to set is Orientation. Without it, rendering engine does not know what axis you intend to change.


private void SetYAxis()
{
  var lax = new LinearAxis();
  lax.ShowGridLines = false;
  lax.Orientation = AxisOrientation.Y;
  lax.Title = "Response Time";
  myChart.Axes.Add(lax);
}

private void SetXAxis()
{
   var lax = new LinearAxis()
              {
                ShowGridLines = false,
                Title = "Interval",
                FontWeight = FontWeights.Bold,
                MaxHeight = 1,
                Opacity = 0,
                Orientation = AxisOrientation.X
               };
   myChart.Axes.Add(lax);
}

Views: 573

Tags: , ,

Silverlight | Charting

How to hide grid lines in Silverlight chart?

by Naveen 7. December 2009 05:53

This is one of the thing that is easy to do but no so obvious. I think mostly its lack of complete description of how charting controls provided in Silverlight toolkit work and how to manipulate them. When you draw charts like Line, Column, Bar etc., the grid line on DependentValue are rendered by default. There is a property ShowGridLines available on DisplayAxis class that is base class for axis. You just need to set its value to False. For example in my line chart I did not want to show grid lines on grid lines on Y axis. Following XAML snippets shows how I turned off rendering of grid lines on Y-axis.


<chartingToolkit:Chart Title="Latency" x:Name="latencyChart" BorderThickness="1">
 <chartingToolkit:Chart.Series>
  <chartingToolkit:LineSeries Title="Val 1" 
     DependentValueBinding="{Binding Threshold}"
     IndependentValueBinding="{Binding IndependentValue}" 
     AnimationSequence="Simultaneous" />
  <chartingToolkit:LineSeries Title="Val 2Latency" 
   DependentValueBinding="{Binding Current}" 
   IndependentValueBinding="{Binding IndependentValue}" 
   AnimationSequence="Simultaneous" />
  <chartingToolkit:LineSeries Title="Val 3" 
   DependentValueBinding="{Binding Average}" 
   IndependentValueBinding="{Binding IndependentValue}" 
   AnimationSequence="Simultaneous" />
  </chartingToolkit:Chart.Series>
   <chartingToolkit:Chart.Axes>
    <chartingToolkit:LinearAxis Orientation="Y" ShowGridLines="False"/>
  </chartingToolkit:Chart.Axes>
</chartingToolkit:Chart

Views: 553

Tags: , ,

Charting | Silverlight

Creating Email Rules Made Easy In Outlook 2010

by Naveen 4. December 2009 05:56

Yesterday I reconfigured my laptop and got myself fresh install of Windows 7. First thing I want to do on my machine is to get set up with my email client which happens to be Microsoft Outlook. I have been using Outlook 2007 for quite some time. I realized that I have a beta testing invite for Office 2010 sitting in my inbox from Microsoft. So I decided to give it a spin.

Download and install of Office 2010 went smooth. That was a good start. Now came time to configure my gazillion email accounts in email client. Having subscribed lot of development and technology news groups I get few thousand emails and it is always a challenge to organize them appropriately. So I rely very heavily on rules in Outlook. I always disliked Rules wizard in Outlook. I have to go through so many steps to create a simple rule. Only thing I want is simple one click operation that will set up rule like "move email from X to folder Z all the time". So I was looking around for my tool bar to see where rules wizard is. So there was a change for me. Now this Rules button is available in Move group of tool bar buttons. But I saw a small arrow below the button. I clicked on it and I was just thrilled. There is what I have been looking for all the time... One click option to set simple rule. By click of one button I was able to set up a simple email move rule. You can see the simple steps as shown below.

  • Find Move group of buttons in Outlook tool bar.

  • Click on the arrow below Rule button and it will bring up a simple menu below it. And select you rule condition.

  • Now select the folder where emails are to be moved. And you are done.

I could not ask for any thing more simple than this.

Views: 548

Tags:

Microsoft Outlook

Partition Wizard - Free Disk Partition Software Review

by Viper 1. December 2009 06:14

For quite some time I have been thinking of creating a new partition on my laptop to dual boot Windows 7 on it. Well I wanted to only have Windows 7 on it but I kept Windows XP on it because Aventail VPN client software will not work on Windows 7. Well, that's a whole different story for some other time.

So this morning I decided to use one of the partition manager softwares to create a new partition from unused 150GB disk space I have on my 250GB disk on may Dell LATITUDE E6500 laptop. After searching around using Bing and Google I came across Partition Wizard and to my surprise they offer free edition for home and well as business use. I was kind of surprised but thrilled that there is some free utility available to repartition my disk. There is difference between spending $49 or $0.

I had to make judgement call. I reviewed files on my laptop and found that most of my critical data including emails are all backed up so I could take a leap of faith. So I went ahead and downloaded the home edition. It was nice that I only had to download 6.7MB file and not 130MB+ file like some other softwares have. Installation was quick and easy. And I did not have to reboot the system as well. So far so good.

I started the GUI for Partition Wizard. It looked well organized and intuitive. I choose my one and only partition and set to resize to create a new partition of 60GB. And then I hit Apply. As expected it asked for system restart. As a good user I said YES to restart.

When system restarted it gave the option that Partition Wizard is going to apply the changes and I have 5 seconds to opt out of it. Partition Wizard started its magic. It went through file system check. Now started resizing phase. It reached 77% of operation and then hit error and could not move forward. So it asked me to hit any key to continue. Machine restarted again and partition wizard launched again to resize the partition. Again it went up to resize phase and then stopped at 77%.

At this point, I did not want to try it again. I gave it two tries. I just could not risk Partition Wizard playing with my file system anymore. So on next reboot I skipped the process of partition resize and let machine boot with Windows XP. Immediately uninstalled Partition Wizard and rebooted the machine. One thing I was happy about Partition Wizard was that after removing the software it did not interfere with reboot process and things like that and my machine was clean again.

I will strongly recommend that you get opinion from users who have actually used Partition Wizard successfully before you try this free disk partition software on your machine. It did not work on two of my laptops. May be you will have better luck with it. But I would not risk it on machine that have mission critical data on it.

Views: 562

Tags: ,

Storage

How to debug DNN module

by Viper 17. November 2009 11:45

In last two posts, Setting up development environment and Implenting custom DNN module, I have described you will do custom DNN module development. Now comes the fun part. How are you going to debug your module. Since your module gets loaded inside DotnetNuke site, the debugging requires change in your project settings.

Need Debug Build

When you used NANT build tool to create package for deployment, it uses release build options. So the assembly for your module does not have DEBUG option turned on in your site. What you can do is that do a DEBUG build of your project and replace module assemblies in BIN folder of your DNN site with the DEBUG version. Or you can make some change in NANT build file for your project to create a DEBUG package and then deploy that. If you are not comfortable with NANT build file, then go with the first option I mentioned.

Change Project Setting

One option you have it to change target start URL that gets invoked when hit F5 or choose Debug > Start Debugging menu option. To do that, bring up Properties of module project. Goto Web tab on the dialog box. You can select Use local web server or Use custom web server radio button and then specify the URL for your DNN installation. Now you will be able to break into your module.

Attach to Process

Other option you have is to choose Debug > Attach to process menu option and then attach to ASP.Net process. And then put break points in your module to debug the problems.

If you are looking into debugging your DNN modules on live site then I will be discussing that in one of my later posts about how you can incorporate logging and diagnostics into your module.

Views: 834

Tags: , ,

DotNetNuke

How to develop DotnetNuke Module - Implementation of module

by Viper 17. November 2009 06:27

Download Module Project

In previous post Develop DotnetNuke Module - Setting up environment, I described how you will go about setting up your development environment. Now I will start discussion on developing a DNN custom module as stand alone assembly using C#. I have named this module as ByteBlocks: AmazonProducts. The module displays products from Amazon.com store based on product category and search keywords. For this to use in your web site, you will need to have an associate account with Amazon.com. This is totally free and you can get started by clicking here.

Click here to see this module in action


New Project

Select File > New > Project menu option to create new project. In my case, I named it AmazonProducts. This will create a new C# project for you. The project template adds lot of boiler plate code for you to get started. In this post I will explain the files that are absolutely basic to get started with module development. Before you start doing anything, run NANT build tool to make sure that your project compiles. And check that there is a folder named package under the project folder. And this folder should contain four ZIP files in it. If this step goes smoothly, that means you have your development set up correctly and you are ready to rock with module development.

Lets look at some of the files that got added to your project.

.dnn file

This is the file that defines metadata for your module. What this means is that this where you specify how your module is structured, files it contains and other settings. Open this file. This is a XML file. All the node names are very intuitive and very quickly you will figure out what these means. If you are building a single view and single assembly module then you will not have to make any changes under Controls and Files node. For more complex modules that require more files to be included and other things then you will be made to define those settings in these sections. For now, leave it the way it is. Make sure that you have name of the module specified that is relevant to functionality of your module.

View{projectname}.ascx

This is the file where you will implement VIEW of your module. What this means is that this is the control that gets loaded in DNN framework when users come to your site. If you open {projectname}.dnn file you will find a node under controls that looks as below.

<control>
 <src>DesktopModules/AmazonProducts/ViewAmazonProducts.ascx</src>
 <type>View</type>
 <helpurl></helpurl>
</control>

This is the node where you indicate to DNN framework what all controls are going to be used a view for the data. If you have multiple views for your module then you will need to add entries for those views in {projectname}.dnn file. I will explain in another post how you will deal with multiple views and how you will load them at run time based on their IDs and things like that. In this sample module I only have one view.

Settings{projectname}.ascx

This is the control that gets loaded when you invoke settings of a module. DNN framework loads your implementation combined with the base implementation provided by the framework to show settings for the module. If you do not have any custom settings for your module then you do not have to add any content to it. Also open {projectname}.dnn and notice that you have a node like below in there.

<control>
 <key>Settings</key>
 <title>AmazonProducts Settings</title>
 <src>DesktopModules/AmazonProducts/Settings.ascx</src>
 <type>Edit</type>
 <helpurl></helpurl>
</control>

Edit{projectname}.ascx

This is a very important control implementation in your module. If your control requires some input to configure it to run it, then you can use this control to implement gathering of those settings. For example in the sample module, you need to gather 2 very important pieces of information to get data from Amazon.com web service. The images below shows you how a new link Amazon Account Set up appears when you are logged in as an admin and clicking on it brings up a view where you can specify the settings for the module.

Open {projectname}.dnn file you will find a node as shown below.

<control>
 <key<Edit</key<
 <title<Edit Content</title<
 <src<DesktopModules/AmazonProducts/EditAmazonProducts.ascx</src<
 <type<Edit</type<
 <helpurl<</helpurl<
</control<

There are some very important points about how you indicate to DNN framework that this is the control that is going to be used for EDIT. One you have noticed in the DNN file that type has been set to Edit. Second is in your implementation. You have to implement IActionable interface in View{projectname}.ascx control. In that implement you indicate to DNN framework what all other actions can be performed by this module. The project template does not add boiler plate code for this interface in your module. You will have to add it yourself. For example, in the sample project the implementation of the class looks as below.

public partial class ViewAmazonProducts : 
   AmazonProductsModuleBase, IActionable
{....}

Add implementation

Now that you have set up the boiler plate code for your module, it is time to fill it with implementation. You will just go about the implementation as you are doing regular ASP.Net user control implementation. The sample project contains complete implementation of rendering product lists from amazon.com. This code was implemented during .Net1.1 days so lot of code may be obsolete and not optimized according to recent changes. But it will give you get started with your DNN module development.

Compile It

Now that you have finished adding implementation of your module, it is time to see it in action. You can use your Visual Studio to a build of the project and resolve any compile errors. Once all errors have been taken care of, fire up NANT build to create package for your module. You will notice four ZIP files created in package folder.

Install It

Once you have created package for your module, you are ready to install it in your DNN framework. Fire up DNN site and login with HOST account. Yes, you will need to log in as HOST. Once logged in, under HOST menu option, select Module Definitions option. This will bring up list of all modules installed in your installation. On that page at the top you will see a dropdown icon next to Module Definitions. Hover mouse on it and it will bring up menu options. Select Install module option as show below.

In the first step you will be asked to select location of your module package. Point to package folder under your project or wherever you copied the ZIP files created for your module. After that follow the instructions and you will have your module loaded and ready to use on any page in your site.

Use It

Once you are done with installation of module package, it shall be visible in list of modules available for your site. Just follow your usual steps of adding a module on any page on your site and you are good to go.

Debugging

In the next post, I will explain how you can go about debugging a DNN module.

Views: 891

Tags: ,

DotNetNuke

How to develop DotnetNuke Module - Setup Development Environment

by Viper 16. November 2009 14:20

This is multi-part series on how to write a custom DotnetNuke module as an independent assembly. This series is not about how to add content and configure containers, pages etc. in DNN framework. There are lot of resources available that explain those things in a very details manner. This series of posts are focusing strictly on module development. This post will get you started with getting your development environment set up.

Setting up development environment for DNN module development

I am going to focus mainly on developing DNN module using C#. It does not mean that these concepts do not apply to VB.Net or any other .Net languages. And also I do not have anything against VB.Net. It is just that my main development platform is C#.

Install DNN

First thing you will need is to have DNN site running on your local machine which you will be using to test your modules with. You can download the package from DotNetNuke web site. I will strongly recommend that you download source package instead of just the installation package. This will help you in debugging underlying DNN framework code as well or to step into the implementation to see whats going on. Once you have downloaded the package, follow the installation instructions to get your DNN site up and running on your local machine.

Install DNN Module Project Template

There are few templates available out there that you can download and install in your development environment to use with Visual Studio. I am using Visual Studio 2008 currently so all references I will mention are going to be be targeted to VS2008 environment. I have been using project template published by Engage. They have provided instructions to install it as well. I will put list the set up instructions here as well.

  • Close all instance of Visual Studio on your machine.
  • Save the downloaded project template ZIP file in C:\Documents and Settings\{user name}\My Documents\Visual Studio 2008\Templates\ProjectTemplates\Visual Web Developer. Note that this location is for VS2008 templates. Depending on how you have configured your Visual Studio installation, this location may be different on your machine. Very important that you do not unzip the template compressed file. It needs to be copied as a ZIP file. Otherwise your visual studio will not pick it up.
  • Start Visual Studio instance and select File >New > Project menu option. You should see the new project template installed under My Templates section as shown in picture below. dnn compiled project template

If you can not locate the project template files on Engage web site, let me know. I can try to provide you the template that I use. You will just have to deal with the modifications I have done to it to show my company name and things like that.

Install NANT Build Tool

The project template that you installed from step creates a NANT build file along with other files for module. This NANT build file helps in building and packaging your module correctly. You can compile the project without NANT build tool. But then you will have to make sure that you have packaged the required files. The NANT file generated by this template just takes care of all the steps. If there are some custom requirements, you can always open the NANT file to edit it. You can download latest NANT build tool from Sourceforge.

Now that you have basic infrastructure set up for module development, let's get started with creating our module project. I have created a module that is used to display products from amazon.com based on the product category and search keywords. You will be able to download the whole source for that module in the next post. So lets get started with it.

Developing Amazon.com Products Store Module

Views: 1053

Tags: ,

DotNetNuke

Work from home to make money Scam

by Viper 6. November 2009 16:53

Usually I do not write about these kind of topics. But today of my co-workers asked me about opinion on an advertisement she saw that advetised that you could make $300+/week by working for google from home. In tough economic times a lot of people tend to fall for these kind of statements. This person is well educated and works for an internet company. I asked her to forward me the link she saw. For a change I read throught the whole page. I will have to say that it was very eye catching and written to attract right kind of people.

At this point we all very well know about this infamous Google Money Making Kit which is being adevertised to be sold for $1.97. Here are some of the facts that I will list about this whole scam. Thanks to one of these sites, I found all the information in fine print.

  • $1.97is one time shipping fee or subscription fee you are paying to get started.
  • You have 7 days to cancel the subscription or you will be charged close to $300/month in subscriptions. I bet you did not know that part.
  • To cancel your subscription there is a phone number of mailing address. You can forget about getting to that number
  • Here is worst news. If you accidently do give your credit card number to these sites, your credit card company is not going to be of any help. They will ask you to cancel your credit card account to stop any further payments to them.

Following is fine print that I found hidden in source of the page. I will make it bigger so you could read at leas this part.

This publication provides the Author's opinions and neither the Publisher nor the author intends to render legal, accounting, financial, business or other professional advice with this publication. With regards to licensing of a business enterprise, any legal accounting or tax matters. Author and publisher is an Affiliate of the company offering the business opportunity and are remunerated by advertiser. Author and publisher strongly suggest that the reader seek the services of appropriate licensed business, financial and or legal professionals before proceeding with any actions and comply with the local, state and federal licensing and guideline requirements which the reader resides or conducts business.

Google is in no way associated with this website. The Publisher and Author disclaim any personal liability, loss or risk incurred as a consequence of the use and application of the offer, either directly or indirectly, of any advice, information, or methods presented in this publication. Individual comments are unedited and not the opinion of Author or Publisher and not liable for their comments and opinions.

*INCOME CLAIM WARNING: Testimonials do not result typical result. Photographs or images are depiction of individuals and payment methods. These income examples are representative of some of the most successful participants in the program. Some individuals purchasing the program Sept. make little or NO MONEY AT ALL. These claims are not a guarantee of your income, nor are they typical of average participants. Individual results will vary greatly and in accordance to your input, determination, hard work, and ability to follow directions. No person or company can guarantee profits or freedom from loss. Any and all use of this website certifies you are agreeing to our Earnings and Income Disclaimers.



Here is some more information from another site. Read the costs very carefully

THE STORY DEPICTED ON THIS SITE AND THE PERSON DEPICTED IN THE STORY ARE NOT REAL. RATHER, THIS STORY IS BASED ON THE RESULTS THAT SOME PEOPLE WHO HAVE USED THESE PRODUCTS HAVE ACHIEVED. THE RESULTS PORTRAYED IN THE STORY AND IN THE COMMENTS ARE ILLUSTRATIVE, AND MAY NOT BE THE RESULTS THAT YOU ACHIEVE WITH THESE PRODUCTS. THIS PAGE RECEIVES COMPENSATION FOR CLICKS ON OR PURCHASE OF PRODUCTS FEATURED ON THIS SITE.

We are not affiliated in any way with CNN, WebTV, News Channel 7, ABC, NBC, CBS, U.S. News or FOX. CNN, WebTV, News Channel 7, ABC, NBC, CBS, U.S. News and FOX are all registered trademarks of their respective owners. All trademarks on this web site whether registered or not, are the property of their respective owners. The authors of this web site are not sponsored by or affiliated with any of the third-party trade mark or third-party registered trade mark owners, and make no representations about them, their owners, their products or services.
"THE STORY DEPICTED ON THIS SITE AND THE PERSON DEPICTED IN THE STORY ARE NOT REAL. RATHER, THIS STORY IS BASED ON THE RESULTS THAT SOME PEOPLE WHO HAVE USED THESE PRODUCTS HAVE ACHIEVED. THE RESULTS PORTRAYED IN THE STORY AND IN THE COMMENTS ARE ILLUSTRATIVE, ANDMAY NOT BE THE RESULTS THAT YOU ACHIEVE WITH THESE PRODUCTS. THIS PAGE RECEIVES COMPENSATION FOR CLICKS ON OR PURCHASE OF PRODUCTS FEATURED ON THIS SITE."
INCOME CLAIM WARNING: Testimonials do not result typical result. Photographs or images are depiction of individuals and payment methods. These income examples are representative of some of the most successful participants in the program. Some individuals purchasing the program may make little or NO MONEY AT ALL. These claims are not a guarantee of your income, nor are they typical of average participants. Individual results will vary greatly and in accordance to your input, determination, hard work, and ability to follow directions. No person or company can guarantee profits or freedom from loss. Any and all use of this website certifies you are agreeing to our Terms and Conditions.


* S&H charges do apply. Results will vary by person, and the special offers may only be available for a limited time. Some of the products described on this site have terms regarding continued billing after the trial period ends. This is referred to as negative option, or continuity billing. Therefore, it is important to ensure that you are fully aware of the terms associated with each product before you order. To make this easier for you, we have included links to the billing terms for each of the products below. Please keep in mind that these are separate companies and we are not the best source for information about orders or specific policies. Because these companies control their own policies, shipping and other fees may change periodically. We have linked away from our website directly to their terms and conditions pages.

For the convenience of our readers, we have also included the billing information and cancellation contact info here:

*For Google Profits At Home: By submitting an order, You automatically receive a 7-day trial to the Start Up Kit Using Google. Your 7-day trial begins immediately upon placing your order. You will be billed $1.97 at the time of order submission. Once Your trial is active you have 7-days to decide whether to accept Your Subscription. Prior to the expiration of the 7-day trial period, You may cancel Your subscription by calling toll-free at 877-484-8016 or International customers please call 00-1-646-205-0216. Should You fail to cancel Your Subscription within the 7-day trial You will be billed $79.90 at the completion of the 7-day trial and every month thereafter for continued services and hosting of your Visual Webtools software unless canceled by You.

*For Online Cash Success Kit: Subscriber agrees to pay today the free trial shipping and handling fee of $1.97 to begin subscriber's trial membership. Subscriber has thirty days from the date of enrollment to cancel Trial membership by calling our customer care department at 1-866-995-9812 to cancel their trial subscription and to be issued an authorization number for return of the Online Cash Success Kit disc. Subscriber must clearly write the authorization number on the outside of the package and return the CD to the address given by the customer care department within thirty days from the date of enrollment or does not promptly return the disc with authorization number according to the terms above, Subscriber agrees to pay a one time fee of $99.00, which will be billed on Day thirty one from the date of enrollment. Once the free trial shipping and handling fee has been paid and once Subscriber does not cancel within the thirty day Trial period, the one time fee will be NON REFUNDABLE.
In addition, the subscriber will be provided access to an online Resource Center which will bill at $47.50 on the fifteenth Day from the date of enrollment and we will re-bill every thirty one days at $47.50 per month until cancelled by calling 1-866-995-9812. If for any reason, Subscribers credit card company refuses to pay the amount billed for the service, Subscriber agrees that we may, at our option, suspend or terminate the subscription to the service and require the Subscriber to pay the overdue amount by other means acceptable to us. We may charge a fee for reinstatement of suspended or terminated accounts. You have also been enrolled into a seven (7) day trial to the eBay Money Resource Center. Should you choose not to cancel your eBay Money Resource Center, you will be billed seven dollars and seventy one cents ($7.71) each month for the eBay Money Resource Center. If you wish to cancel your eBay Money Resource Center subscription, please call 1-800-215-1752 to cancel.

Views: 573

Tags:

General

How to programatically set meta tags on ASP.Net page

by Viper 5. November 2009 06:19

When we are creating a web site, one of the main goal we all have is that out site should be listed on first page of search engines like Google, Bing, Yahoo, Baidu etc. As we all know that in SEO world, one of the first thing we all look for in the page is meta tags in header of the page. In the past there was no direct way to set the meta tags on a page programatically when developing ASP.Net web site. We all used the work around of adding metaelements in header element of the page. You can read my previous post Adding meta tags to asp.net page dynamically about that technique. With ASP.Net 4.0 microsoft has introduced following two properties on that allow you to set the meta tags on a page.

  • MetaDescription
  • MetaKeywords

Following code snippet shows how it is used in your code.


public partial class _Default : System.Web.UI.Page
{
 protected void Page_Load(object sender, EventArgs e)
 {
  SetMetaTags();
 }
 private void SetMetaTags()
 {
  Title = "Hello Meta";
  MetaDescription = "This is description of my ASP.Net 4.0 page.";
  MetaKeywords = "ASP.Net,.Net4.0,Meta";
 }
}

And it works. You can see from the source of the page as shown below.

<head>
<title>Hello Meta</title>
<meta name="description" content="This is description of my ASP.Net 4.0 page." />
<meta name="keywords" content="ASP.Net,.Net4.0,Meta" />
</head>

Views: 446

Tags:

.Net | ASP.Net

Tricky - Implementing Halloween Google Wave Robot and Gadget Sample Using .Net

by Viper 3. November 2009 16:58

Download Sample Project

After doing some plain text Google wave robots implementations, it is time for some fun robot that has some graphical implementation to it. This post is about port of tricky python sample published by Google in their Google wave development resources. This robot uses Google wave gadget as well to display some images. So implementation of this robot will help you understand how Google wave gadgets get included in the wave and how you can add them from robot itself. I am not going to discuss implementation of gadget here. I will do it in my future post.

In one of my earlier posts Developing Google Wave Robots Using .Net i discussed fundamental steps in creating and deploying your Google wave robot. So I will refer you to reading that post if you have not done it already. So following those steps i created my new robot named byteblocks-tricky.

How to use and try it

  • Add byteblocks-tricky@appsot.com as participant in your contacts
  • Start a new wave and add byteblocks-tricky@appspot.com as one of the participants in the wave. As soon as you add it as participant, you will notice that title of your wave has changed and a graphical widget gets added to the document.
  • Start a new message and type trick or treat. It will randomly give your trick or treat and display an image for the item.

Implementation

This robot handles WAVELET_SELF_ADDED and BLIP_SUBMITTED. In WAVELET_SELF_ADDED handler, robot inserts a gadget into the wave. In BLIP_SUBMITTED the robot looks for text trick or treat in document. If it finds it, it randomly decided if you are going to get tricked or get a treat. Then it searches Google images for appropriate image for that item and then inserts that image into the document.

Have fun with trick or treat.

Views: 477

Tags:

Google Wave

Powered by BlogEngine.NET 1.5.1.7
Theme by Naveen Kohli

Recent

By Categories