Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
T

teejayem

@teejayem
About
Posts
231
Topics
56
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Grid in a combo box [modified]
    T teejayem

    From MSDN[^] - A ListBoxItem is a ContentControl, which means that it can contain a single object of any type (such as a string, an image, or a panel). This means you can directly add any type of content you wish (like a grid).

            Grid grid = new Grid();
            grid.Children.Add(new TextBlock { Text = "Hello"});
    
            listBox.Items.Add(grid);
    

    Or you can use a grid in your ItemTemplate

            listBox.ItemsSource = new MyClass\[\] {
                new MyClass { Property1 = "a1", Property2 = "a2", Property3 = "a3"},
                new MyClass { Property1 = "b1", Property2 = "b2", Property3 = "b3"},
                new MyClass { Property1 = "c1", Property2 = "c2", Property3 = "c3"},
            };
    

    and the FontWeightConverter

    public class FontWeightConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            String item = value as String;
            if (item == null) return FontWeights.Normal;
    
            int index = int.Parse(item.Substring(1, 1));
    
            return index % 3 == 1 ? Fon
    
    WPF tutorial css database question

  • Scrolling in nested Listbox WPF
    T teejayem

    I would replace the inner listbox with an ItemsControl.

    Don't be overcome by evil, but overcome evil with good

    WPF wpf csharp architecture help

  • Binding: Accept an empty string in enumeration [modified]
    T teejayem

    Making the letter property nullable will fix your paticular issue. But, what if someone types "D"? I would personally use a Selector (like combobox) so the user can choose a valid Letter instead of guessing which letters are valid.

    Don't be overcome by evil, but overcome evil with good

    WPF wpf wcf json help tutorial

  • WCF & UserNamePasswordValidator
    T teejayem

    As of right now, I'm using a custom UserNamePasswordValidator to validate credentials. There is a library that i use to connect to a remote server and validate credentials. The same library is used in the service class to make calls to and from the database. What's happening is that the way it is set up now, there are two brand new instances being created for every service call. One in the UserNamePasswordValidator and one in the web service instance. What I'd like to do is somehow pass the same instance from my custom UserNamePasswordValidator to the web service instance that gets created. So, I've tried getting OperationContext.Current so i can pass the object to the InstanceContext but OperationContext.Current is null. Are there any other methods of achieving what I'm trying to accomplish? Thanks,

    Don't be overcome by evil, but overcome evil with good

    WCF and WF csharp database wcf sysadmin question

  • Securing (wcf) rest service.
    T teejayem

    I have been reading on how to secure a RESTful service and the more and more i read, the more and more i get confused. Basically i am required to pass 2 types of credentials: - Database credentials: login, password, host. - Store level employee credentials: 6 digit number, password. I'm thinking what i can do is have a method like:

    string SignIn(string employeeNumber, string employeePassword, string login, string password, string hostName);

    What i would do then is if this info validates, i can just store this info somewhere and create/return a session key. Then with subsequent calls the session key can be passed in the header. Now, let's say i have a method like:

    void GetData(string id);

    Is it in that method that i check to see if the session id is valid? A coworker said that if the a user (or attacker) can get inside that method then he's technically already in. So it has me thinking that i should be validating the call before the wcf runtime invokes the method. But i've seen some examples that disproves this. What are the best practices that i need to follow to secure a REST web service?

    Don't be overcome by evil, but overcome evil with good

    WCF and WF csharp database wcf json tutorial

  • extend class and casting
    T teejayem

    This should work for you (note: psuedo code).

    extended_1_GrObject ^extended_cl_1=gcnew extended_1_GrObject();
    my_list->Add(extended_cl_1);
    extended_2_GrObject ^extended_cl_2=gcnew extended_2_GrObject();
    my_list->Add(extended_cl_2);

    //other sample code
    for (int i=0;i<my_list->Count;i++) {

    //by now my bad bad way of calling the same method is
    //if (my\_list\[i\]->GetType()->Name=="extended\_1\_GrObject" ) {
    //	extended\_1\_GrObject ^tmp=static\_cast<extended\_1\_GrObject^>(my\_list\[i\]);
    //	tmp->calculate();
    //}
    //else if (my\_list\[i\]->GetType()->Name=="extended\_2\_GrObject" ) {
    //	extended\_2\_GrObject ^tmp=static\_cast<extended\_2\_GrObject^>(my\_list\[i\]);
    //	tmp->calculate();
    //}
    
        basicGrObject ^tmp = static\_cast<basicGrObject^>(my\_list\[i\]);
        tmp->calculate();
    

    }

    Don't be overcome by evil, but overcome evil with good

    Managed C++/CLI help lounge

  • Convert CString array to System::String
    T teejayem

    You would have to do something like this:

    array<String^>^ managedArray = gcnew array<String^>(5);
    CString nativeArray\[5\];
    
    for (int i = 0; i < 5; i++)
    {
    	managedArray\[i\] = Convert::ToString(i);
    	nativeArray\[i\] = gcnew String(nativeArray\[i\]);
    }
    

    Don't be overcome by evil, but overcome evil with good

    Managed C++/CLI question csharp data-structures help tutorial

  • MenuItem Command [modified]
    T teejayem

    Yeah that's sort of what i went with except i used the same idea in a trigger

            <Style x:Key="MenuItemStyle" TargetType="{x:Type MenuItem}">
                <Style.Triggers>
                    <Trigger Property="IsEnabled" Value="False">
                        <Setter Property="Visibility" Value="Collapsed" />
                    </Trigger>
                </Style.Triggers>
            </Style>
            <ContextMenu x:Key="menu">
                <MenuItem Header="\_Up" Command="{Binding Path=UpCommand}" Style="{StaticResource MenuItemStyle}" />
            </ContextMenu>
    

    It still doesn't sit right with me. I wish i could change it to where it doesn't trigger off of the IsEnabled property. It just seems bad to trigger one property off of another property. I mean, theoretically a developer can trigger Visibility off Enabled, then trigger AllowDrop off Visibility, then trigger Focusable off AllowDrop (you get the point). Not that anyone would ever want to do that, but it does promote that behavior.

    Don't be overcome by evil, but overcome evil with good

    WCF and WF wpf wcf

  • C# Delegates in vc++
    T teejayem

    that is because your callback needs to accept a System.String datatype instead of CString. If you need to marshal String^ to Cstring just do the following.

    static void OnCallClick(String ^msg)
    {
    CString nativeString = msg;
    }

    And guess what! You may have noticed that you don't have to marshal System.String into a CString in your code. That is because of a little trick in cstringt.h

    #if defined(__cplusplus_cli)

    template <class SystemString>
    CStringT( SystemString^ pString ) :
    	CThisSimpleString( StringTraits::GetDefaultManager() )
    {
    	cli::pin\_ptr<const System::Char> pChar = PtrToStringChars( pString );
    	const wchar\_t \*psz = pChar;
    	\*this = psz;
    }
    

    this function handles the marshaling for you :)

    Don't be overcome by evil, but overcome evil with good

    C# csharp help c++ wpf regex

  • WndProc equivalent in WPF?
    T teejayem

    Badda Bam![^]

    Don't be overcome by evil, but overcome evil with good

    WPF csharp wpf winforms question

  • MenuItem Command [modified]
    T teejayem

    I have a menuitem which is bound to a command in my vm

    <MenuItem Header="_Up" Command="{Binding Path=UpCommand}" />

    this works great (canexecute fires and execute fires) except if canexecute returns false then the menuitem is disabled. I'd like to change the menuitem so that the visibility will be hidden/collapsed if CanExecute is returned false. Is there a way to do that (by changing the style) w/o creating a "menuitemviewmodel" or some clunky thing like that.

    Don't be overcome by evil, but overcome evil with good

    modified on Tuesday, December 29, 2009 3:12 PM

    WCF and WF wpf wcf

  • managed c++ app refuses to run
    T teejayem

    Sounds like you should install Microsoft Visual C++ 2008 Redistributable Package (x86)[^]

    Don't be overcome by evil, but overcome evil with good

    Managed C++/CLI c++ csharp asp-net dotnet com

  • Weather Web Service
    T teejayem

    Here are a couple that i've found. http://www.nws.noaa.gov/forecasts/xml/[^] http://weather.weatherbug.com/desktop-weather/api.html[^]

    Don't be overcome by evil, but overcome evil with good

    WPF csharp wpf question

  • VS2010 beta2 and C++
    T teejayem

    It really is annoying to see the intellisense gone in vs2010 (and i mean GONE). Since they rebuilt the intellisense for native c++ why couldn't they put in the intellisense for c++/cli for native types only etc? It really goes to show they could care less about CLI. But hey we have a new (slow piece of crap WPF) IDE.

    Don't be overcome by evil, but overcome evil with good

    The Lounge visual-studio c++ beta-testing help

  • String pass by reference
    T teejayem

    instead of

    void mod_str(String ^bb) {
    bb="bau";
    }

    use

    void mod_str(String ^%bb) {
    bb="bau";
    }

    EDIT: This is a pretty good place to learn the keywords and operators specific to C++/CLI http://msdn.microsoft.com/en-us/library/xey702bw.aspx[^]

    Don't be overcome by evil, but overcome evil with good

    Managed C++/CLI c++

  • Read 1000 Lines from text file in a single shot ........
    T teejayem

    you're still in the wrong forum.

    Don't be overcome by evil, but overcome evil with good

    Managed C++/CLI question c++ ios tutorial

  • How to Parse a string to DATE datatype using Managed C++
    T teejayem

    DateTime myDate = DateTime::Parse("2009/07/30");

    Don't be overcome by evil, but overcome evil with good

    Managed C++/CLI c++ help tutorial

  • WPF browser application on MAC browsers
    T teejayem

    WPF Browser applications use the .net framework which will only run in windows. There is a project called Mono[^] which allows you to run some .net applications on other platforms but it currently lacks wpf support. Silverlight[^] is a subset of wpf which runs on multiple platforms[^].

    Don't be overcome by evil, but overcome evil with good

    WPF csharp wpf question

  • administrating asp.net
    T teejayem

    Thanks for the link! I also found this book which seems to be pretty good: Professional IIS 7 and ASP.NET Integrated Programming[^]

    Don't be overcome by evil, but overcome evil with good

    System Admin csharp asp-net com sysadmin windows-admin

  • Web service: resource managment
    T teejayem

    thanks for the info!

    Don't be overcome by evil, but overcome evil with good

    ASP.NET performance wcf windows-admin learning
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups