Friday, July 30, 2010

Outlook 2010/IMAP/Google Apps

With Outlook 2010 over IMAP to Google Apps/Gmail, the default setting is that when you delete an item, it is moved into ‘Trash’ instead of archived. This is a problem if you count on having those Archived items out there for future reference. (Trash is discarded after 30 days).

To change this:

  • Click on File/Account Settings
  • Doubleclick the e-mail account you want to change.
  • Click More Settings
  • Go to the Delete Items Tab
  • Select '”Move deleted items to the following folder”
  • Select the “All Mail” folder in the Tree View. image
  • Click OK
  • Click Next and let it finish the setup.

That should do it. Now all deleted items will be Archived.

Thursday, July 8, 2010

Restoring a Windows State When Navigating Back to a Page

When navigating to another page and back again using the Silverlight Navigation Framework, sometimes it is useful to return to the page and see it exactly as it was.  Fortunately, this is easy to do if you are using an MVVM framework. 

When navigating away from the page, save the ViewModel in the App.Current.Resources collection.


protected override void OnNavigatedFrom(NavigationEventArgs e)
{
if (App.Current.Resources["theViewModel"] != null)
App.Current.Resources.Remove("theViewModel");
App.Current.Resources.Add("theViewModel", this.DataContext);
base.OnNavigatedFrom(e);
}

When returning to the page, pull it back out again and assign it to the page.


         protected override void OnNavigatedTo(NavigationEventArgs e)  
{
if (App.Current.Resources["theViewModel"] != null)
this.DataContext = App.Current.Resources["theViewModel"];
}

Thursday, June 24, 2010

Syntax for programmatically retrieving a recordset from RIAServices

         private ObservableCollection<MyEntity> _MyEntityList;  
public ObservableCollection<MyEntity> MyEntityList
{
get{ return _MyEntityList; }
set
{
_MyEntityList = value;
RaisePropertyChanged("MyEntityList");
}
}

public void LoadData()
{
_Context.Load(_Context.GetMyEntityQuery(), LoadBehavior.RefreshCurrent,
DataLoaded, null);
IsBusy = false;
}

public void DataLoaded(LoadOperation<MyEntity> loadOperation)
{
if (loadOperation.HasError)
{
System.Windows.MessageBox.Show(loadOperation.Error.ToString(), "Load Error", System.Windows.MessageBoxButton.OK);
loadOperation.MarkErrorAsHandled();
MyEntityList = null;
}
else
MyEntityList = new ObservableCollection<MyEntity>(loadOperation.Entities);
IsBusy = false;
}

Sunday, June 6, 2010

Increasing the size of a VHD

Increasing the size of a VHD file is done in two steps.
Step 1 is to increase the size of the file itself. That can be done with the VBoxManage utility found in the c:\Program Files\Oracle\VirtualBox directory.  Run the following:
VBoxManage modifyhd YOUR_HARD_DISK.vdi --resize SIZE_IN_MB
Step 2 is change the partition to take up the extra space created in Step 1. That can be done with the DiskPart tool that is built into Windows. To do this,  Launch the virtual machine, go to a command prompt (Administrator Mode), and run:
diskpart
Get a list of the volumes mounted on the machine:
list volume
From the resulting list, get the number of the volume for the one you want to extend. Select the volume:
select volume x
Where x is the # you got from the list volume command. Verify you have selected the right volume:
detail volume
Extend the partition to take all available space:
extend
Shut down the virtual machine, disconnect the volume, and it should be ready to mount to the original virtual pc.

Friday, May 28, 2010

Using Silverlight Isolated Storage

To store string data in Isolated Storage:

IsolatedStorageSettings.ApplicationSettings.Add("KeyName",
    Value);

To remove:

if (IsolatedStorageSettings.ApplicationSettings.Contains("KeyName"))
    IsolatedStorageSettings.ApplicationSettings.Remove("KeyName");

Invoking a Method Call Over RIA Services

To invoke a method through RIA Services:

On the server side, declare the method, an decorate it with the [Invoke] annotation. Return types can be simple types or collections.  Not sure if complex types work or not.

[Invoke]

public string BuildAdjusterMetricBatch(string users)
{
    DoSomeWork()

    return batch;
}

On the client side, invoke the method, and pass it a function for the asynchronous Callback:

var context = new Web.Services.MSIClaimContext();
context.BuildAdjusterMetricBatch(txtFilter.Text,  
    BatchBuildCompleted, null);

then declare a method for the callback that matches the return type of the Method.

void BatchBuildCompleted(InvokeOperation<string>
    invokeOperation)
{
    string myValue = invokeOperation.Value;
    DoClientSideWork();

}

Tuesday, May 25, 2010

Column Headers in Reporting Services 2008

If the column headers in Reporting Services 2008 won't repeat on a new page, do the following.

  • Click on the triangle button at the bottom of the screen, and click on "Advanced Mode".
  • In the "Row Groups" section of the window, click on the "Static" element at the top of the list.
  • Set the following properties:
    • FixedData = True
    • KeepWithGroup=After
    • RepeatOnNewPage=True

image