Search Results

Search found 67 results on 3 pages for 'harvey kwok'.

Page 2/3 | < Previous Page | 1 2 3  | Next Page >

  • Strange WPF ListBox Behavior

    - by uncle-harvey
    I’m trying to bind a List of items to a listbox in WPF. The items are grouped by one value and each group is to be housed in an expander. Everything works fine when I don’t use any custom styles. However, when I use custom styles (which work properly with non-grouped items and as independent controls) the binding doesn’t display any items. Below is the code I’m executing. Any ideas why the items won’t show up in the Expander? Test.xaml: <Window x:Class="Glossy.Test" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Test" Height="300" Width="300"> <Window.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="..\TestStyles.xaml"/> <ResourceDictionary> <Style x:Key="ContainerStyle" TargetType="{x:Type GroupItem}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate> <Expander Header="{Binding}" IsExpanded="True"> <ItemsPresenter /> </Expander> </ControlTemplate> </Setter.Value> </Setter> </Style> </ResourceDictionary> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Window.Resources> <Grid> <ListBox x:Name="TestList"> <ListBox.GroupStyle> <GroupStyle ContainerStyle="{StaticResource ContainerStyle}"/> </ListBox.GroupStyle> </ListBox> </Grid> Test.xaml.cs: public partial class Test : Window { private List<Contact> _ContactItems; public List<Contact> ContactItems { get { return _ContactItems; } set { _ContactItems = value; } } public Test() { InitializeComponent(); ContactItems = new List<Contact>(); ContactItems.Add(new Contact()); ContactItems.Last().CompanyName = "ABC"; ContactItems.Last().Name = "Contact 1"; ContactItems.Add(new Contact()); ContactItems.Last().CompanyName = "ABC"; ContactItems.Last().Name = "Contact 2"; ContactItems.Add(new Contact()); ContactItems.Last().CompanyName = "ABC"; ContactItems.Last().Name = "Contact 3"; ContactItems.Add(new Contact()); ContactItems.Last().CompanyName = "ABC"; ContactItems.Last().Name = "Contact 10"; ContactItems.Add(new Contact()); ContactItems.Last().CompanyName = "ABC"; ContactItems.Last().Name = "Contact 11"; ContactItems.Add(new Contact()); ContactItems.Last().CompanyName = "ABC"; ContactItems.Last().Name = "Contact 12"; ContactItems.Add(new Contact()); ContactItems.Last().CompanyName = "RST"; ContactItems.Last().Name = "Contact 7"; ContactItems.Add(new Contact()); ContactItems.Last().CompanyName = "RST"; ContactItems.Last().Name = "Contact 8"; ContactItems.Add(new Contact()); ContactItems.Last().CompanyName = "RST"; ContactItems.Last().Name = "Contact 9"; ContactItems.Add(new Contact()); ContactItems.Last().CompanyName = "XYZ"; ContactItems.Last().Name = "Contact 4"; ContactItems.Add(new Contact()); ContactItems.Last().CompanyName = "XYZ"; ContactItems.Last().Name = "Contact 5"; ContactItems.Add(new Contact()); ContactItems.Last().CompanyName = "XYZ"; ContactItems.Last().Name = "Contact 6"; ICollectionView view = CollectionViewSource.GetDefaultView(ContactItems); view.GroupDescriptions.Add(new PropertyGroupDescription("CompanyName")); view.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Ascending)); TestList.ItemsSource = view; } } public class Contact { public string CompanyName { get; set; } public string Name { get; set; } public override string ToString() { return Name; } } TestStyles.xaml: <Style TargetType="{x:Type ListBox}"> <Setter Property="SnapsToDevicePixels" Value="true"/> <Setter Property="OverridesDefaultStyle" Value="true"/> <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/> <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/> <Setter Property="ScrollViewer.CanContentScroll" Value="true"/> <Setter Property="MinWidth" Value="120"/> <Setter Property="MinHeight" Value="95"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="ListBox"> <Grid Background="Black"> <Rectangle VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Fill="White"> <Rectangle.OpacityMask> <DrawingBrush> <DrawingBrush.Drawing> <GeometryDrawing Geometry="M65.5,33 L537.5,35 537.5,274.5 C536.5,81 119.5,177 66.5,92" Brush="#11444444"> <GeometryDrawing.Pen> <Pen Brush="Transparent"/> </GeometryDrawing.Pen> </GeometryDrawing> </DrawingBrush.Drawing> </DrawingBrush> </Rectangle.OpacityMask> </Rectangle> <Border Name="Border" Background="Transparent" BorderBrush="Gray" BorderThickness="1" CornerRadius="2"> <ScrollViewer Margin="0" Focusable="false"> <StackPanel Margin="2" IsItemsHost="True" /> </ScrollViewer> </Border> </Grid> <ControlTemplate.Triggers> <Trigger Property="IsEnabled" Value="false"> <Setter TargetName="Border" Property="Background" Value="Gray" /> <Setter TargetName="Border" Property="BorderBrush" Value="DimGray" /> </Trigger> <Trigger Property="IsGrouping" Value="true"> <Setter Property="ScrollViewer.CanContentScroll" Value="false"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style TargetType="{x:Type ListBoxItem}"> <Setter Property="SnapsToDevicePixels" Value="true"/> <Setter Property="OverridesDefaultStyle" Value="true"/> <Setter Property="Foreground" Value="Gray"/> <Setter Property="Background" Value="Transparent"/> <Setter Property="FontFamily" Value="Verdana"/> <Setter Property="HorizontalAlignment" Value="Stretch"/> <Setter Property="FontSize" Value="11"/> <Setter Property="Margin" Value="3,1,3,1"/> <Setter Property="Padding" Value="0"/> <Setter Property="FontWeight" Value="Normal"/> <Setter Property="VerticalAlignment" Value="Center"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="ListBoxItem"> <Border Name="Border" Padding="2" SnapsToDevicePixels="true"> <ContentPresenter /> </Border> <ControlTemplate.Triggers> <Trigger Property="IsSelected" Value="true"> <Setter TargetName="Border" Property="Background" Value="Gray"/> </Trigger> <Trigger Property="IsEnabled" Value="false"> <Setter Property="Foreground" Value="White"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> <ControlTemplate x:Key="ExpanderToggleButton" TargetType="ToggleButton"> <Border Name="Border" CornerRadius="2,0,0,0" Background="Transparent" BorderBrush="LightGray" BorderThickness="0,0,1,0"> <Path Name="Arrow" Fill="Blue" HorizontalAlignment="Center" VerticalAlignment="Center" Data="M 0 0 L 4 4 L 8 0 Z"/> </Border> <ControlTemplate.Triggers> <Trigger Property="ToggleButton.IsMouseOver" Value="True"> <Setter TargetName="Border" Property="Background" Value="Gray" /> </Trigger> <Trigger Property="IsPressed" Value="True"> <Setter TargetName="Border" Property="Background" Value="Black" /> </Trigger> <Trigger Property="IsChecked" Value="True"> <Setter TargetName="Arrow" Property="Data" Value="M 0 4 L 4 0 L 8 4 Z" /> </Trigger> <Trigger Property="IsEnabled" Value="False"> <Setter TargetName="Border" Property="Background" Value="DimGray" /> <Setter TargetName="Border" Property="BorderBrush" Value="DimGray" /> <Setter Property="Foreground" Value="LightGray"/> <Setter TargetName="Arrow" Property="Fill" Value="LightBlue" /> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> <Style TargetType="{x:Type Expander}"> <Setter Property="Foreground" Value="White"/> <Setter Property="FontFamily" Value="Verdana"/> <Setter Property="FontSize" Value="11"/> <Setter Property="FontWeight" Value="Normal"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="Expander"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Name="ContentRow" Height="0"/> </Grid.RowDefinitions> <Border Name="Border" Grid.Row="0" Background="Black" BorderBrush="DimGray" BorderThickness="1" Cursor="Hand" CornerRadius="2,2,0,0" > <Grid HorizontalAlignment="Left"> <Grid.RowDefinitions> <RowDefinition Height="23"/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="20" /> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <ToggleButton IsChecked="{Binding Path=IsExpanded,Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}" Template="{StaticResource ExpanderToggleButton}" Background="Black" /> <Label Grid.Column="1" FontSize="14" FontWeight="Normal" Margin="0" VerticalAlignment="Top" Foreground="White" FontFamily="Verdana"> <ContentPresenter Grid.Column="1" Margin="4,3,0,0" HorizontalAlignment="Left" ContentSource="Header" RecognizesAccessKey="True" /> </Label> </Grid> </Border> <Border Name="Content" Background="Black" BorderBrush="DimGray" BorderThickness="1,0,1,1" Grid.Row="1" CornerRadius="0,0,2,2" > <Grid Background="Black"> <Rectangle VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Fill="White"> <Rectangle.OpacityMask> <DrawingBrush> <DrawingBrush.Drawing> <GeometryDrawing Geometry="M65.5,33 L537.5,35 537.5,274.5 C536.5,81 119.5,177 66.5,92" Brush="#11444444"> <GeometryDrawing.Pen> <Pen Brush="Transparent"/> </GeometryDrawing.Pen> </GeometryDrawing> </DrawingBrush.Drawing> </DrawingBrush> </Rectangle.OpacityMask> </Rectangle> <ContentPresenter Margin="4" /> </Grid> </Border> </Grid> <ControlTemplate.Triggers> <Trigger Property="IsExpanded" Value="True"> <Setter TargetName="ContentRow" Property="Height" Value="{Binding ElementName=Content,Path=DesiredHeight}" /> </Trigger> <Trigger Property="IsEnabled" Value="False"> <Setter TargetName="Border" Property="Background" Value="Gray" /> <Setter TargetName="Border" Property="BorderBrush" Value="DimGray" /> <Setter Property="Foreground" Value="White"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style>

    Read the article

  • Why so much stack space used for each recursion?

    - by Harvey
    I have a simple recursive function RCompare() that calls a more complex function Compare() which returns before the recursive call. Each recursion level uses 248 bytes of stack space which seems like way more than it should. Here is the recursive function: void CMList::RCompare(MP n1) // RECURSIVE and Looping compare function { auto MP ne=n1->mf; while(StkAvl() && Compare(n1=ne->mb)) RCompare(n1); // Recursive call ! } StkAvl() is a simple stack space check function that compares the address of an auto variable to the value of an address near the end of the stack stored in a static variable. It seems to me that the only things added to the stack in each recursion are two pointer variables (MP is a pointer to a structure) and the stuff that one function call stores, a few saved registers, base pointer, return address, etc., all 32-bit (4 byte) values. There's no way that is 248 bytes is it? I don't no how to actually look at the stack in a meaningful way in Visual Studio 2008. Thanks

    Read the article

  • Automatically Sizing an ASP.NET Treeview Control

    - by Robert Harvey
    Is there a way to automatically resize a TreeView control so that when it is rendered (or re-rendered, if a node is expanded), the TreeView automatically resizes itself to match the overall height of the tree? The purpose of this is to eliminate the scroll bar that accompanies the TreeView, so that the treeview blends seamlessly into the background.

    Read the article

  • DropDownListFor and relating my lambda to my ViewModel

    - by Daniel Harvey
    After googling for a while I'm still drawing a blank here. I'm trying to use a ViewModel to pull and provide a dictionary to a drop down list inside a strongly typed View: <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="Notebook.ViewModels.CorporationJoinViewModel" %> ... <%: Html.DropDownListFor(c => c.CorpDictionary.Keys, new SelectList(Model.CorpDictionary, "Value", "Key"))%> I'm getting the error CS1061: 'object' does not contain a definition for 'CorpDictionary' and no extension method 'CorpDictionary' accepting a first argument of type 'object' could be found and the relevant bit of my ViewModel public class CorporationJoinViewModel { DB _db = new DB(); // data context public Dictionary<int, string> CorpDictionary { get { Dictionary<int, string> corporations = new Dictionary<int, string>(); int x = 0; foreach (Corporation corp in _db.Corporations) { corporations.Add(x, corp.name); } return corporations; } } I'll admit i have a pretty magical understanding of how linq is finding my ViewModel object from that lambda, and the error message is making me think it's not. Is my problem the method I'm using to pass the data? What am I missing here?

    Read the article

  • How do you create a unit-testing stub for an interface containing a read-only member?

    - by Robert Harvey
    I am writing some unit tests for an extension method I have written on IPrincipal. To assist, I have created a couple of helper classes (some code for not-implemented members of the interfaces has been omitted for brevity): public class IPrincipalStub : IPrincipal { private IIdentity identityStub = new IIdentityStub(); public IIdentity Identity { get { return identityStub } set { identityStub = value } } } public class IIdentityStub : IIdentity { public string Name { get; set; } } However, the Name property in the IIdentity interface is read-only (the IIDentity interface specifies a getter but not a setter for the Name property). How can I set the Name property in my stub object for testing purposes if the interface has defined it as a read-only property?

    Read the article

  • Create an anonymous type object from an arbitrary text file

    - by Robert Harvey
    I need a sensible way to draw arbitrary text files into a C# program, and produce an arbitrary anonymous type object, or perhaps a composite dictionary of some sort. I have a representative text file that looks like this: adapter 1: LPe11002 Factory IEEE: 10000000 C97A83FC Non-Volatile WWPN: 10000000 C93D6A8A , WWNN: 20000000 C93D6A8A adapter 2: LPe11002 Factory IEEE: 10000000 C97A83FD Non-Volatile WWPN: 10000000 C93D6A8B , WWNN: 20000000 C93D6A8B Is there a way to get this information into an anonymous type object or some similar structure? The final anonymous type might look something like this, if it were composed in C# by hand: new { adapter1 = new { FactoryIEEE = "10000000 C97A83FC", Non-VolatileWWPN = "10000000 C93D6A8A", WWNN = "20000000 C93D6A8A" } adapter2 = new { FactoryIEEE = "10000000 C97A83FD", Non-VolatileWWPN = "10000000 C93D6A8B", WWNN = "20000000 C93D6A8B" } } Note that, as the text file's content is arbitrary (i.e. the keys could be anything), a specialized solution (e.g. that looks for names like "FactoryIEEE") won't work. However, the structure of the file will always be the same (i.e. indentation for groups, colons and commas as delimiters, etc). Or maybe I'm going about this the wrong way, and you have a better idea?

    Read the article

  • Convert MFC Doc/View to?

    - by Harvey
    My question will be hard to form, but to start: I have an MFC SDI app that I have worked on for an embarrassingly long time, that never seemed to fit the Doc/View architecture. I.e. there isn't anything useful in the Doc. It is multi-threaded and I need to do more with threading, etc. I dream about also porting it to Linux X Windows, but I know nothing about that programming environment as yet. Maybe Mac also. My question is where to go from here? I think I would like to convert from MFC Doc/View to straight Win API stuff with message loops and window procedures, etc. But the task seems to be huge. Does the Linux X Windows environment use a similar kind of message loop, window procedure architecture? Can I go part way? Like convert a little at a time without rendering my program unusable for long periods of work? What is the best book to read to help me to move in that direction.

    Read the article

  • UpdateAllViews() from within a worker thread?

    - by Harvey
    I have a worker thread in a class that is owned by a ChildView. (I intend to move this to the Doc eventually.) When the worker thread completes a task I want all the views to be updated. How can I make a call to tell the Doc to issue an UpdateAllViews()? Or is there a better approach? Thank you. Added by OP: I am looking for a simple solution. The App is running on a single user, single CPU computer and does not need network (or Internet) access. There is nothing to cause a deadlock. I think I would like to have the worker thread post (or send) a message to cause the views to update. Everything I read about threading seems way more complicated than what I need - and, yes, I understand that all those precautions are necessary for applications that are running in multiprocessor, multiuser, client-server systems, etc. But none of those apply in my situation. I am just stuck at getting the right combination of getting the window handle, posting the message and responding to the message in the right functions and classes to compile and function at all.

    Read the article

  • Convert text file to dictionary or anonymous type object

    - by Robert Harvey
    I have a text file that looks like this: adapter 1: LPe11002 Factory IEEE: 10000000 C97A83FC Non-Volatile WWPN: 10000000 C93D6A8A , WWNN: 20000000 C93D6A8A adapter 2: LPe11002 Factory IEEE: 10000000 C97A83FD Non-Volatile WWPN: 10000000 C93D6A8B , WWNN: 20000000 C93D6A8B Is there a way to get this information into an anonymous type or dictionary object? The final anonymous type might look something like this, if it were composed in C# by hand: new { adapter1 = new { FactoryIEEE = "10000000 C97A83FC", Non-VolatileWWPN = "10000000 C93D6A8A", WWNN = "20000000 C93D6A8A" } adapter2 = new { FactoryIEEE = "10000000 C97A83FD", Non-VolatileWWPN = "10000000 C93D6A8B", WWNN = "20000000 C93D6A8B" } }

    Read the article

  • What is the motivation behind "Use Extension Methods Sparingly?"

    - by Robert Harvey
    I find them a very natural way to extend existing classes, especially when you just need to "spot-weld" some functionality onto an existing class. Microsoft says, "In general, we recommend that you implement extension methods sparingly and only when you have to." And yet extension methods form the foundation of Linq; in fact, Linq was the reason extension methods were created. Are there specific design criteria where using extension methods are perferred over inheritance or composition? Under what criteria are they discouraged?

    Read the article

  • Canonical resource for forms-based design in ASP.NET MVC?

    - by Robert Harvey
    Is there a resource on the web that describes various form scenarios in ASP.NET MVC, and gives example solutions within a sensible, consistent design philosophy? Examples of such scenarios might be: One-to-many forms, like invoice data-entry forms. Foreign-table forms such as Add New User in a form that requires specifying a user Forms that require dynamic interaction, using Ajax or JSON. Popup forms Forms requiring multiple data records to be input, without postbacks. Note that there is considerable conceptual and technological overlap among these example scenarios. I am aware that there is a vast patchwork quilt of available technologies and examples out there that provide partial solutions and pieces of solutions, such as jQuery Ajax, CSS, and so forth. But I would like guidance in using these technologies in more effective and consistent ways. I am not considering web forms integration with an ASP.NET MVC application; I would still like my applications to be pure MVC. Nor am I, at the moment, considering a paid solution like Telerik. But I would like to know if someone has already done some of the work combining these technologies into a consistent, cohesive whole, that follows a sensible design philosophy. (an open source framework, perhaps?)

    Read the article

  • Help to restructure my Doc/View more correctly

    - by Harvey
    Edited by OP. My program is in need of a lot of cleanup and restructuring. In another post I asked about leaving the MFC DocView framework and going to the WinProc & Message Loop way (what is that called for short?). Well at present I am thinking that I should clean up what I have in Doc View and perhaps later convert to non-MFC it that even makes sense. My Document class currently has almost nothing useful in it. I think a place to start is the InitInstance() function (posted below). In this part: POSITION pos=pDocTemplate->GetFirstDocPosition(); CLCWDoc *pDoc=(CLCWDoc *)pDocTemplate->GetNextDoc(pos); ASSERT_VALID(pDoc); POSITION vpos=pDoc->GetFirstViewPosition(); CChildView *pCV=(CChildView *)pDoc->GetNextView(vpos); This seem strange to me. I only have one doc and one view. I feel like I am going about it backwards with GetNextDoc() and GetNextView(). To try to use a silly analogy; it's like I have a book in my hand but I have to look up in it's index to find out what page the Title of the book is on. I'm tired of feeling embarrassed about my code. I either need correction or reassurance, or both. :) Also, all the miscellaneous items are in no particular order. I would like to rearrange them into an order that may be more standard, structured or straightforward. ALL suggestions welcome! BOOL CLCWApp::InitInstance() { InitCommonControls(); if(!AfxOleInit()) return FALSE; // Initialize the Toolbar dll. (Toolbar code by Nikolay Denisov.) InitGuiLibDLL(); // NOTE: insert GuiLib.dll into the resource chain SetRegistryKey(_T("Real Name Removed")); // Register document templates CSingleDocTemplate* pDocTemplate; pDocTemplate = new CSingleDocTemplate( IDR_MAINFRAME, RUNTIME_CLASS(CLCWDoc), RUNTIME_CLASS(CMainFrame), RUNTIME_CLASS(CChildView)); AddDocTemplate(pDocTemplate); // Parse command line for standard shell commands, DDE, file open CCmdLineInfo cmdInfo; ParseCommandLine(cmdInfo); // Dispatch commands specified on the command line // The window frame appears on the screen in here. if (!ProcessShellCommand(cmdInfo)) { AfxMessageBox("Failure processing Command Line"); return FALSE; } POSITION pos=pDocTemplate->GetFirstDocPosition(); CLCWDoc *pDoc=(CLCWDoc *)pDocTemplate->GetNextDoc(pos); ASSERT_VALID(pDoc); POSITION vpos=pDoc->GetFirstViewPosition(); CChildView *pCV=(CChildView *)pDoc->GetNextView(vpos); if(!cmdInfo.m_Fn1.IsEmpty() && !cmdInfo.m_Fn2.IsEmpty()) { pCV->OpenF1(cmdInfo.m_Fn1); pCV->OpenF2(cmdInfo.m_Fn2); pCV->DoCompare(); // Sends a paint message when complete } // enable file manager drag/drop and DDE Execute open m_pMainWnd->DragAcceptFiles(TRUE); m_pMainWnd->ShowWindow(SW_SHOWNORMAL); m_pMainWnd->UpdateWindow(); // paints the window background pCV->bDoSize=true; //Prevent a dozen useless size calculations return TRUE; } Thanks

    Read the article

  • UpdateAllWindows() from within a worker thread?

    - by Harvey
    I have a worker thread in a class that is owned by a ChildView. (I intend to move this to the Doc eventually.) When the worker thread completes a task I want all the views to be updated. How can I make a call to tell the Doc to issue an UpdateAllViews()? Or is there a better approach? Thank you.

    Read the article

  • Why is my Extension Method not showing up in my test class?

    - by Robert Harvey
    I created an extension method called HasContentPermission on the System.Security.Principal.IIdentity interface: namespace System.Security.Principal { public static bool HasContentPermission (this IIdentity itentity, int contentID) { // I do stuff here return result; } } And I call it like this: bool hasPermission = User.Identity.HasPermission(contentID); Works like a charm. Now I want to unit test it. To do that, all I really need to do is call the extension method directly, so: using System.Security.Principal; namespace MyUnitTests { [TestMethod] public void HasContentPermission_PermissionRecordExists_ReturnsTrue() { IIdentity identity; bool result = identity.HasContentPermission(... But HasContentPermission won't intellisense. I tried creating a stub class that inherits from IIdentity, but that didn't work either. Why? Or am I going about this the wrong way?

    Read the article

  • Paste or Drop, copy data and release source?

    - by Harvey
    I have an MFC DocView SDI App that receives data from either the clipboard or drag and drop. The data is in either CF_HDROP or CF_TEXT format. I have a COleDropTarget derived CMyDropTarget member m_dropTarget of my CMainFrame class. I have two member functions of CMyDropTarget; OnDrop(...) and OnPaste() which each call another member function PostData(pDataObject). I want to get a copy of the pDataObject from either CF_... format and PostMessage to my CmainFrame which will call a member of my Doc class. What is a simple way of getting a copy of the global data to pass with the PostMessage() so that I can get the drop source released before I get around to processing the global data? NOTE that they are always treated as a copy of the source data, so there is no need for the source to delete anything when the operation is done. Or perhaps a better way of asking the question is: How can I release the Drop source before processing the global data? Can I pass the HGLOBAL via PostMessage and still release the source without making a copy of it?

    Read the article

  • Possible Performance Considerations using Linq to SQL Repositories

    - by Robert Harvey
    I have an ASP.NET MVC application that uses Linq to SQL repositories for all interactions with the database. To deal with data security, I do trimming to filter data to only those items to which the user has access. This occurs in several places: Data in list views Links in a menu bar A treeview on the left hand side containing links to content Role-based security A special security attribute, inheriting from AuthorizeAttribute, that implements content-based authorization on every controller method. Each of these places instantiates a repository, which opens a Linq to Sql DataContext and accesses the database. So, by my count, each request for a page access opens at least six separate Linq to SQL DataContexts. Should I be concerned about this from a performance perspective, and if so, what can be done to mitigate it?

    Read the article

  • Managing multiple customer databases in ASP.NET MVC application

    - by Robert Harvey
    I am building an application that requires separate SQL Server databases for each customer. To achieve this, I need to be able to create a new customer folder, put a copy of a prototype database in the folder, change the name of the database, and attach it as a new "database instance" to SQL Server. The prototype database contains all of the required table, field and index definitions, but no data records. I will be using SMO to manage attaching, detaching and renaming the databases. In the process of creating the prototype database, I tried attaching a copy of the database (companion .MDF, .LDF pair) to SQL Server, using Sql Server Management Studio, and discovered that SSMS expects the database to reside in c:\program files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\MyDatabaseName.MDF Is this a "feature" of SQL Server? Is there a way to manage individual databases in separate directories? Or am I going to have to put all of the customer databases in the same directory? (I was hoping for a little better control than this). NOTE: I am currently using SQL Server Express, but for testing purposes only. The production database will be SQL Server 2008, Enterprise version. So "User Instances" are not an option.

    Read the article

  • Creating a standalone ASP.NET MVC application for Windows XP

    - by Robert Harvey
    Is there a way to create an installable (ideally XCopy installable) version of an ASP.NET MVC application that will run in a standalone fashion on a Windows XP machine? I don't mind installing SQL Server Express for this purpose, so I guess the question boils down to this: Can the Cassini web server that comes with Visual Studio 2008 be bundled with the application? Or are there other options? NOTE: The installation is for demo purposes only, so there are no licensing problems. Also, I am suggesting Cassini because I don't know of a way to install IIS7 on Windows XP. I can't do major hackage on the registry to get this to work.

    Read the article

  • What's the right tool for this job in Google Spreadsheets?

    - by Daniel Harvey
    Is it possible to nest simple programs within a Google doc spreadsheet, similar to how you would w/Basic in Excel? Or alternatively a simple = syntax using regex, if there is a way to do that in google docs? I want to take a list of multiple names(name1, name2, name3) in a single cell from across multiple identical sheets and transpose them to another sheet within the same spreadsheet, check for duplicates and ignore capitals, etc. Is there a way to do this?

    Read the article

  • How do you manage the namespaces of your extension methods?

    - by Robert Harvey
    Do you use a global, catchall namespace for all of your extension methods, or do you put the extension methods in the same namespace as the class(es) they extend? Or do you use some other method, like an application or library-specific namespace? EDIT: I ask because I have a need to extend System.Security.Principal.IIdentity, and putting the extension method in the System.Security.Principal namespace seems to make sense, but I've never seen it done this way.

    Read the article

< Previous Page | 1 2 3  | Next Page >