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
B

Berlus

@Berlus
About
Posts
47
Topics
30
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Directing logcxx to a log4net appender
    B Berlus

    Hello, I'm Using a 3rd party software that uses log4cxx as its logging provider. I'm intersted in directing the log to a log4net appender, since my other programs uses log4net. Can anyone help me ? thanks, berlus

    C / C++ / MFC help question

  • Navigating between forms
    B Berlus

    Hello, Does anyone knows a form navigation framework that i can use in order to implement a winform application that shows a main form displaying a list of options, each option displays a different form, which in turn display a list of options and so on ? It is similar to wizard but with more hierarchies. Thanks, Berlus

    C# question

  • Using streams
    B Berlus

    Thanks for the quick response. Is there a way to insert the "serialization" code into the struct itself ? something like:

    #include <iostream>
    #include <fstream>
    using namespace std;

    struct MyStruct
    {
    ostream& operator<<(ostream& output) {
    output << " a: " << a << endl;
    output << " b: " << b << endl;
    return output;
    }

    int a;
    double b;
    

    };

    int main(void)
    {
    MyStruct ms;
    ms.a = 5;
    ms.b = 4.2;

    cout << ms;

    // Write to a file without changing methods in MyStruct
    ofstream my_file("me.txt");
    my_file << ms;

    return 0;
    }

    I tried it, and got compilation errors. IntelliSense: no operator "<<" matches these operands I am trying to create some sort of a generic ToString. Thanks, Berlus

    C / C++ / MFC help question

  • Using streams
    B Berlus

    Hello, I need help in converting these two function into one function (since basicaly it is the same code). Does anoyone have an idea ?

    struct File_Writer
    {
    File_Writer(ofstream& output) : m_output(output) { ; }
    void operator(MyStruct& ms)
    {
    output << ms.a << endl;
    output << ms.b << endl;
    }
    ofstream& m_output; };

    struct Display_Writer
    {
    void operator(MyStruct& ms)
    {
    cout << " a: " << ms.a << endl;
    cout << " b: " << ms.b << endl;
    }
    };

    Thanks, Berlus

    C / C++ / MFC help question

  • Design Pattern of separating data and business logic
    B Berlus

    Hello, Which design pattern would you recommend to use, if i want to separeate data from the Business logic in c++ ? Thanks, Berlus

    C / C++ / MFC c++ design business regex architecture

  • How to disable the "jump to url" option from the chm viewer (html help) ?
    B Berlus

    Hello, I'm trying (for security reasons) to diasble\remove\supress the "jump to url" menu item that appears in context menu of the chm viewer ? When I googled it I came across sites that explain how to do so, but in the process they also disabled the run command (which I need). Any Ideas ? Thanks, Eyal

    Windows API html security help tutorial question

  • How can I filter certain messages in log4net
    B Berlus

    I am afraid i didn't make myself clear. I'm trying to filter the log messages ONLINE, not after the program has ended. I'm trying to reduce the size of the log files that get created each run. thanks, Belrus

    C# question

  • How can I filter certain messages in log4net
    B Berlus

    Hello, I'm using a 3rd party that uses log4net in order to log its messages. I'm interested only on those messages that do not include "UnwantedTextExample". How can I configure the config.log4net in order to not log those messages? Thanks, Berlus

    C# question

  • Automated UI Tests of GDI
    B Berlus

    Hello All, I'm writing a dll that paints on the screen a gdi object. How would you recomed me to perform automated UI test ? I would like to draw the gdi object on the screen and compare it with a storded image. I know I can caputre the screen and compare it to that image, but i was thinking maybe using the visual studio 2010 UI Automated test. Thanks, berlus

    C# csharp visual-studio graphics design question

  • Accessing class properties using foreach or any iteration method
    B Berlus

    Seemed like a prefect case for using "Reflection". Try seraching "get property by reflection c#" berlus

    C# algorithms help question

  • Creating a new user control using decorator pattern
    B Berlus

    T M Gray wrote:

    Why are you using a control that doesn't do what you want it to?

    Form where do i get such control ? anyway, here is the first version of the class, I hope i'm not abusing this forum ...

    using System;
    using System.Drawing;
    using System.Net.NetworkInformation;
    using System.Windows.Forms;

    namespace TestProgressBar
    {
    public abstract class ProgressBarDecorator : ProgressBar
    {
    protected ProgressBar m_decoratedProgressBar; // the Window being decorated

        public ProgressBarDecorator()
        {
    
        }
    
        public ProgressBarDecorator(ProgressBar p\_decoratedProgressBar)
        {
            this.m\_decoratedProgressBar = p\_decoratedProgressBar;
        }
    
    }
    
    // the first concrete decorator which adds vertical scrollbar functionality
    public class NotifiableProgressBarDecorator : ProgressBarDecorator
    {
        public long FullAmount;
    
        public void InformOnNewData(long p\_newDelta)
        {
            float normalizedSize = Maximum - Minimum;
    
            if (FullAmount != 0)
            {
                int newValue = Value + (int) (p\_newDelta/(float) FullAmount\*normalizedSize);
    
                if ((Value + newValue) <= Maximum)
                {
                    Value += newValue;
                }
                else
                {
                    Value = Maximum;
                }
            }
        }
    
        public void Clear()
        {
            FullAmount = 0;
        }
    
        public NotifiableProgressBarDecorator()
        {
        }
    
        public NotifiableProgressBarDecorator(ProgressBar p\_decoratedProgressBar)
            : base(p\_decoratedProgressBar)
        {
        }
    }
    
    public class NetworkNotifiableProgressBarDecorator : NotifiableProgressBarDecorator
    {
        private NetworkInterface adapter;
        private Timer m\_timer = new Timer();
        private long m\_lastSentBytes;
    
        public NetworkNotifiableProgressBarDecorator()
        {
            adapter = NetworkInterface.GetAllNetworkInterfaces()\[1\];
    
            m\_timer.Interval = 500;
            m\_timer.Tick += onTimerTick;
        }
    
        public void Init(int p\_totalNofBytes)
        {
            FullAmount = p\_totalNofBytes;
            m\_lastSentBytes = adapter.GetIPv4Statistics().BytesSent;
            m\_timer.Start();
        }
    
        private void onTimerTick(object p\_sender
    
    C# winforms csharp sysadmin tools regex

  • Creating a new user control using decorator pattern
    B Berlus

    Thanks

    C# winforms csharp sysadmin tools regex

  • Creating a new user control using decorator pattern
    B Berlus

    After rereading the article i'm attaching a sample class:

    public abstract class ProgressBarDecorator : ProgressBar
    {
    protected ProgressBar m_decoratedProgressBar; // the Window being decorated

        public ProgressBarDecorator()
        {
            
        }
    
        public ProgressBarDecorator(ProgressBar p\_decoratedProgressBar)
        {
            this.m\_decoratedProgressBar = p\_decoratedProgressBar;
    }
    
    }
    
    // the first concrete decorator which adds functionality
    public class NotifiableProgressBarDecorator : ProgressBarDecorator
    {
    
        public NotifiableProgressBarDecorator()
        {
            
        }
        public NotifiableProgressBarDecorator(ProgressBar p\_decoratedProgressBar)
            : base(p\_decoratedProgressBar)
        {
        }
    
        protected override void OnCreateControl()
        {
            base.OnCreateControl();
            this.BackColor = Color.Green;
            this.Value = 50;
        }
    }
    

    }

    It is the base design fot my implementation, if it will be any good, i might consider posting as an article. Your thoughts ans suggestions are most welcome. Thanks, Belrus

    modified on Friday, June 18, 2010 5:17 PM

    C# winforms csharp sysadmin tools regex

  • Creating a new user control using decorator pattern
    B Berlus

    Thanks for your answer, it is execatly what I was aiming for, beacause I need some help understanding the pattern. I've looked up decorator pattern in wikipedia, and i quote: http://en.wikipedia.org/wiki/Decorator\_pattern "In object-oriented programming, the decorator pattern is a design pattern that allows new/additional behaviour to be added to an existing object dynamically." dynamically, as you said. but in the motivation part: "As an example, consider a window in a windowing system. To allow scrolling of the window's contents, we may wish to add horizontal or vertical scrollbars to it, as appropriate. Assume windows are represented by instances of the Window class, and assume this class has no functionality for adding scrollbars. We could create a subclass ScrollingWindow that provides them, or we could create a ScrollingWindowDecorator that adds this functionality to existing Window objects. At this point, either solution would be fine." which seemed like what i'm trying to do. Thanks, Berlus

    C# winforms csharp sysadmin tools regex

  • Creating a new user control using decorator pattern
    B Berlus

    Thanks for your answer. The problem is that the file copying is in 3rd party Dll, and I'm aware only to the side effects of the copying process. And, I would like to use this opportunity to exercise the decorator pattern. thanks anyway, Berlus

    C# winforms csharp sysadmin tools regex

  • Creating a new user control using decorator pattern
    B Berlus

    Hello all, To demonstrate the decorator pattern, many articles gives as an example the ability to extend user controls (e.g. a window) with another ability (e.g. scrollable bar). I'm trying to use it in winforms and extend the ProgressBar. I'm building a utility function that copy some files from one network drive to another network drive, and I would like to supply also a progress bar that will show (as accurate as possible) the progress of the copy. In order to that I want to extend the progress bar with a full amount property, and a sniffing method (supplied by the user, e.g. querying the network adapter), and thus the progress bar would display the size so far divided by the known full amount. Decorator pattern seems the perfect choice but i can't seems to implement in winforms. Thanks, Berlus.

    C# winforms csharp sysadmin tools regex

  • Performance framework \ utility
    B Berlus

    I think I've found the problem, the function was inlined, so its name doesn't appear in the performance report. Does anyone know how to measure such functions ? Thanks, Eyal

    C# question design tools performance

  • Performance framework \ utility
    B Berlus

    How can I use the VS2008 profiler to profile UI Thread ? When I use it to profile my winform, It recorded only the function executed on the Main threadm and not the UI thread. Thanks, Berlus

    C# question design tools performance

  • Mesauring paint on a winforms panel
    B Berlus

    Thanks for your answer, I will try to explaing myself better next time. I hope I won't vommit from your spoon , :).... Thanks, Berlus

    C# question csharp winforms

  • Mesauring paint on a winforms panel
    B Berlus

    Thanks, By symbol I mean a GDI+ drawings (such as pen, circle, etc). Do you have any suggestions on how to implement a panel with a textbox, that upon invalidation and repainting, that text box will be updated with the amount of time it took the panel to repaint itself ? Thanks, Berlus

    C# question csharp winforms
  • Login

  • Don't have an account? Register

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