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
K

K L K

@K L K
About
Posts
29
Topics
13
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • MediaElement Custom Streaming
    K K L K

    Hey guys, I am using Silverlight 2.0.3 MediaElement.Source to stream a video file through my custom localhost/loopback server. The loopback server runs fine when I request the file with Windows Media Player, however when I use MediaElement.Source (SilverLight) the Silverlight MediaElement will not play the file even though the data is being sent by the server. The HTTP Requests that I receieve from Silverlight look like this: HTTP GET http://localhost:8080/blah.wmv UA-CPU: x86 Connection: Keep-Alive Accept: */* Accept-Encoding: gzip, deflate Host: localhost:8080 HTTP GET http://localhost:8080/blah.wmv UA-CPU: x86 Connection: Keep-Alive Accept: */* Accept-Encoding: gzip, deflate Host: localhost:8080 Range: bytes=49152-852853760 HTTP GET http://localhost:8080/blah.wmv UA-CPU: x86 Connection: Keep-Alive Accept: */* Accept-Encoding: gzip, deflate Host: localhost:8080 Range: bytes=65536-852853760 This is very problematic because I receieve multiple HTTP Requests from Silverlight, and only one request from Windows Media Player. The byte range values do not make any sense, the header values are not consistent and seemingly random. So in contrast to Windows Media Player's 1 HTTP Request, the Silverlight MediaElement makes 3 requests and doesn't play the file even though my custom Loopback Server is sending the data. Can anyone shed some light on this?

    madness ? this.isSparta = true : this.isSparta = false;

    WPF sysadmin question lounge

  • Cruise Control .NET Custom Formatting
    K K L K

    Hi, I'm setting up CC .NET to automate builds, unit tests, and e-mail results out. So far it's working great. One question I have though - I'd like some additional information in my e-mail reports. It would be really nice to have console output from my unit tests included in the report, to make it easier to immediately see what went wrong if a test fails. Is there an easy way to do this? Thanks, klk

    madness ? this.isSparta = true : this.isSparta = false;

    .NET (Core and Framework) question csharp

  • AppDomain.Unload an unmanaged DLLs
    K K L K

    Hi led mike, Basically, there is a possibility that the dll can be given wrong input, and as a result, can get into a state that is tough to recover from. The dll wasn't designed for this kind of input, but it is a small probability and I don't want the user's application to crash as a result. Thus, if I could simply blow away the AppDomain and bring it up again without the user ever knowing, that would be phenomenal. Is this any clearer? Thanks, klk

    madness ? this.isSparta = true : this.isSparta = false;

    .NET (Core and Framework) help question announcement

  • AppDomain.Unload an unmanaged DLLs
    K K L K

    Hi, I am using an unmanaged DLL in my code and am running into problems because it is difficult to get the structures in the DLL to reset their state properly. If I put the DLL in an AppDomain and unload the AppDomain, will that release the unmanaged DLL? That way, I could just start another AppDomain with the same DLL and have the state reset that way. This would be great, but I am not yet sure if it is possible. Any help is appreciated. Thanks, klk

    madness ? this.isSparta = true : this.isSparta = false;

    .NET (Core and Framework) help question announcement

  • Capture stderr through P/Invoke
    K K L K

    Hi Luc, I did what you said, and got it to work - so now I can get debugging output sent to the console. Thanks! It still feels like the old "printf" cycle of debugging (bug -> add printf -> recompile -> pray). Are there any guides on using WinDbg or another debugger to debug code that crosses managed->unmanaged boundaries? klk

    madness ? this.isSparta = true : this.isSparta = false;

    C# csharp c++ debugging json question

  • Capture stderr through P/Invoke
    K K L K

    Hi, I have a native dll that I am interfacing through P/Invoke. I have created the API, but have no way to debug the native code. I tried using windbg for this, but couldn't figure out how. So, my current alternative is to have the native code print to stdout/stderr using fprintf. However, I can't find any way to see this output in C#. Is there a way to capture stdout/stderr output from the native code? klk

    madness ? this.isSparta = true : this.isSparta = false;

    C# csharp c++ debugging json question

  • Filtering a DataGridView bound to a BindingSource
    K K L K

    Hi, I have a DataGridView whose DataSource is BindingList of objects: this.peerList = new BindingList(); this.dataGridView1.AutoGenerateColumns = true; this.bindingSource = new BindingSource(); this.bindingSource.DataSource = this.peerList; this.dataGridView1.DataSource = this.bindingSource; I have found guides online of how to set up this filtering, but they only work if the source is a DataTable. Is there a way to mimic this behavior on a BindingList? Thanks, klk (Also, sorry for not using code tags, as they made the generics disappear). madness ? this.isSparta = true : this.isSparta = false;

    Windows Forms tutorial question

  • Maintain Textbox Scroll Position
    K K L K

    Thanks luc, this worked perfectly.

    madness ? this.isSparta = true : this.isSparta = false;

    Windows Forms question

  • Maintain Textbox Scroll Position
    K K L K

    Hey Rob, I tried that solution, but the SelectionStart property refers to where the cursor is, not the scrollbar. Basically, unless the user clicks inside the textbox to place the cursor somewhere, it doesn't work. I looked up the P/Invoke stuff for Get/SetScrollInfo, but that's not working either! It still always jumps down to the bottom of the textbox. Here's my refactored code:

    public partial class PeerMessagesDisplay : Form
    {
        #region ScrollInfo
    
        \[DllImport( "user32.dll" )\]
        \[return: MarshalAs( UnmanagedType.Bool )\]
        private static extern bool GetScrollInfo( IntPtr hwnd, int fnBar, ref SCROLLINFO lpsi );
    
        \[DllImport( "user32.dll" )\]
        static extern int SetScrollInfo( IntPtr hwnd, int fnBar, \[In\] ref SCROLLINFO
            lpsi, bool fRedraw );
    
        \[StructLayout( LayoutKind.Sequential )\]
        struct SCROLLINFO
        {
            public uint cbSize;
            public uint fMask;
            public int nMin;
            public int nMax;
            public uint nPage;
            public int nPos;
            public int nTrackPos;
        }
    
        private enum ScrollBarDirection
        {
            SB\_HORZ = 0,
            SB\_VERT = 1,
            SB\_CTL = 2,
            SB\_BOTH = 3
        }
    
        private enum ScrollInfoMask
        {
            SIF\_RANGE = 0x1,
            SIF\_PAGE = 0x2,
            SIF\_POS = 0x4,
            SIF\_DISABLENOSCROLL = 0x8,
            SIF\_TRACKPOS = 0x10,
            SIF\_ALL = SIF\_RANGE + SIF\_PAGE + SIF\_POS + SIF\_TRACKPOS
        }
    
        #endregion
    
        private String title;
        private String logFile;
    
        private bool disposed;
    
        public PeerMessagesDisplay( String title, String logFilePath )
        {
            InitializeComponent();
    
            this.title = title;
            this.logFile = logFilePath;
    
            this.Show();
        }
    
    
        public void LoadLog( )
        {
            ThreadPool.QueueUserWorkItem( delegate
            {
                try
                {
                    if (this.InvokeRequired)
                        this.BeginInvoke( new Action( delegate( String s ) { this.Text = s; } ), title );
                    else
                        this.Text = title;
    
                    using (FileStream fs = File.OpenRead( this.logFile ))
                    {
                        using (StreamReader reader = new StreamReader( fs ))
    
    Windows Forms question

  • Maintain Textbox Scroll Position
    K K L K

    Hey Rob, This is a better solution, you are right. Unfortunately, it still always keeps the textbox's scroll position locked at the bottom. Is there a way around that? klk

    madness ? this.isSparta = true : this.isSparta = false;

    Windows Forms question

  • Seeing which thread owns a lock
    K K L K

    Hi, I'm trying to debug a deadlock problem, but I can't find anything that shows which thread owns a particular lock. Is there something that does this? klk

    madness ? this.isSparta = true : this.isSparta = false;

    C# debugging help question

  • Maintain Textbox Scroll Position
    K K L K

    Hi, I'm outputting some logging output to a TextBox, using the following code:

        public void AddNewMessage( String message )
        {
            lock (this)
            {
                if (disposed)
                    throw new ObjectDisposedException( "PeerMessagesDisplay" );
    
                String text = this.textBox1.Text.Insert( this.textBox1.Text.Length, message );
                SetText( text );
            }
        }
    
        private void SetText( String text )
        {
            if (this.InvokeRequired)
                this.textBox1.Invoke( new Action( SetTextHelper ), text );
            else
                SetTextHelper( text );
        }
    
        private void SetTextHelper( String text )
        {
            this.textBox1.Text = text;
        }
    

    But, whenever text is appended to the textbox, it automatically scrolls up to the top. This is bad when I'm trying to observe the output at the bottom or somewhere in the middle. How can I maintain the textbox's scroll position? Thanks, klk

    madness ? this.isSparta = true : this.isSparta = false;

    Windows Forms question

  • How do I embed WPF Custom UserControl (.dll) into a Webpage?
    K K L K

    Great question, I have been wondering this for some time but haven't gotten around to trying it. I can't find any examples online for this, but I'm sure a WPF MediaElement or other control can be embedded inside a webpage, I'm just not sure how.

    madness ? this.isSparta = true : this.isSparta = false;

    modified on Friday, June 6, 2008 4:47 PM

    WPF csharp question javascript html wpf

  • C# Equivalent to Java "Properties" Class
    K K L K

    Hey Colin, That's true, it does extend hashtable - but the real value of the Properties class comes in the utilities it provides for saving/loading that hashtable's contents to streams in different formats (XML, flat file, etc.) This capability is what I am looking for. If I don't find it I'll have to write it and post it here ;)

    C# json question csharp java html

  • C# Equivalent to Java "Properties" Class
    K K L K

    Java's Properties class (http://java.sun.com/javase/6/docs/api/java/util/Properties.html[^]) is an easy way to serialize a bunch of properties to and from a file. I am trying to port a Java application that makes heavy use of this class, to C#. What is the easiest way to emulate this behavior? I thought about XML serialization, but that doesn't work because all the field names have to be specified in advance. Any ideas?

    C# json question csharp java html

  • C# Port of dnsjava
    K K L K

    Hey guys, I'm trying to port a Java application to C#. The Java code makes heavy use of the dnsjava library, located here: http://www.dnsjava.org/[^]. I'm wondering what the best equivalent C# library would be. Any ideas? Thanks, klk

    C# csharp java question

  • Compiling out debugging statements - any easy way?
    K K L K

    I have a lot of debugging statements in my code, and I want to compile most of them away in a release build. Is there any easier way to do this besides surrounding each one with #if DEBUG...? An alternative solution would be to create a single method called Debug() which has the preprocessor statement inside of it. But this would involve refactoring a lot of code and would still involve a method invocation (albeit an empty one). Any ideas?

    C# debugging question announcement

  • Event in a Thread
    K K L K

    If your event is in a class, you can create a method in that class that invokes the event asynchronously. Specifically, you can do:

    ThreadPool.QueueUserWorkItem( delegate { if(eventCallResponse != null) { eventCallResponse(req) } );

    C# help question

  • First real questioN?
    K K L K

    I figured this problem out: http://ubuntuforums.org/showthread.php?t=781257[^]

    Linux, Apache, MySQL, PHP c++ linux question help

  • First real questioN?
    K K L K

    Hi, I am using Ubuntu 6.06.2 with mingw32 installed as a cross compiler. I installed it with "apt-get install mingw32 mingw32-binutils mingw32-runtime". I wrote the following simple program to test whether compilation works: int main(int argc, char* argv[]) { return 0; } When I try compiling it, however, I get the following: tgs@tgs-desktop~/test$ i586-mingw32msvc-gcc simpletest.c -o simpletest.exe /tmp/cc5xd3WR.s: Assembler messages: /tmp/cc5xd3WR.s:2: Error: unknown pseudo-op: `.def' /tmp/cc5xd3WR.s:2: Error: unknown pseudo-op: `.scl' /tmp/cc5xd3WR.s:2: Error: unrecognized symbol type "" /tmp/cc5xd3WR.s:2: Error: junk at end of line, first unrecognized character is `3' /tmp/cc5xd3WR.s:2: Error: unknown pseudo-op: `.endef' /tmp/cc5xd3WR.s:5: Error: unknown pseudo-op: `.def' /tmp/cc5xd3WR.s:5: Error: unknown pseudo-op: `.scl' /tmp/cc5xd3WR.s:5: Error: unrecognized symbol type "" /tmp/cc5xd3WR.s:5: Error: junk at end of line, first unrecognized character is `3' /tmp/cc5xd3WR.s:5: Error: unknown pseudo-op: `.endef' I feel like i586-mingw32msvc-gcc is trying to pass its output to the wrong assembler. There shouldn't be a reason for this though, I have all of the required programs in my path: tgs@tgs-desktop~/test$ ls /usr/bin/ | grep i586 i586-mingw32msvc-addr2line i586-mingw32msvc-ar i586-mingw32msvc-as i586-mingw32msvc-c++ i586-mingw32msvc-cc i586-mingw32msvc-c++filt i586-mingw32msvc-cpp i586-mingw32msvc-dlltool i586-mingw32msvc-dllwrap i586-mingw32msvc-g++ i586-mingw32msvc-gcc i586-mingw32msvc-gcc-3.4.4 i586-mingw32msvc-gccbug i586-mingw32msvc-gcov i586-mingw32msvc-ld i586-mingw32msvc-nm i586-mingw32msvc-objcopy i586-mingw32msvc-objdump i586-mingw32msvc-ranlib i586-mingw32msvc-readelf i586-mingw32msvc-size i586-mingw32msvc-strings i586-mingw32msvc-strip i586-mingw32msvc-windres I found some advice that told me to set the 'AS' environment variable to i586-mingw32msvc-as, but that didn't work either. Thoughts?

    Linux, Apache, MySQL, PHP c++ linux question help
  • Login

  • Don't have an account? Register

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