|
You know something Heath; don’t answer any more of my post.
You have a big chip on your shoulder.
I have never seen you correct someone's
Spelling before, all you are doing is being a smart ass.
It is because of me posting some of your previous posts when you
start bashing people for not doing this and not doing that.
What is your problem? I could understand that being
vague or something but to start a post with
("Specific". "Pacific" is the world’s largest ocean.)
Is nothing more than the arrogant, self absorbed, inconsiderate
prick that you are.
Now did I misspell anything this time?
This is what Heath Stewart thinks about Certifications.
Heath Stewart said
"Personally, I am not certified because I really don't want to be. I know a large number of people with certifications that know crap. They studied for the tests, memorized a few things, took the tests (sometimes a couple times) and got their certs. They're still idiots."
|
|
|
|
|
Heath,
I agree with Bo.
Please do not waste our time with negative and counterproductive rants.
Karl
|
|
|
|
|
Please don't waste your time? I reply to about 1,000 posts per month in this forum - I don't see your name as a reply to even a fraction of as much. It's people that don't state what the problem is and expect the other regulars and me to debug their code for them that wastes time.
Saying "it doesn't work" is a waste of the developers' time who spend their time in this forum answering questions on a regular basis, and it is happening more often lately.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi Bo,
First off let me apologize for the rudeness of others. This is the place to post questions like these, and you did show us in the code exactly where the problem was occurring.
I believe that replacing your troubled lines with the following might fix your problem.
<br />
*ch3++ = *( ch2 + ( 1 * (( *b2 & 240 ) >> 4 )));<br />
*ch3++ = *( ch2 + ( 1 * ( *b2 & 15 )));<br />
b2++;<br />
Best of Luck!
Karl Baum
CEO of KGB Technologies
Specializing in custom software development.
|
|
|
|
|
Background: Winforms Dialog Application, .NET 2003
Overview:
1 form, contains:
panel for main content
panel for navigation
2 custom controls loaded into main forms depending on scenario
1 class containing my event
Description:
This is apparently beyond the scope of the issue but may be important.
The app starts, it loads one of the childern controls into the form's main content panel. It passes the event class as a parameter. A user clicks on an item in the control, the event class's public method is called with the items id. The class functions internally calling the delegate, etc. The main form catches the event and proceeds to switch the main panel's control.
Up to this point the application functions properly. Now heres the oddity I have found. The event handler gets triggered, does some processing and then calls:
PanelMain.Controls.Clear();
// set control
tabbed = new CtrlMainTabbed( m_meeting );
// Load tabbed control onto main panel
this.PanelMain.Controls.Add(tabbed);
// Add the Panel to the Form.
this.Controls.Add(PanelMain);
The issue: the control is loaded properly and functions nicely if ann ONLY IF the next mouse click occurs in the application. If the mouse is clicked on any other application, or if a MessageBox is spawned by that method, the application reaches an inactive state. The title bar becomes a light blue, and the application will not recieve events. Now as I mentioned, if the application is clicked immediatly after the swirching of the panel contents, all functions normally.
I have isolated the problem to PanelMain.Controls.Clear();
I have also tried PanelMain.Controls.Remove( myItem1 );
Both result in this behavior.
I have tried calling invalidate to repaint the panel / form, along with numerous other ideas, that I will not bother with here. My assumption is that there is an event in the message pump that isnt being dealt with properly, most likely the result of me calling Clear on the panels contents.
Also, I have tried simply running the app and loading the panels, then clearing it and then loading it again and this works properly.
So what I'm gathering is the delegate and the clear event are not behaving well together. The issue appears to me to be related to the events / threads.
Keeping in mind I may be way off in my assessment, does anyone have any ideas?
|
|
|
|
|
I would agree something in the message pump is probably at fault here, so try calling Application.DoEvents at some point in that handler and see if that helps.
Also, for any calls that may be invoked from another thread (which may or may not include certain event handlers, like OnPaint when double-buffering is enabled) be sure to use Control.Invoke to make changes on the control's UI thread, although that doesn't seem to be your problem here.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks for your response Heath.
I followed your suggestion and tried the Application.DoEvents() at various points to no avail. I have also tried using MethodInvoker / Invoke to call Clear.
I have also noticed that coming back the other way ( loading the panels ), has the same effect. In this case, there is no event fired like the other way. The form's nav panel has a button bar that triggers the loading of the panels. Again I use Clear(), so it must be the call to Panel.Clear() regardless of the custom event. I will look more into properly clearing panels.
If anyone has any pointers thatd be great.
|
|
|
|
|
Thanks for your response Heath.
I followed your suggestion and tried the Application.DoEvents() at various points to no avail. I have also tried using MethodInvoker / Invoke to call Clear.
I have also noticed that coming back the other way ( loading the panels ), has the same effect. In this case, there is no event fired like the other way. The form's nav panel has a button bar that triggers the loading of the panels. Again I use Clear(), so it must be the call to Panel.Clear() regardless of the custom event. I will look more into properly clearing panels.
If anyone has any pointers
|
|
|
|
|
yeah excuse the double post, dar dar dar.
Ive noticed this as well, the red X in my control bar doesnt work, the buttons gets pressed and nothing happens. I recall now that I changed my menu Exit from this.Close() to Application.Exit(). this.Close() ceased to work. I notice in the description of Application.Close(), it says it flushes the message pump. S this must be the issue. Any ideas?
|
|
|
|
|
Hi
How can i handle concurrency in DotNet?
I need to update a record into a database table, by the time I will access the record there is a chance that somebody can change the record.
I know this kind of problem is common.
But never i had an oppurtunity to work this kind of problem.
please let me know the solution.
|
|
|
|
|
How do you want to handle the concurrency? It's not so much a problem with multiple clients using the same records as what your going to do about it. Do you want it so the first write wins, the last write wins, record locks, ... ? What do you want to happen when more than one client reads the data, starts to update the data, and/or write the data?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
What you need is a database transaction. This has nothing to do with .NET, however. For example, you may want to do the following things to the CurrentUsers table in the databse:
1. Check if there is a record with UserName field equals "John001".
2. If there is such a record, check if the value of the ExpirationDate field is less than today's date.
3. If yes, then delete this record from the CurrentUsers table and add a corresponding record to the ExpiredUsers table.
You can put all the above code into a database transaction so that it won't cause any problem if the same code is being executed from multiple threads/processes.
Again, this has nothing to do with .NET.
My articles and software tools
|
|
|
|
|
Hello,
In one of the apps I came across in a book Im reading, a form attaches itself to the SystemEvents.UserPreferenceChangedEvent. In the Dispose method of this form, it detaches itself.
My question is this: If the form is being disposed anyway, when you close it, why do you need to explicitly detach yourself from this event? I have never seen the need to detach events in the Dispose method before (for example, if the form is attached to the regular mouse events). What would happen if I didnt detach the form from the event?
Also, do controls automatically remove themselves form any events they are attached to when they are deleted/removed from the form?
Thanx for the help
-Flack
|
|
|
|
|
It is not necessary to remove an event handler. Typical cases for removing an event handler are when you want to stop handling events, like when you're updating something that would normally raise events and don't want notified while doing it (your object already knows it's changing something).
When you remove a control with event handlers from a form, it's handlers are not removed. The control is an object and is still alive after being removed from a form unless nothing else references it and the GC collects it.
Does it hurt to remove a handler from and event during disposal? Not in the sense that something will break - it's just extraneous instructions to execute.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I am trying to take a .pdf file and put it into a byte[]. Then send it through a webservice, and take that byte[] and create the same .pdf on the other end. Any suggestions??
|
|
|
|
|
As far as creating the PDF file, there are many libraries available (both free and commercial libraries) so you should try google.
As for serializing the PDF, you can do it the bad way to support older clients and save the PDF to a MemoryStream . From that you can get a (very large) byte[] array that you can marshal across machine boundaries to the web service. There you create another Stream (either a FileStream to create an actual file, or a MemoryStream , or any other binary stream class) and write the bytes from the request to the stream. The byte[] array is the file, so there's no conversion necessary.
Why is that a bad way? Well, a byte is 8 bits. If the XML Web Service uses ASCII encoding, then each character (since SOAP is a text format, not binary) is 8 bits. No harm there. Unfortunately for you, most XML Web Services use either UTF-8 or Unicode encodings. UTF-8 uses characters anywhere from 8 to 16 bits (1 to 2 bytes), where Unicode uses characters that are 16 bits or 32 bits. Now you're wasting a lot of bandwidth. And to serialize this document might also be a waste of time (in terms of CPU time, depending on the source of the file and how you serialize it).
Instead, download the Microsoft Web Service Enhancements[^] (WSE) and read Sending Files, Attachments, and SOAP Messages Via Direct Internet Message Encapsulation[^]. The DIME specification defines a contract whereby the XML Web Service can send and receive binary data before the SOAP header. This can significantly increase performance and is an industry standard (along with the other specifications covered by the WSE).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks I ended up getting it to work right before I looked back at the Forum!
|
|
|
|
|
BTW, I didn't explain something quite right. If you encode binary data as characters, it depends on the encoding you use how many bytes are required to represent a byte, plus the text encoding for how many bytes that representation requires.
As Daniel said, you could encode the file (actually, the byte[] array I mentioned) as base64. That's going to require less bytes than base16 (2 characters per byte, otherwise known as hexidecimal) but still more than a single byte. Layer on top of that the character encoding (for example, using hex encoding with a UCS-2 text encoding yields 4 bytes per source byte!), and you have a serious performance and bandwidth problem.
Be sure to check out that article on DIME. It's easy to implement (the WSE 2.0 SDK has a very simple example of all that's required) and worth the (little) effort.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
|
Hi, I have an asp.net app with a web form that contains a listbox. The app also contains a frameset, which is loaded by a Contents.htm file.
When the user chooses a number from the list box, I need to pass that number to the href element i.e
"a href="Mail[choosen number].aspx" etc." in the contents file.
E.g user chooses 3 from listbox, should pass 3 to contents.htm and place 3 in the href element...
So the page "a href="Mail3.aspx" etc." is called.
Hope I make sense!! Thanks.
|
|
|
|
|
This question is much better handled in the ASP.NET forum. Just because the code-behind is written in C# doesn't mean that the question has anything to do with C#.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I created a web control to display html files on my form. My idea was to click space bar and to go to next file (html, picture or movie) in the folder, but my form looses focus and doesn't pick up the keypress event. I turned on key preview and made a button which should get the focus after the web control displays what it is suppose to diplay. The problem I am having is that when I am playing a movie or a flash file, it won't transfer the focus to the button or to the form. But, if I make a messagebox right after I give button the focus, then the focus is set to the button. How can I fix this?
|
|
|
|
|
Are your waiting for the HTML document to completely load before you set the focus back to your button? Are you setting the focus inside the DocumentComplete event of the WebBrowser control?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I just tried setting the focus to a button in the DocumentComplete event so the form would be able to pick up the keypress event, but still doesn't work.
|
|
|
|
|
Given the limitations of comercial solutions, I'm writing a custom app installation utility. I'm writing it in a generic manner. However, the application I'm initially writing it for has a mixture of .NET and ASP 3.0/COM+ functionality. As such, I need to be able to:
- Create/Delete COM+ Applications and set properties.
- Register/Unregister COM+ components (NOT assemblies) in those applications and set properties.
I've written a class that successfully creates applications and adds components. However, using COMAdminCatalog.InstallComponent() to add components to the application adds exactly 18 entries to the registry. By contrast, simply registering a component and its type library using regsvr32 adds only 10.
My Issue: Using either COMAdminCatalog.Remove() or resvr32 /u doesn't remove ALL registry entries, but leaves 6 entries, all under HKLM\SOFTWARE\Microsoft\COM3\SelfReg. The entries left in there include a CLSID, ProgID and type library.
My Question: I've searched the .NET fx high and low and looked for options for interop, all to no avail. How do I programmatically remove ALL references of a COM+ DLL from the registry so as not to cause any potential conflicts (DLL hell) in future upgrades where binary compatibility is broken? Thanx!
Boyd Campbell
Systems Engineer
|
|
|
|
|