|
I firmly believe the amount of IQ on this planet is a constant fixed value, yet the population that shares it keeps increasing.
|
|
|
|
|
Perhaps what we need is an IQ / sobriety test before you can connect to the internet?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
I think all the questions are posted by the same person with multiple personality disorder
|
|
|
|
|
And each personality got a fragment of the original IQ? Would explain a lot...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
100/12,124,996 isn't that much
|
|
|
|
|
That 100 there... it's just speculation
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
I feel so ashamed, was supposed to be a 10. I mean hamsters can't have more than that, can they?
|
|
|
|
|
lol...that is an amusing theory.
|
|
|
|
|
Sir, plz send link to Downloads tab.
|
|
|
|
|
ts ts Dave, you shouldn't shout to a blind person.
|
|
|
|
|
You mean they can't hear you any better when you scream at them?
|
|
|
|
|
Only hearing impaired people may hear and understand you any better when you scream at them.
Blind people in general tend to have developed better hearing, the hearing sense trying to compensate for a visual impairment.
|
|
|
|
|
And foreigners, apparently.
They all know English or American, just you have to shout to get them to admit it!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
="1.0"
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime maxRequestLength="2097150"
useFullyQualifiedRedirectUrl="true"
executionTimeout="14400" />
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_ITransferService" closeTimeout="04:01:00"
openTimeout="04:01:00" receiveTimeout="04:10:00" sendTimeout="04:01:00"
allowCookies="false" bypassProxyOnLocal="false"
hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647" maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8"
transferMode="Streamed"
useDefaultWebProxy="true">
<readerQuotas maxDepth="128"
maxStringContentLength="2147483647" maxArrayLength="2147483647"
maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="None">
<transport clientCredentialType="None"
proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https"/>
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="false" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<directoryBrowse enabled="true"/>
</system.webServer>
</configuration>
|
|
|
|
|
From where?
Name and IP address are both representing same thing. I cannot really understand why would you want to do that.
"You'd have to be a floating database guru clad in a white toga and ghandi level of sereneness to fix this goddamn clusterfuck.", BruceN[ ^]
|
|
|
|
|
I have a Buffer that is flushed/renewed based on the Buffer size. The events:
var KeyDown = Observable.FromEventPattern<KeyEventArgs>(this, "PreviewKeyDown");
var KeyUp = Observable.FromEventPattern<KeyEventArgs>(this, "PreviewKeyUp");
Where the buffer is done like the following:
KeyDown.Buffer(() => Observable.Merge(KeyDown.Where(evt=>evt.EventArgs.IsRepeat==false).Buffer(2), KeyDown.Where(evt=>evt.EventArgs.IsRepeat==false).Buffer(3)));
The Buffer(3) never happens, and this looks correct, but If I change the code slightly:
KeyDown.Buffer(() => Observable.Merge(KeyDown.Where(evt=>evt.EventArgs.IsRepeat==false).Buffer(2), KeyUp.Where(evt=>evt.EventArgs.Key==Key.LeftCtrl).Buffer(1)));
The Buffer(2) just hits once, I don't understand why the Buffer(2) dosent hit several times, if I hit 4 keystrokes for instance.
|
|
|
|
|
I'm really going to have to try this out as this looks unnecessarily complicated to me. I do have to wonder what you're trying to achieve with the KeyDown.Buffer as you aren't supplying a buffer value for this. Primarily I would have to see what you were doing when you actually observed the sequence as I don't see the actual observation happening here.
This space for rent
|
|
|
|
|
To be honest I don't consider this to have any practical use, it is just that I don't seem to get a clear picture of when the buffer, inside the buffer is cleared i.a.:
MyStream.Buffer(()=>Observable.Merge(MyStream.Buffer(9),MyStream.Buffer(7))
It seems as all the buffers are connected, flushed at the same time, so the highest Buffer is never reached.
|
|
|
|
|
EDIT this was an accidental post, problem is fixed!!
I am running / fixing all my unit test for my home made utilities.
I have a weak event build method which look like that
public static PropertyChangedEventHandler AddWeakHandler<T>(this INotifyPropertyChanged model, T target, Action<T, PropertyChangedEventArgs> action)
where T : class
{
var weakRef = new WeakReference(target);
PropertyChangedEventHandler handler = null;
handler = new PropertyChangedEventHandler(
(s, e) =>
{
var strongRef = weakRef.Target as T;
if (strongRef != null)
{
action(strongRef, e);
}
else
{
model.PropertyChanged -= handler;
handler = null;
}
});
model.PropertyChanged += handler;
return handler;
}
it is used like that (to show that there are no captured variable in the lambda expression
public object Source
{
get { return mSource; }
set
{
var p = Property;
if (p == null)
value = null;
if (value == mSource)
return;
if (Source is INotifyPropertyChanged)
{
((INotifyPropertyChanged)Source).PropertyChanged -= previous;
previous = null;
}
mSource = value;
if (Source is INotifyPropertyChanged)
{
previous = WeakEvents.AddWeakHandler((INotifyPropertyChanged)Source, this, (x, arg) => x.OnSourcePropertyChanged(Source, arg));
}
if (p != null)
{
p.OnPropertyChanged();
}
}
}
I have a simple (XUnit) test looking like that
[Fact]
public void CheckPropertyPathIsWeakEvent()
{
var m = new ModelForPathCheck();
int n = 0;
Action<string> onChanged = s => n++;
TriggerWeakEvent(m, onChanged, 2);
GC.Collect();
m.Name = "mooo";
Assert.Equal(2, n);
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
static void TriggerWeakEvent(ModelForPathCheck path, Action<string> onNameChanged, int nTimeChanged)
{
var pv = PropertyPath.Link(path, x => x.Name, onNameChanged);
for (int i = 0; i < nTimeChanged; i++)
path.Name = i.ToString();
GC.KeepAlive(pv);
}
sadly... the count is always 3 instead of 2 (in the assert)
any idea what might have gone wrong?!
modified 5-Mar-16 21:44pm.
|
|
|
|
|
I'm confused. The notification is raised (and usually collected) at the class level. There should be no point in changing the INotifyPreoprtyChanged, but whatever floats your boat I guess.
|
|
|
|
|
My bad... I should not have posted that!!!
Garbage collection worked fine (as test finalizer indicated) but the event was spuriously triggered in the PropertyPath constructor! all solved! ^^
|
|
|
|
|
on a side note I didn't understand your confusion!
|
|
|
|
|
full source code, for your understanding!
public class PropertyPath<TProp> : PropertyPath
{
internal PropertyPath()
{
}
public new TProp Value
{
get
{
var v = base.Value;
if (v is TProp)
return (TProp)v;
return default(TProp);
}
set { base.Value = value; }
}
}
public class PropertyPath : ModelBase
{
public static PropertyPath<TP> Link<T, TP>(T root, Expression<Func<T, TP>> e, Action<TP> onValueChanged)
{
var pv = new PropertyPath<TP>();
pv.PropertyChanged += (o, eargs) =>
{
if (string.IsNullOrEmpty(eargs.PropertyName) || eargs.PropertyName == "Value")
{
onValueChanged(pv.Value);
}
};
pv.Initialize(e);
pv.Root = root;
return pv;
}
public static PropertyPath<TP> Link<TP>(Expression<Func<TP>> e, Action<TP> onValueChanged)
{
var pv = new PropertyPath<TP>();
pv.PropertyChanged += (o, eargs) =>
{
if (string.IsNullOrEmpty(eargs.PropertyName) || eargs.PropertyName == "Value")
{
onValueChanged(pv.Value);
}
};
pv.Initialize(e);
return pv;
}
public static PropertyPath<TP> Create<T, TP>(T root, Expression<Func<T, TP>> e)
{
var pv = new PropertyPath<TP>();
pv.Initialize(e);
pv.Root = root;
return pv;
}
public static PropertyPath<TP> Create<TP>(Expression<Func<TP>> e)
{
var pv = new PropertyPath<TP>();
pv.Initialize(e);
return pv;
}
internal PropertyPath()
{
}
void Initialize(LambdaExpression e)
{
object root;
var path = ReflectionEx.GetLambdaPath(e, out root);
if (path.Length == 0)
throw new ArgumentException();
pvalues = new PropertyValue[path.Length];
roValues = new ReadOnlyCollection<PropertyValue>(pvalues);
for (int i = 0; i < path.Length; i++)
{
var meIndex = i;
var pv = new PropertyValue(this, i, path[i]);
pvalues[i] = pv;
}
Root = root;
}
PropertyValue[] pvalues;
ReadOnlyCollection<PropertyValue> roValues;
public object Root
{
get { return root; }
set
{
if (Equals(Root, value))
return;
if (value != null && !pvalues[0].Member.DeclaringType.IsInstanceOf(value))
throw new InvalidCastException();
root = value;
pvalues[0].Object = root;
OnPropertyChanged();
}
}
object root;
public object Value
{
get { return pvalues[pvalues.Length - 1].Value; }
set { pvalues[pvalues.Length - 1].Value = value; }
}
public ReadOnlyCollection<PropertyValue> Elements { get { return roValues; } }
#region class PropertyValue
public class PropertyValue
{
internal PropertyValue(PropertyPath path, int index, MemberInfo member)
{
this.index = index;
Path = path;
Member = member;
}
int index;
public PropertyPath Path { get; private set; }
public MemberInfo Member { get; private set; }
public string Name { get { return Member.Name; } }
void SetMemberValue(object value)
{
if (Member is FieldInfo)
((FieldInfo)Member).SetValue(Object, value);
else if (Member is PropertyInfo)
((PropertyInfo)Member).SetValue(Object, value);
else
throw new InvalidOperationException();
}
object GetMemberValue()
{
if (Member is FieldInfo)
return ((FieldInfo)Member).GetValue(Object);
else if (Member is PropertyInfo)
return ((PropertyInfo)Member).GetValue(Object, null);
else
throw new InvalidOperationException();
}
public object Object
{
get { return mObject; }
internal set
{
if (value == mObject)
return;
if (mObject is INotifyPropertyChanged)
{
((INotifyPropertyChanged)mObject).PropertyChanged -= watcher;
}
mObject = value;
UpdateValue();
if (mObject is INotifyPropertyChanged)
{
watcher = WeakEvents.AddWeakHandler((INotifyPropertyChanged)mObject, this, (x, args) =>
{
if (args.PropertyName == null || args.PropertyName == x.Name)
x.UpdateValue();
});
}
}
}
object mObject;
PropertyChangedEventHandler watcher;
void UpdateValue()
{
var v = GetMemberValue();
if (Equals(v, Value))
return;
mValue = v;
OnValueChanged();
}
public object Value
{
get { return mValue; }
internal set
{
if (Equals(value, Value))
return;
SetMemberValue(value);
mValue = value;
OnValueChanged();
}
}
object mValue;
void OnValueChanged()
{
if (index == Path.Elements.Count - 1)
Path.OnPropertyChanged(nameof(Value));
else
Path.Elements[index + 1].Object = Value;
ValueChanged?.Invoke(this, EventArgs.Empty);
}
public event EventHandler ValueChanged;
}
#endregion
}
|
|
|
|
|
What you might have misread... the class is NOT registering a listener to its own change!
It's listening to change in the source object (!= this!) !!
|
|
|
|
|
No worries, I just saw the little code snippet and I don't know what your requirements are. My knee jerk reaction was that there has to be a simpler way of doing this.
Btw, there is a standard WeakEventManager inside .NET (first intoduced in 3.0)
WeakEventManager Class (System.Windows)[^]
|
|
|
|