Changes
- fixed permission demand for sandboxed environments
- improved proxygen can't find class reporting
- improved the way we are looking for jni4net.j-xxx-.jar (while installed in GAC)
- [#27] - fixed build script problems
Pavel Šavara coding for fun
apt-get install subversion
cd /var/www/
mkdir rumble
cd rumble
svn co http://darkcanuck.net/svn/rumbleserver/trunk/ .
chmod g+w templates_c/
chown :www-data templates_c/
cat > participants.txt
[paste participants.txt file and press Ctrl-D]
cd config
cp config.php-sample config.php
---- <pre> jk.mega.DrussGT 2.0.4,http://www.minifly.rchomepage.com/robocode/jk.mega.DrussGT_2.0.4.jar voidious.Diamond 1.5.34b,http://www.dijitari.com/void/robocode/voidious.Diamond_1.5.34b.jar </pre> ----
delete from battle_results; delete from game_pairings; delete from bot_data; delete from participants; delete from upload_stats; delete from upload_users;
#${build.buildOwnParameters['system.tc.branch.number']}.${build.buildNumber}
We did some naive performance test and learned that for 500k iterations on simple property, there is big difference in speed.
a) is really fast, 13ms
b) is slow, 1417ms, I guess because security checks apply for every call and every stack frame, and can't be fired from other properties.
c) is slow, 2518ms, very slow, because expression tree is constructed for every call
So we played with it for a while and I invented solution with anonymous type (at botom).
Update 27.3.2011: I was so focused on speed that I didn't realized that the solution yesterday didn't work nicely for rename. What a shame. I hope people give me another chance today. Here we have postponed creation of the expression tree, it takes about 75ms. And this time my ReSharper renames it correctly :-)
Update 5.12.2011: As Alex noted in comments, there was thread safety issue with Dictionary. The code is now fixed with Hashtable instead.
public abstract class ModelBase : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; private static readonly Hashtable Names = new Hashtable(); protected void RaisePropertyChange(Func<string> key) { if (PropertyChanged != null) { var propertyName = (PropertyChangedEventArgs)Names[key]; if (propertyName==null) { propertyName = new PropertyChangedEventArgs(key()); lock (Names) { Names[key] = propertyName; } } PropertyChanged(this, propertyName); } } protected static string Reg<T>(Expression<Func<T>> property) { return (property.Body as MemberExpression).Member.Name; } } public class Model : ModelBase { private string firstName2; public string FirstName2 { get { return firstName2; } set { firstName2 = value; RaisePropertyChange(() => Reg(() => FirstName2)); } } }
Doesn't work: The lambda just helps to define the type without creating the instance and calling the getter. It takes about 77ms for half million calls.
public abstract class ModelBase : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; private static readonly Dictionary<Type, PropertyChangedEventArgs> Names = new Dictionary<Type, PropertyChangedEventArgs>(); protected void RaisePropertyChange<T>(Func<T> f) { if (PropertyChanged!=null) { var key = typeof(T); PropertyChangedEventArgs evntArgs; if (!Names.TryGetValue(key, out evntArgs)) { var propertyName = key.GetProperties()[0].Name; evntArgs = new PropertyChangedEventArgs(propertyName); lock(Names) { Names[key] = evntArgs; } } PropertyChanged(this, evntArgs); } } } public class Model : ModelBase { private string firstName; public string FirstName { get { return firstName; } set { if (firstName != value) { firstName = value; RaisePropertyChange(() => new {FirstName}); } } } }
Can't init BridgeExport:An attempt was made to load an assembly from a network l ocation which would have caused the assembly to be sandboxed in previous version s of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended t o sandbox the assembly, please enable the loadFromRemoteSources switch. See http ://go.microsoft.com/fwlink/?LinkId=155569 for more information.