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

jlgeris

@jlgeris
About
Posts
13
Topics
4
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Dynamic char Array
    J jlgeris

    Well, I need the array in that format because I'm working with another proprietary API that works only with standard C types.

    C / C++ / MFC help data-structures

  • Dynamic char Array
    J jlgeris

    I know. This was the quick and dirty solution, but i'm open to alternatives.

    C / C++ / MFC help data-structures

  • Dynamic char Array
    J jlgeris

    FYI

    	int my\_malloc(void \*\*param\_adr,	int param\_size)
    	{
    		my\_free(param\_adr);
    		if ((\*param\_adr = malloc(param\_size)) == NULL)
    		{				
    			return -1;
    		}
    		memset(\*param\_adr,0,param\_size);			
    		
    		return 0;
    	}
    
    	void my\_free(void \*\*param\_adr)
    	{
    		if (\*param\_adr != NULL)
    		{
    			free(\*param\_adr);
    			\*param\_adr = NULL;
    		}
    		return;
    	}
    
    C / C++ / MFC help data-structures

  • Dynamic char Array
    J jlgeris

    Essentially, I'm reading some names from a text file, and I need to allocate the array at runtime. I'm missing something regarding the allocation of each individual name. After I copy the first name into the array slot, it fills up every spot in the array with the first value. After the loop finishes I have an array with [count] copies of the initial value I read from the file. I'm using the StreamReader class in other places in the program so that's why I'm marshaling the string to a char*. Maybe not the ideal solution, but I believe the problem is separate from that.

    char **temp=NULL;
    my_malloc((void**)&temp,count*sizeof(char*));

    StreamReader^ din = File::OpenText(fileName);
    String^ str;

    while ((str = din->ReadLine()) != nullptr)
    {
    char* x = (char*)System::Runtime::InteropServices::Marshal::StringToHGlobalAnsi(str).ToPointer();
    my_malloc((void**)&temp[count],strlen(x)*sizeof(char)+1); //i imagine the problem is here
    strcpy(temp[count],x); //or here
    System::Runtime::InteropServices::Marshal::FreeHGlobal((IntPtr)x);
    count++;
    }

    The my_malloc function is just a wrapper around free() and malloc(). Thanks for the help.

    C / C++ / MFC help data-structures

  • WPF Processor Usage
    J jlgeris

    I have some event handlers for other controls, but not relating to the canvas. The lines are being constructed with code, basically: PointCollection pc = BunchOfPoints; polyline.points = pc; this is done 6 times Right now the mouse doesn't play a role. I would like to be able to manipulate the display, but right now the system slows down if i simply move the mouse over.

    WPF csharp wpf question discussion

  • WPF Processor Usage
    J jlgeris

    i could do this using GDI w/o a problem...

    WPF csharp wpf question discussion

  • WPF Processor Usage
    J jlgeris

    the Code tag was me not entering my code in correctly into the meassge box :) well, i set the xy's in the c# code. it's hard for me to show, b/c the system slows when i add a few thousand points to each of the polyline. common sense says, right, there's a lot of data in memory to plot these lines, but i wouldn't expect so much processing when i'm not manipulating the data contained in the polylines. when i move the mouse over the plot, is it invalidating the image every movement(forcing a re-render)?

    WPF csharp wpf question discussion

  • WPF Processor Usage
    J jlgeris

    in the current application, i'm not continuously updating the gridlines or polylines. I've simply added points to them, and then displayed them. there's not a whole lot of code other than that..

    WPF csharp wpf question discussion

  • WPF Processor Usage
    J jlgeris

    Via a Canvas and 6 polylines, I have a good amount of data plotted on the screen, and I've noticed that even without updated the polylines (changing their values), the processor becomes bogged down when I simply move the cursor over the canvas. I realize the OS must redraw the screen when the mouse moves, but could there be something with the way I'm using the Canvas, that creates unnecessary rendering? I mean, all I'm doing is moving the mouse anywhere over the canvas, and I experience a processor usage jump of ~50-60%. I'm not using a MouseOver event either. Any thoughts?

    WPF csharp wpf question discussion

  • Efficient Real-Time X-Y Plotting/Graphing
    J jlgeris

    Thanks Chris, I understand that the there are other places i could have posted it, but since i'm utilizing WPF, i thought there might be some features or anything else i didn't know about. Oh well. I agree, measurement data would be too difficult to find patterns. I'm displaying the data in real-time (say 10 points/sec), and could have up to 6 axes. I'm using the Polyline in WPF, and it's just something that could potentially be a processing/memory bottleneck. Thanks for the help though

    WPF csharp wpf data-structures regex tutorial

  • Efficient Real-Time X-Y Plotting/Graphing
    J jlgeris

    I could have asked this in a number of sections, I know, but the following is using WPF.. I'm working on an application that graphs data for given time intervals. For example, I could be collecting data in real time, and i'm graphing the last 5 minutes of the data up to the current point. When I have multiple axes, the number of points for each axis can become large fast. I have to go though and process all of these points every time I update the graph. When I have points that are in a pattern, or straight line, it doesn't make since to keep all of the ones in the middle. Does anyone know of any algorithms/data structures to efficiently process a large number of coordinates? Thanks!

    WPF csharp wpf data-structures regex tutorial

  • Client/Server Disconnection
    J jlgeris

    well, my problem is that i don't want to attempt to send data to the disconnected clients every iteration. i'd like to remove them from the Client collection without phasing the server. thanks for the response.

    C# help csharp sysadmin question

  • Client/Server Disconnection
    J jlgeris

    I have a fairly simple client/server structure using System.Net.Sockets, where the server only sends data to a collection of clients, and the clients only receive data, so, the data flow is unidirectional. My server sends the same data to each of the connected clients, at the same time through a for loop. The loop sends the data, or removes the client if it has disconnected. My problem is when the client disconnects, it can cause the server program to pause. This is where the server distributes the data: for (int i = Clients.Count - 1; i >= 0; i--) { if (((Client)Clients[i]).isAlive() && serve) { ((Client)Clients[i]).send(data.get_bytes()); } else { ((Client)Clients[i]).Stop(); // releases resources associated w/ client Clients.RemoveAt(i); } Also in the server code, there is a client handling class, and this is the send function used above: try { ns.Write(sendB, 0, sendB.Length); } catch (***Exception) { } //if there's an error i will say that the client has disconnected, and isAlive = false; I would like to keep it simple and have the client disconnect, whether or not the client disconnected on purpose, or the connection is cut. The actual client code is simple, and just sits in a loop waiting to call the NetworkStream read() call. I'm sure there's a better and more efficient way of handling the client disconnecting, b/c i don't want this to affect the remaining clients, if one disconnects for any reason. Any ideas? Thanks.

    C# help csharp sysadmin 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