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
R

Ray Hayes

@Ray Hayes
About
Posts
330
Topics
45
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Recommendation for an 8 core system
    R Ray Hayes

    We've got several Dell Precision T7400's at work configured with 2x Quad Xeon running @ 3.2GHz. I'd strongly recommend getting the fastest hard disks you can afford as this much CPU power can be bottlenecked easily by slow disks (if that's the nature of your tasks). Don't skimp on memory either, go 64bit and these machine support 32GB of RAM!

    Regards, Ray

    The Lounge asp-net com sysadmin question

  • Long pockets, short arms.
    R Ray Hayes

    Everyone was alright, but I cried all night

    Regards, Ray

    The Lounge visual-studio announcement

  • Scaling woes
    R Ray Hayes

    PERFECT... that was it. Thanks a lot Tom, I felt I've learned a lot with your help! Thanks again!

    Regards, Ray

    WPF wpf csharp css wcf help

  • Scaling woes
    R Ray Hayes

    Ok, given that they're both working on a source of "scale" and a Path of ScalingFactor (ignoring Mode), that leaves the fact that the second isn't a StaticResource. I'm not certain how to convert between the two markup conventions (although I guess I could expand out the Slider's "Value" element). I tried this and it doesn't change anything :-(

    <Slider x:Name="scaleSlider" Width="100" Minimum="0.5" Maximum="10.0" Value="{Binding Source={StaticResource scale}, Path=ScalingFactor, Mode=TwoWay}"/>

    Regards, Ray

    WPF wpf csharp css wcf help

  • Scaling woes
    R Ray Hayes

    I've now got this, but it still doesn't look like it works: Xaml is now:

    <Slider x:Name="scaleSlider" Width="100" Minimum="0.5" Maximum="10.0" Value="{Binding Source=scale, Path=ScalingFactor, Mode=TwoWay}"/>

    I'd changed the binding in the MultiBinding to:

    <Binding Source="{StaticResource scale}" Path="ScalingFactor"/>

    Error in Output window is: System.Windows.Data Error: 35 : BindingExpression path error: 'ScalingFactor' property not found on 'object' ''String' (HashCode=-528916476)'. BindingExpression:Path=ScalingFactor; DataItem='String' (HashCode=-528916476); target element is 'Slider' (Name='scaleSlider'); target property is 'Value' (type 'Double') I'm sure the error will help, once I understand it! ;-)

    Regards, Ray

    WPF wpf csharp css wcf help

  • Scaling woes
    R Ray Hayes

    Great! The application now runs, but moving the slider doesn't seem to result in the MultiBinding being called again (break-pointing doesn't stop the code).

    Regards, Ray

    WPF wpf csharp css wcf help

  • Scaling woes
    R Ray Hayes

    Ok, that makes sense too. When I run (or indeed the designer does the same). I've now got an exception being fired by the WidthScaler

    if ( values.Length != 2 ||
        values[0].GetType() != typeof(double) ||
        values[1].GetType() != typeof(double) )
    {
        throw new NotSupportedException("Source values should be a pair of doubles");
    }

    The debugger shows that the first value, Duration, is correct. But the second, is DependancyProperty.UnsetValue. If I remove the throwing of an exception and return null, the WidthScaler (the IMultiValueConverter) doesn't seem to be called again!

    Regards, Ray

    WPF wpf csharp css wcf help

  • Scaling woes
    R Ray Hayes

    I'm going to reply to myself as looking at the code I wrote I'd made an obvious mistake. Note, I still get the same exception but the following code is now used:

    <Slider x:Name="scaleSlider" Width="100" Minimum="0.5" Maximum="10.0"
            Value="{Binding ElementName=scale, Path=ScalingFactor}"/>

    and

    <Border.Width>
        <MultiBinding Converter="{StaticResource widthScaler}"
                     ConverterParameter="">
            <Binding Path="{Binding Duration}" />
            <Binding ElementName="scale" Path="ScalingFactor"/>
        </MultiBinding>
    </Border.Width>

    Hopefully this is now a little closer to the correct solution! Is it? :-\

    Regards, Ray

    WPF wpf csharp css wcf help

  • Scaling woes
    R Ray Hayes

    Tom, thanks for your reply. Your suggestions make a lot of sense and have, I feel, pointed me in the right direction. Although I think I'm messing up on step 6! This is what I've done so far:

    TJoe wrote:

    1. Create a separate class (e.g. ScaleFactor) with a single property (e.g. Value) 2. Implement INotifyPropertyChanged in the ScaleFactor class and fire it when the Value changes.

    public class VisualScale : INotifyPropertyChanged
    {
        private double scale = 1.0;
        public double ScalingFactor
        {
            get { return scale; }
            set { scale = value; NotifyPropertyChanged("Scale changed"); }
        }

    #region INotifyPropertyChanged Members
        private void NotifyPropertyChanged(String info)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(info));
            }
        }
        public event PropertyChangedEventHandler PropertyChanged;
        #endregion
    }

    TJoe wrote:

    3. Create an IMultiValueConverter that takes two values: 1st will be the "value" from your underlying data (you don't have to use a TypeConverter, but you probably can), 2nd will be the scale factor. The IMultiValueConverter will then multiply the two values and return that.

    public class WidthScaler : IMultiValueConverter
    {
        #region IMultiValueConverter Members
        public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if ( targetType != typeof(double) )
            {
                throw new NotSupportedException("Target type of WidthScaler must be double");
            }

    if ( values.Length != 2 ||
       &nb

    WPF wpf csharp css wcf help

  • Scaling woes
    R Ray Hayes

    Hi, I'm trying to get my mind around a problem I'm having with WPF. It can easily be compared to something like a stacked-bar chart (BTW, that's not what I'm creating, so please don't point me to a library providing these). Visually the results should look something like this: NameA |-----||-----------||----| NameB |---------||-----------------| NameC |---||----------||-| At the moment I have an Observable collection of data that provides me with two types, the string for the name and another collection with the values. I have used a ListView to display my table and the values are represented by an ItemsControl putting the data values inside a horizontally organized StackPanel.

    <ListView ItemsSource="{Binding Source={StaticResource ResourceKey=data}}" Grid.Row="0" x:Name="myGrid">
        <ListView.View>
            <GridView>
                <GridViewColumn Header="Name" DisplayMemberBinding="{Binding Path=Name}"/>
                <GridViewColumn Header="Values">
                    <GridViewColumn.CellTemplate>
                        <DataTemplate>
                            <!-- Bind each item to the valueTemplate -->
                            <ItemsControl ItemsSource="{Binding Path=Values}"
                                         ItemTemplate="{StaticResource valueTemplate}">
                                <ItemsControl.ItemsPanel>

    WPF wpf csharp css wcf help

  • Japanese customs have been reunited with the 142g of cannabis they mislaid at Tokyo's Narita airport [modified]
    R Ray Hayes

    What would others do in his place? I for sure would not keep the drugs, but I'd sure be concerned that calling the Police would get me in a whole heap of trouble. The article doesn't make clear whether the person involved was Japanese and/or fluent in the language. Midnight Express[^] would keep coming to my mind.

    Regards, Ray

    The Lounge

  • OPEC Graph
    R Ray Hayes

    My last fill up was over £80 for 70litres of diesel. The saving grace for me was that I then did 500 miles @ 60miles to the gallon and will claim that back at 40p/mile - so I'll claim £200 back and still have enough fuel for a couple of weeks of normal commuting! I'm aware the mix of units might confuse some, but in the UK we drive "miles", buy "litres" and compare fuel efficiency in "miles per gallon" :wtf:

    Regards, Ray

    The Lounge data-structures

  • Question to ask an interviewee
    R Ray Hayes

    My favourite exercise for a programmer is to write code to calculate a (ten-pin) bowling score from a sequence. E.g. 91XX729-81XX9-91XX Demonstrates to me a number of things: - understanding a moderately complex, but well defined, algorithm - need to backtrack - coding style - ability to optimize - error checking of data If they get stuck, the input format can be made a bit clearer: E.g. 9 1 X X 7 2 9 0 8 1 X X 9 0 9 1 X X It's slightly amazing to me that some people, who claim to understand the rules (and can talk through it) can't even start to implement this in code! Bonus points for someone who writes unit-tests, a quick and dirty "GUI" (even if it's through the console). More bonus points if they can implement an interactive version that can compute the "best now attainable" score. I tend to time limit the task, but that is long enough to be an insightful period! I just wish I could get my company to formally adopt "testing" in _all_ interviews for programming positions - I'm sick of programmers employed by others getting drafted into my project that wouldn't have made my cut!

    Regards, Ray

    The Lounge question com tools

  • Data replication
    R Ray Hayes

    Looks interesting, I shall take a look.

    Regards, Ray

    The Lounge question performance help announcement

  • Data replication
    R Ray Hayes

    A Wong wrote:

    I think you're better off doing it from the command prompt, I believe it's slightly faster. Also, can't you do the copy to the harddrive on the server end, then just plug the HD into the clients?

    I have been, am and always will be a command line person - I caught the copy being performed by a team member using explorer. When I asked how long it had been "preparing" the answer was about 35minutes. After a few more minutes I asked them to abort and use the command line.

    Regards, Ray

    The Lounge question performance help announcement

  • Data replication
    R Ray Hayes

    norm .net wrote:

    I'd have each client running a BITS (Background Intelligent Transfer ) app

    My personal experience with BITS (Windows Update / MSDN) is that it's too slow - I have a 20Mbit connection at home and it rarely stresses it. In the situation I've described the machines share a 1Gbit LAN - actually each machine is connected to at least 3x 1Gbit LANs for traffic separation purposes and ALL of this could be used during the updates [at the system will be down WRT the users].

    Regards, Ray

    The Lounge question performance help announcement

  • Data replication
    R Ray Hayes

    Chris Austin wrote:

    Why not use something like TrueImage server to create an image and then replicate that image to your target machines.

    I was thinking "Ghost" at one point, but am not sure whether that will still kill the "source" machine whilst it tries to supply 20 machines.

    Regards, Ray

    The Lounge question performance help announcement

  • Data replication
    R Ray Hayes

    John C wrote:

    I'm thinking bittorrent as well,

    It's a possibility, I forgot that torrents can do multiple files - although the hundreds of thousands of files is going to most likely result in a very large .torrent - perhaps even be too big [although maybe it could still be handled with a pt1 and pt2 type strategy]. Difficulty will be getting our IT department [who's job it is to obstruct us at every turn] to allow running of the torrent s/w for trial purposes -- although I'm sure I could isolate things.

    John C wrote:

    however if you have the budget could you not use some sort of removable hard drive rack and copy it to them directly from the source then plug them into the other machines. Seems like a network is just too limiting for what you need. Hell, even opening the boxes and plugging in the hard drives is faster than copying.

    It's an option still under consideration - however, even with a disk to disk copy using SATA, it's fairly likely to still take hours for each transfer -- just "preparing to copy" with explorer took nearly an hour, hence me telling people about robocopy. Even if it dropped to 1hr per update (and assuming one at a time), it's going to be a couple of long days for the engineer.

    Regards, Ray

    The Lounge question performance help announcement

  • Data replication
    R Ray Hayes

    [Not a programming question...] I've tried Googling and it's likely I'm not using the correct terminology, so I'll ask here..... My company will in the future need to be able to update a number of machines (about 20) with mapping data. This data (hundreds of thousands of small files) is likely to be approaching 1TB and needs to be copied to each machine. These updates are likely to need to happen every few months in the first year but will settle down once all the bugs are fixed. It is fairly likely the incremental updates will not help - due to the nature of the data content. Yesterday in a very simple update with a reduced data-size, this took 23hours to copy using Robocopy [across a verified 1Gbit LAN]. Kicking off 20 parallel Robocopies is likely to kill the performance of the "source" machine. Running the tasks in sequence is going to take far too long and have too much manual input. Does anyone know of a better way? Wearing my programming hat, I'd have a "transmitter" on the source machine multi-casting [even broadcasting, since it's a dedicated LAN and the machines will be off-line during this update] to each destination - which using it's client s/w would write the transmitted data. This should, in theory, allow all 20 machines to be updated in the same time that one machine would be. Before I resort to having development of such a tool added to our development schedule - does something like this already exist? Ideally free or lowish cost [e.g. < $2000]. Is there an easier solution?

    Regards, Ray

    The Lounge question performance help announcement

  • Who is going to switch to VS 2008?
    R Ray Hayes

    If you're planning on upgrading because you want to do something new, such as WPF, then VS2008 is obviously a nice new option - if it were my hard cash, I'd go for the free Express Edition.... If you have an MSDN subscription at work, double check the small print. IIRC you are allowed 5 separate installations, one of which can be at home [as long as it's only you using it]. With MSDN, you already have access to VS2008.

    Regards, Ray

    The Lounge visual-studio 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