Thanks Christian!
ke5in
Posts
-
Piecing 200 jpgs into a single jpg -
Piecing 200 jpgs into a single jpgI have 200 jpgs that originally were a single jpg. I need to tile these back (10x20) and save it out to a single jpg. Is it possible move blocks of memory around into the correct positions to reassemble the original jpg (after striping out the jpg header)? (Basically, I’m looking for a simple (i.e. lazy) way out without having to read through the jpeg specs.) Thanks in advance, Kevin
-
DataGrid and multiple threadsI’m using the MS DataGrid on a form. Each row displays the state of an instance of a class. When I load this form it creates the collection of these classes and spawns a maintenance thread that keeps these instances updated with info scraped from a website. Each class instance has a reference to the DataTable of the DataGrid and is able to update its own row in the grid. This works fine. You can sit back and watch this grid refreshing "in the background" while manipulating other elements of the form. I ran into problems when I tried to have this thread delete a row from the grid. Intuitively this makes sense since there is probably a race condition between the form thread and the maintenance thread where the delete is taking place. I got around this problem by having the actual grid row deleted on the form thread. But I'm worried that there might be some hidden race condition waiting to happen when I do my updates. Any comments would be greatly appreciated. :) Thanks, Kevin Here is the error I get when I delete from the Update thread. ===== An unhandled exception of type 'System.IndexOutOfRangeException' occurred in system.windows.forms.dll Additional information: No value at index 2. ===== Unhandled Exception: System.IndexOutOfRangeException: No value at index 2. at System.Windows.Forms.CurrencyManager.get_Item(Int32 index) at System.Windows.Forms.DataGridRow.PaintHeader(Graphics g, Rectangle visualBounds, Boolean alignToRight, Boolean rowIsDirty) at System.Windows.Forms.DataGridRelationshipRow.PaintHeaderInside (Graphics g, Rectangle bounds, Brush backBr, Boolean alignToRight, Boolean isDirty) at System.Windows.Forms.DataGridRelationshipRow.PaintHeader(Graphics g, Rectangle bounds, Boolean alignToRight, Boolean isDirty) at System.Windows.Forms.DataGrid.PaintRows(Graphics g, Rectangle& boundingRect) at System.Windows.Forms.DataGrid.PaintGrid(Graphics g, Rectangle gridBounds) at System.Windows.Forms.DataGrid.OnPaint(PaintEventArgs pe) at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs) at System.Windows.Forms.Control.WmPaint(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lpara
-
iPod...I just ordered one of these after poking around the Internet trying to find a player that would use Type I Compact Flash cards. I have a bunch of CF cards because of my camera. You can also use a 1GB IBM microdrive in this device if you are worried about the 100,000 write cycle limit. http://www.bjorn3d.com/_preview.php?articleID=62[^] I’ve seen other reviews talking about some firmware issues but for 79 bucks its worth a shot. ($79 w/o any memory. You can get a 512MB CF card for $70 after rebate on Amazon.)
-
HTTP GetResponse problemThanks Rocky, That did the trick.
-
HTTP GetResponse problemI’m trying to scrape a site but I’m having a problem. My program works for 4 iterations and then stops. I ported this code, line for line, over to Perl and it works fine. I stepped through the C# code and found that it hangs on this line: objStream = wrGETURL.GetResponse().GetResponseStream(); But it only hangs on the fifth time, it works for the first four times. This is baffling me, so I'm hoping one of you guys can figure out what is wrong.
-
posting code to this websiteThanks Ryan, That did the trick. I actually spent time digging around the css for the <proper> tag. Now, don’t I feel stupid. I guess this proves I'm not a "web page programmer" - whatever they are. -Kevin
-
posting code to this websiteWhen i post code here and use the <code> </code> tags all it does in change the color of the font and I loose the tabs. How are some people able to change the background color from this blue to the codeproject beige and keep the formatting???????
-
Outlook 2000 in C# (?)Hi, I need to a pointer to an article or web page or something that will help me get started in developing a certain app. Basically, I need to send an email that as user has written and the email message has to show up in the user’s Sent Items folder in MS Outlook. The program is to be deployed on computers with Win2K using Outlook 2000. I would like to do this in C# but since its Outlook 2000 would I be better off sticking to C++? Any pointers to creating an Outlook 2000 object in C# would be greatly appreciated! Thanks! Kevin
-
Code Review neededConsider this C# code: /////// public class Worker { public ManualResetEvent MyEvent; private Thread t; private string message = "nothing now"; //Constructor public Worker(string name) { t = new Thread(new ThreadStart(this.Work)); t.Name = "Worker: " + name; t.Start(); //I don't like the following line: while(t.ThreadState == ThreadState.Unstarted){} } //Property public string Message { get{return message;} set{message = value;} } //Thread function public void Work() { MyEvent = new ManualResetEvent(false); for(;;)//Loop forever { MyEvent.Reset(); MyEvent.WaitOne(); //Wait until "MyEvent" is Set Console.Write("Message:" + message + ".\r\n"); } } //terminate the thread public void kill() { t.Abort(); } } ////// Worker w = new Worker("Thread 1"); w.Message="Something"; w.MyEvent.Set(); .... w.Message="Something else"; w.MyEvent.Set(); ... w.kill(); ---------------------------------------------------------------- Q1: Is encapsulating the thread in the class like this bad practice? Q2: Assuming that there is nothing wrong with encapsulating the thread, is there anyway I can terminate it in a destructor? I would like to see this thread die when the instance of the class goes out of scope. I think explicitly calling the kill method is lame. (Or do I just have to get used to the way things are destroyed in C#?) Q3: What is the “approved” method of waiting for a thread to start? i.e. is there anything better than this: while(t.ThreadState == ThreadState.Unstarted){} ----- Any other comments would be appreciated. Thanks, -Kevin
-
Windows Message HandlingConsider this C++ code: //Thread 1 HWND target = ::SendMessage(hWnd, UWM_HERE_I_AM, (WPARAM)m_hWnd); //Thread 2 LRESULT CTheOtherApp::OnHereIAm(WPARAM wParam, LPARAM) { other = new CWnd; other.Attach((HWND)wParam); return (LRESULT)m_hWnd; } Q1: How would I "register" the OnHereIam handler in a C# Program? (I read about AddMessageFilter in MSDN but its rather vague to me.) Q2: What would the "return" statement look like? I mean how do you "cast" LRESULT in C#? Q3: I guess if there is a way to register the OnHereIam message handler I won’t need to write a custom WndProc. But if I have too write one how is this usually done? Thanks!
-
C++ SendMessageCool, thanks. I was just wondering if there was some C# or .NET way of doing this. They seem to abstract nearly everything else but I guess abstracting this would be getting too far away from an OS/hardware neutral language. Thanks for the info, -Kevin
-
C++ SendMessageI need to send a WM message to a thread. Is there a substitute for SendMessage? And, incidentally, is there a PostMessage equivalent? Thanks, -Keivn