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
J

Jan van den Baard

@Jan van den Baard
About
Posts
50
Topics
14
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • XAML in an article
    J Jan van den Baard

    I have done so in parts of the article text but was hoping to avoid having to do this in the pre sections. Judging from the anwser Chris gave me I do not have to format the Xaml located within a <pre lang="XML"> section. I will ofcourse make sure before I actually submit.

    We are the all singing, all dancing crap of the world. - Tyler Durden

    Article Writing question wpf com xml

  • XAML in an article
    J Jan van den Baard

    Actually this does set my mind at ease. I was just making sure because when using the tool I mentioned in the original post I only see an empty block in the preview. A shortcoming of the tool I guess. I was nog referring to the online article editor. Thank you for anwsering my question.

    We are the all singing, all dancing crap of the world. - Tyler Durden

    Article Writing question wpf com xml

  • XAML in an article
    J Jan van den Baard

    I am using A Code Project Article Editor with Live Preview [^] to create an article. Now I want to include some XAML code in the article text. However simply copying and pasting the XAML between <pre lang="XML"></pre> tags does not seem to do it in the mentioned editor (obviously). My question is will the codeproject submission process handle this for me or do I need to "pre-format" the XAML before submission? My guess would be that this is handled for me since creating a XML pre tag while posting this question seems to convert the XML for me in the preview but better be safe than sorry I guess... Thanks in advance. - Jan

    We are the all singing, all dancing crap of the world. - Tyler Durden

    Article Writing question wpf com xml

  • Looking for C# Text /code editor article
    J Jan van den Baard

    Perhaps it was this one? Storm IDE[^]

    We are the all singing, all dancing crap of the world. - Tyler Durden

    The Lounge question csharp visual-studio

  • Sci-Fi books
    J Jan van den Baard

    The Saga of Seven Suns[^] by Kevin J. Anderson. Anything by Peter F. Hamilton or Greg Bear.

    We are the all singing, all dancing crap of the world. - Tyler Durden

    The Lounge game-dev question learning

  • Long Road to Eden
    J Jan van den Baard

    Too bad it is also the only song on the new album that is this good...

    We are the all singing, all dancing crap of the world. - Tyler Durden

    The Lounge com

  • A (not so subtle) leak...
    J Jan van den Baard

    Yes. See my response to the message from AWdrius above.

    We are the all singing, all dancing crap of the world. - Tyler Durden

    Clever Code csharp question

  • A (not so subtle) leak...
    J Jan van den Baard

    Mike Dimmick wrote:

    You don't have a Dispose method, implement IDisposable, and you don't dispose of Socket nor WaitHandle.

    Unless I am mistaking the Dispose() of UdpClient does the necessary cleanup for me.

    Mike Dimmick wrote:

    Also, if you're deriving from UdpClient, you already have a socket. Unfortunately you can't access it from a derived class.

    Well you can. Through the Client property. The class uses the socket supplied by this property. Disposing of the UdpTimeoutClient object should perform all necessary cleanup. Not sure about the WaitHandle though...

    Clever Code csharp question

  • A (not so subtle) leak...
    J Jan van den Baard

    To be able to timeout from receiving the data. The method should be handled synchronously but it should also be able to timeout. When I would use the synchronous Receive() call on the UdpClient it would wait indefinitly for data to arive. I.E. the call would never exit. This way I can atleast timeout when receiving expected data takes to long. Our NTP client does a request on the NTP server at regular intervals. The NTP server may not be available all the time. If I where to use the Receive() approach the NTP syncing would "hang" after the first failed synchronisation attempt.

    We are the all singing, all dancing crap of the world. - Tyler Durden

    Clever Code csharp question

  • A (not so subtle) leak...
    J Jan van den Baard

    No. When the timeout occures the Receive() method does exit and returns -1 but the thread occupied by the BeginReceive() call does not exit. In other words it slowly (or fast depending on how often it used) fill's up all threads on the ThreadPool with nasty consequences for everything else depending on the ThreadPool. Changing

    else
    {
    return -1;
    }

    to

    else
    {
    state.Socket.Close();
    return -1;
    }

    fixed it.

    We are the all singing, all dancing crap of the world. - Tyler Durden

    Clever Code csharp question

  • A (not so subtle) leak...
    J Jan van den Baard

    Sorry about that... Did not notice it (damn those 1920x1200 screens :-\ )

    We are the all singing, all dancing crap of the world. - Tyler Durden

    Clever Code csharp question

  • A (not so subtle) leak...
    J Jan van den Baard

    In a project I am working on I had to do NTP time synchronisation on a WindowsCE client. The UdpClient it's Receive() call does not time out so I found this solution on the web:

    public class UdpTimeoutClient : UdpClient
    {
    	private class SocketState
    	{
    		public Socket Socket;
    		public byte\[\] Buffer;
    		public int BytesRead;
    		public ManualResetEvent WaitHandle;
    
    		public SocketState()
    		{
    			Socket = null;
    			Buffer = null;
    			BytesRead = 0;
    			WaitHandle = new ManualResetEvent(false);
    		}
    	}
    
    	private static void ReceiveCallback(IAsyncResult ar)
    	{
    		SocketState state = (SocketState)ar.AsyncState;
    		try
    		{
    			state.BytesRead = state.Socket.EndReceive(ar);
    		}
    		catch
    		{
    		}
    		state.WaitHandle.Set();
    	}
    
    	public int Receive(ref byte\[\] buffer, int timeout)
    	{
    		SocketState state;
    		AsyncCallback callback;
    		IAsyncResult result;
    		
    		state = new SocketState();
    		state.Socket = Client;
    		state.Buffer = buffer;
    
    		callback = new System.AsyncCallback(UdpTimeoutClient.ReceiveCallback);
    		result = state.Socket.BeginReceive(state.Buffer, 0, state.Buffer.Length, System.Net.Sockets.SocketFlags.None, callback, state);
    		if (state.WaitHandle.WaitOne(timeout, false))
    		{
    			return state.BytesRead;
    		}
    		else
    		{
    			return -1;
    		}
    	}
    }
    

    Can you spot the leak?

    We are the all singing, all dancing crap of the world. - Tyler Durden

    Clever Code csharp question

  • Hide IE7 Search Box (woot!)
    J Jan van den Baard

    And for those of us still using XP Home simply create the following DWORD in the registry: HKEY_CURRENT_USER/Software/Microsoft/Internet Explorer/InfoDelivery/Restrictions/NoSearchBox and set it's value to 1.

    We are the all singing, all dancing crap of the world. - Tyler Durden

    The Lounge com windows-admin question

  • Widescreen TFT displays
    J Jan van den Baard

    I know Acer has one, the AL1916WS. Bye, Jan We are the all singing, all dancing crap of the world. - Tyler Durden

    The Lounge csharp html com data-structures tools

  • SQL Server 2000 CE Edition...
    J Jan van den Baard

    I have a simple CE.NET application running on a embedded machine running Windows CE.NET 4.2 and SQL Server 2000 CE Edition 2.0. In this application I am using a standard SqlCeCommand object to run the following query: UPDATE tblschedules SET tblschedules.result = ( CASE WHEN EXISTS ( SELECT * FROM tblscheduledetails WHERE tblscheduledetails.schedule = tblschedules.id AND tblscheduledetails.result = 1 ) THEN 1 ELSE 0 END ) The query results in a "A native exception occured" just as soon as I do a ExecuteNonQuery() on the object. The query itself runs without problems when running it from the CE Query Analizer. Does anybody have an idea what might be the problem? We are the all singing, all dancing crap of the world. - Tyler Durden

    Database database csharp c++ sql-server sysadmin

  • Strange ActiveX behaviour.
    J Jan van den Baard

    I have created a basic MFC ActiveX control using the VS wizard. I added one stock event, the MouseMove event. The problem is that for whatever reason the MouseMoveEvent is constantly fired wether the mouse is actually being moved or not. I have tested this with both VS.NET 2003 and beta 2 of VS.NET 2005. Both with the same weird behaviour. I have also tried to manually call the FireMouseMove() in COleControl with the same result. As soon as I call FireMouseMove() once I keep getting MouseMoveEvent's. Does anybody have a clue what is going on? Thanks, Jan We are the all singing, all dancing crap of the world. - Tyler Durden

    COM question csharp c++ visual-studio com

  • Assign static IP address..
    J Jan van den Baard

    Is there a way, in C/C++ code, to (re-)assign a static ip address of a Windows CE.NET machine? We are the all singing, all dancing crap of the world. - Tyler Durden

    Mobile csharp c++ question

  • drive mapping
    J Jan van den Baard

    Perhaps someone can help me... How do I get a drive mapping to work between a Windows 2000 professional machine and a WindowsCE.NET 4.2 machine? This is really bugging the hell out of me. I have build an OS image with, as far as I know, everything in it to support this but I cannot get it to work. I have added the appropiate registry keys in SMBServer and it just wont work. Pinging between the two machines works so there is communication between the machines but I cannot map a drive or folder no matter what I try. Am I missing something? We are the all singing, all dancing crap of the world. - Tyler Durden

    Mobile question csharp windows-admin help

  • EOS 300D...
    J Jan van den Baard

    Megan Forbes wrote: Awesome! What telephoto lenses do you have? I currently have the standard 18-55mm lens which came with the camera (I bought the set) and a 75-300mm from the "old" EOS 300. With a factor of 1.6 this should be more than enough to shoot a couple of good pictures from a "safe" distance. Megan Forbes wrote: A couple of tips - take some kind of beanbag or a couple of cushion covers you can fill with rice/beans when you get there to rest your lenses on. Nice one! I would never have thought of that. Thanks! Megan Forbes wrote: Also, take a circ polariser for your wide angle, and don't be afraid to use it! Don't forget a reliable alarm clock for the safari's - your best sightings will be before 10am and after 4pm. One of my favourite sayings is "a good alarm clock is the most important piece of modern technology for great photo's" Luckely I do have a circular polariser. I used it before and I must say when used properly it can make a world of difference. When I get back I will see if I can put together a web page with some of the results. Thanks, Jan We are the all singing, all dancing crap of the world. - Tyler Durden

    The Lounge question

  • EOS 300D...
    J Jan van den Baard

    Chris Maunder wrote: Remember to take the lens cap off. I guess I asked for this one :) We are the all singing, all dancing crap of the world. - Tyler Durden

    The Lounge question
  • Login

  • Don't have an account? Register

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