text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
of your code. (Well automatic, as far as just needing to add a linker command switch):
<http://msdn.microsoft.com/en-us/library/yx9zd12s.aspx>
Or you could pre-load like Office and others do (as mentioned above), but I personally hate that -- slows down the computer at initial boot up. | [
0.3696390688419342,
0.00861533172428608,
0.16449406743049622,
0.30873623490333557,
0.18460345268249512,
-0.24437640607357025,
0.5184183716773987,
0.3075081408023834,
0.0323280394077301,
-0.6815556883811951,
-0.4131644666194916,
0.5115076899528503,
-0.0851890817284584,
0.007736313156783581,... | |
I'm creating a Wizard control (in Flex) and wanted to look at some examples of good Wizard controls in .NET, Java or other languages.
I'm especially interested in situations where next/prev steps are determined by the input of the current step. For instance, choosing one of several options in the start screen will lea... | [
0.43048176169395447,
-0.17410369217395782,
0.2557065784931183,
0.3095960319042206,
0.31775403022766113,
-0.24689063429832458,
0.0053216987289488316,
-0.06349849700927734,
-0.06645873188972473,
-0.8881624341011047,
0.024791710078716278,
0.8788036108016968,
-0.23050233721733093,
-0.097368024... | |
dependent on only certain features, rather than the whole package, as it means that you'll have to implement the user interface in the bootstrap application as well. (That was the case with us, but fortunately, we were starting from scratch anyway, so we didn't have to recreate a user interface that we'd already implem... | [
0.5948707461357117,
-0.24132150411605835,
0.37924638390541077,
0.2866743206977844,
0.13413448631763458,
0.08815991878509521,
0.13494902849197388,
-0.0799877867102623,
0.0584043525159359,
-0.8092408180236816,
0.1494939923286438,
0.5360317826271057,
-0.4352441132068634,
-0.16572262346744537,... | |
With the UI in the bootstrap app, the user would select the features that they want installed, and then the bootstrap app would, if necessary, present a page that says the prerequisites are being installed and install them at that point before going on to the next page. When launching your installer, the bootstrap app ... | [
0.7317061424255371,
-0.17550233006477356,
0.4133400321006775,
0.26581045985221863,
0.4386533498764038,
-0.10450085997581482,
0.17066620290279388,
-0.08282393217086792,
0.039094291627407074,
-0.6094585657119751,
-0.40314751863479614,
0.5716204047203064,
-0.3166748881340027,
-0.2546074986457... | |
I want to be able to use CTRL-SHIFT-T to open a Java Type (source code file) from *any perspective* in Eclipse. Unfortunately, the keybinding only works in the Java perspective.
I tried defining the keybindings using context "In Windows" and "In Dialogs and Windows." That did not do the trick.
Any ideas how to do thi... | [
0.005179934669286013,
-0.06371413171291351,
0.5760340094566345,
-0.04979798197746277,
-0.15254200994968414,
0.04374397546052933,
0.11501448601484299,
-0.1838316023349762,
-0.22594709694385529,
-0.6889262795448303,
0.22026421129703522,
0.5926318168640137,
0.05400753393769264,
-0.04446693882... | |
toolbbar buttons.
As mentioned in [lud0h's answer](https://stackoverflow.com/questions/560452#560725), "you have to do this in all perspectives you normally use to get this functionality across all of them"
Until... [eclipse3.5M4 late this January 200099](http://blog.eclipse-tips.com/2008/12/whats-cooking-in-m4.html)... | [
0.26488009095191956,
-0.2107134759426117,
0.31761279702186584,
-0.22930029034614563,
-0.3047431707382202,
0.14117634296417236,
0.22083421051502228,
-0.45292529463768005,
-0.47985005378723145,
-0.423722505569458,
0.06457105278968811,
0.8667206168174744,
-0.2594012916088104,
-0.3868319392204... | |
I don't want to use sendmail to send an email but would prefer to use SMTP. How can I use Perl to send an email to my GMAIL account?
personally I would suggest you to use my module [Email::Send::SMTP::TLS](http://search.cpan.org/~fayland/Email-Send-SMTP-TLS-0.03/lib/Email/Send/SMTP/TLS.pm)
which works pretty well throu... | [
0.38463470339775085,
0.24571554362773895,
0.5895103812217712,
-0.0669885128736496,
-0.054606035351753235,
-0.08892527967691422,
0.3622117042541504,
-0.11437010765075684,
-0.4010898768901825,
-0.5884974598884583,
-0.023566626012325287,
0.40845954418182373,
-0.14723864197731018,
0.2811132371... | |
Password => 'password',
Hello => 'fayland.org',
]
} );
use Email::Simple::Creator; # or other Email::
my $email = Email::Simple->create(
header => [
From => 'username@gmail.com',
To => 'to@mail.com',
Subject => 'Subject title',
],
body => 'Content.',
);
eval { $... | [
0.08727223426103592,
0.18974557518959045,
0.5648426413536072,
0.02494964189827442,
0.2934234142303467,
0.0035339726600795984,
0.401930570602417,
-0.2833608388900757,
0.06553231924772263,
-0.6663118600845337,
-0.370414137840271,
0.7845504283905029,
-0.2144281268119812,
0.33406031131744385,
... | |
I'm wondering if someone can point me in the right direction. I've got an ASP.NET web application. And there's autogenerated portion of JavaScript in every page that handles postback. Sometimes that javascript is surrounded by
<[CDATA[ ... ]]>
, while on the other machine it may be enclosed in simple HTML comment li... | [
0.4647926986217499,
0.1733975112438202,
0.07155594974756241,
0.13437260687351227,
-0.3460143804550171,
0.06473080813884735,
0.1548658311367035,
0.35638391971588135,
-0.2915671765804291,
-0.7875279188156128,
0.14938274025917053,
0.058559101074934006,
-0.1531999409198761,
0.44527095556259155... | |
line in httpd.conf caused latest framework to be used.
Story behind: MS changed JS generation from version 2.0 sp1 to use CDATA.
Thanks for replies.
personally I would suggest you to use my module [Email::Send::SMTP::TLS](http://search.cpan.org/~fayland/Email-Send-SMTP-TLS-0.03/lib/Email/Send/SMTP/TLS.pm)
which works... | [
0.2797974646091461,
-0.0065834783017635345,
0.6585086584091187,
0.12119908630847931,
-0.06882411241531372,
-0.05214279517531395,
0.46877166628837585,
-0.02981051430106163,
-0.3743007481098175,
-0.7394712567329407,
-0.09974168241024017,
0.45258739590644836,
-0.06978891789913177,
0.150611191... | |
Hello => 'fayland.org',
]
} );
use Email::Simple::Creator; # or other Email::
my $email = Email::Simple->create(
header => [
From => 'username@gmail.com',
To => 'to@mail.com',
Subject => 'Subject title',
],
body => 'Content.',
);
eval { $mailer->send($email) };
die "Err... | [
-0.07901537418365479,
0.17684245109558105,
0.6540637016296387,
-0.09598223119974136,
0.2633614242076874,
0.06385412067174911,
0.49668949842453003,
-0.23460599780082703,
0.030420279130339622,
-0.7391300201416016,
-0.3408786654472351,
0.598129391670227,
-0.30845895409584045,
0.39794629812240... | |
```
- (id)copyWithZone:(NSZone *)zone {
PoolFacility *copy = [[[self class] allocWithZone:zone]init];
copy.name = [self.name copy];
copy.type = [self.type copy];
copy.phoneNumber = [self.phoneNumber copy];
//make sure I get proper copies of my dictionaries
copy.address = [self.address mutableCop... | [
0.08738208562135696,
0.4235873520374298,
0.4966091811656952,
0.04795250669121742,
0.3792429566383362,
-0.139641672372818,
0.1428556591272354,
-0.3061840534210205,
-0.16375517845153809,
-0.6756025552749634,
-0.2711832821369171,
0.8048796057701111,
0.00986558385193348,
0.29640746116638184,
... | |
the property declarations:
```
@property (nonatomic, copy) NSString *name;
@property (nonatomic, copy) NSString *type;
@property (nonatomic, copy) NSString *phoneNumber;
@property (nonatomic, retain) NSMutableDictionary *address;
@property (nonatomic, copy) NSString *webAddress;
@property (nonatomic, retain) NSMutable... | [
0.4250548779964447,
0.27769631147384644,
0.439621239900589,
0.11621483415365219,
0.401409387588501,
-0.16915401816368103,
-0.13294513523578644,
-0.562088668346405,
-0.10822806507349014,
-0.4718129634857178,
-0.3032746911048889,
0.9442709684371948,
0.030770916491746902,
0.4328134059906006,
... | |
I have the value `25.00` in a `float`, but when I print it on screen it is `25.0000000`.
How can I display the value with only two decimal places?
It is not a matter of how the number is stored, it is a matter of how you are displaying it. When converting it to a string you must round to the desired precision, which... | [
0.10027587413787842,
0.549411416053772,
0.6271061897277832,
-0.2405068576335907,
-0.08125006407499313,
0.3658076524734497,
-0.05733189731836319,
-0.09836367517709732,
0.037373851984739304,
-0.6416234970092773,
0.030531875789165497,
0.12671448290348053,
0.12152601033449173,
0.23520012199878... | |
`0`s.
E.g.:
```
%f = 25.000000
%.f = 25
%.02f = 25.00
``` | [
-0.10402988642454147,
0.581487774848938,
0.38493892550468445,
-0.2704204320907593,
0.0403454564511776,
0.05348867550492287,
0.39696866273880005,
-0.4010407328605652,
0.19749964773654938,
-0.417031466960907,
-0.4079649746417999,
0.5860472917556763,
-0.0349637046456337,
0.1974698156118393,
... | |
I have a class (Foo) which lazy loads a property named (Bar). What is your preferred way to protect against mistaken use (due to intellisense or inexperienced staff) of the uninitialized backing field?
I can think of 3 options:
```
class Foo {
// option 1 - Easy to use this.bar by mistake.
string bar;
... | [
0.2403741329908371,
0.09987416863441467,
0.17219549417495728,
-0.2866683602333069,
0.08633535355329514,
0.031564418226480484,
0.13953544199466705,
-0.12537968158721924,
0.02027132548391819,
-0.12189164757728577,
-0.1477968841791153,
0.777300238609314,
-0.4527621567249298,
0.055800132453441... | |
return bar;
}
}
// option 2 - Harder to use this._bar by mistake. It is more obscure.
string _bar2;
string Bar2 {
get {
// logic to lazy load bar2
return _bar2;
} | [
-0.11981920897960663,
-0.0005038182716816664,
0.380771279335022,
-0.4896151125431061,
-0.0024899563286453485,
0.05485540255904198,
0.4768272042274475,
-0.2684408724308014,
-0.2131609171628952,
-0.198152095079422,
-0.4372578263282776,
0.6639845371246338,
-0.4397137463092804,
-0.042105551809... | |
}
//option 3 - Very hard to use the backing field by mistake.
class BackingFields {
public string bar;
}
BackingFields fields = new BackingFields();
string Bar3 {
get {
// logic to lazy load bar
return fields.bar; | [
0.22572827339172363,
-0.168204203248024,
0.5066030621528625,
-0.555203378200531,
0.16590844094753265,
0.297298401594162,
0.3740343749523163,
-0.3642938435077667,
-0.2539943754673004,
0.04412754625082016,
-0.37470582127571106,
0.7592753767967224,
-0.38186711072921753,
-0.13915963470935822,
... | |
}
}
}
```
Keep in mind, the only place I want people mucking around with the backing field bar is in setter and getter of the property. Everywhere else in the class they should always use this.Bar
**Update**
I am currently using [the following Lazy implementation](http://code.google.com/p/videobrowser/source/b... | [
0.4082602262496948,
0.08161786198616028,
0.6426932215690613,
-0.20617437362670898,
0.29448509216308594,
-0.3725549280643463,
0.143630251288414,
0.12305368483066559,
-0.2585888206958771,
-0.7279450297355652,
-0.12278478592634201,
0.68129962682724,
-0.1511535942554474,
0.3150959610939026,
... | |
to mention that I think this is a language limitation which can be overcome in [Ruby for example](http://innig.net/software/ruby/closures-in-ruby.rb).
You can [implement lazy](http://moonbase.rydia.net/software/lazy.rb/0.9.5/doc/) in this way.
```
x = lazy do
puts "<<< Evaluating lazy value >>>"
"lazy value"
... | [
0.2108132243156433,
0.07735874503850937,
0.42897680401802063,
0.027372164651751518,
-0.08440494537353516,
-0.4608800411224365,
0.3401731252670288,
-0.06415712833404541,
-0.1197938546538353,
-0.33867016434669495,
-0.34127169847488403,
0.8179387450218201,
-0.35653698444366455,
-0.03434991836... | |
project and anything done via project references rather than dlls).
Note: `Lazy<T>` is not thread safe (this is good, there's no point locking if you don't need to) if you require thread safety either use one of the [thread safe ones from Joe Duffy](http://www.bluebytesoftware.com/blog/2007/06/09/ALazyInitializationPr... | [
0.11011248081922531,
-0.0749606043100357,
-0.0771576315164566,
0.0027440893463790417,
0.1457093060016632,
-0.15826231241226196,
0.2508433163166046,
0.0548577643930912,
-0.469950795173645,
-0.6748621463775635,
-0.19882072508335114,
0.28622859716415405,
-0.2849656343460083,
0.242232084274292... | |
I have a complex JSON object which is sent to the View without any issues (as shown below) but I cannot work out how Serialize this data back to a .NET object when it is passed back to the controller through an AJAX call. Details of the various parts are below.
```
var ObjectA = {
"Name": 1,
"Starti... | [
0.11750964820384979,
-0.2447388619184494,
0.5343063473701477,
-0.22785918414592743,
0.0873732790350914,
-0.16273264586925507,
0.36334189772605896,
0.058411840349435806,
-0.09488800913095474,
-0.6777946949005127,
-0.2087155282497406,
0.4968315362930298,
-0.1189199760556221,
0.68470633029937... | |
"StartTime": new Date(1221644506800),
"GoesFor": 200
}
,
{
"StartTime": new Date(1221644506800), | [
-0.548853874206543,
-0.2790271043777466,
0.5969513654708862,
0.13449761271476746,
0.4723113179206848,
-0.07126887887716293,
0.036707326769828796,
0.2978646159172058,
-0.28925615549087524,
-0.8933771252632141,
-0.4132459759712219,
0.4354729950428009,
-0.11622299253940582,
0.1298766583204269... | |
"GoesFor": 100
}
]
};
```
I am not sure how this object can be passed to a Controller Method, I have this method below where the Timelines object mirrors the above JS object using Properties.
```
public JsonResult Save(Timelines person)
```
The jQuery I am using is:
```
var encod... | [
-0.10839776694774628,
-0.498115599155426,
0.33169326186180115,
0.07011556625366211,
0.49236324429512024,
-0.17218253016471863,
0.02660125121474266,
0.04634826257824898,
-0.10880448669195175,
-0.7955002784729004,
0.06822174042463303,
0.409137487411499,
-0.21174004673957825,
0.16842432320117... | |
type: "POST",
dataType: 'json',
data: encoded,
contentType: "application/json; charset=utf-8",
beforeSend: function() { $("#saveStatus").html("Saving").show(); },
success: function(result) {
alert(result.Result); | [
-0.03872348740696907,
-0.18860261142253876,
0.47602227330207825,
-0.39635276794433594,
0.17041829228401184,
0.18751750886440277,
0.2500392198562622,
-0.19189700484275818,
-0.1406935304403305,
-0.3546521067619324,
-0.8659889698028564,
0.4771347939968109,
-0.33206042647361755,
-0.06891094148... | |
$("#saveStatus").html(result.Result).show();
}
});
```
I have seen this question which is similar, but not quite the same as I am not using a forms to manipulate the data.
[How to pass complex type using json to ASP.NET MVC controller](https://stackoverflow.com/questions/267707/how-to-pass-complex... | [
0.3668881058692932,
0.003595813876017928,
0.4363819360733032,
-0.108697809278965,
-0.041494108736515045,
-0.20647260546684265,
0.473284512758255,
-0.1695987731218338,
-0.16523528099060059,
-0.5347294807434082,
-0.16369958221912384,
0.4784274101257324,
-0.3999412953853607,
0.065343499183654... | |
data in this way?
**Edit:**
This method should no longer be needed with the arrival of MVC 3, as it will be handled automatically - <http://weblogs.asp.net/scottgu/archive/2010/07/27/introducing-asp-net-mvc-3-preview-1.aspx>
---
You can use this ObjectFilter:
```
public class ObjectFilter : ActionFilterAttribut... | [
-0.004555941093713045,
-0.28394806385040283,
0.6945722103118896,
-0.04588685929775238,
-0.2949765920639038,
0.09705239534378052,
0.3641323745250702,
-0.8389183878898621,
-0.5126853585243225,
-0.32044661045074463,
-0.45712995529174805,
0.37522265315055847,
-0.4917339086532593,
-0.0046453839... | |
new DataContractJsonSerializer(RootType).ReadObject(filterContext.HttpContext.Request.InputStream);
filterContext.ActionParameters[Param] = o;
}
}
}
```
You can then apply it to your controller methods like so:
```
[ObjectFilter(Param = "postdata", RootType = typeof(ObjectToSerializeTo))... | [
-0.27371975779533386,
-0.617459774017334,
0.6952013373374939,
-0.016303904354572296,
-0.06872155517339706,
0.06294025480747223,
0.13666218519210815,
-0.45938780903816223,
-0.29625338315963745,
-0.8936878442764282,
-0.2855009138584137,
0.23868410289287567,
-0.5192102193832397,
0.28894501924... | |
Hi I'm working a project where we need to process several xml files once a day and populate a Database with the information contained in those files.
Each file is roughly 1Mb and contains about 1000 records; we usually need to process between 12 and 25 of these files. I've seen some information regarding bulk inserts... | [
0.3264642059803009,
0.16676536202430725,
0.2915504574775696,
0.2008506804704666,
-0.27710792422294617,
0.00046723984996788204,
-0.09651312977075577,
-0.18201501667499542,
-0.26372432708740234,
-0.23579759895801544,
0.2430751472711563,
0.06871254742145538,
0.04558033123612404,
0.48160287737... | |
but not what information has changed. The xml records do not contain our DB identifier, but we can use an identifier from the xml record to uniquely locate a record in our DB.
Our strategy so far has been to identify if the current record is an insert or an update and based on that we either perform an insert on the ... | [
0.41978543996810913,
0.04603801295161247,
0.2734040319919586,
0.307241827249527,
0.10602770745754242,
-0.21450136601924896,
-0.03378834202885628,
-0.12584659457206726,
-0.1668790727853775,
-0.5313356518745422,
-0.06038562208414078,
0.3746272921562195,
-0.05312277004122734,
0.45951926708221... | |
we are having issues with DB locks and our performance degrades really fast. We have thought about some alternatives like having separate tables for the distinct operations or even separate DB’s but doing such a move would mean a big effort so before any decisions I would like to ask for the community opinion on this m... | [
0.20470133423805237,
0.006644576322287321,
-0.10249516367912292,
0.11769869178533554,
-0.5430898666381836,
-0.20433390140533447,
0.16778461635112762,
-0.007111408747732639,
0.026181558147072792,
-0.40136221051216125,
0.08109737932682037,
0.5125492215156555,
-0.2216605842113495,
0.127877101... | |
Server, you could convert your xml format to BCPFORMAT xml then run BULK INSERT on it (only for insertions)
* If you're having too many DB locks, try grouping the operations (i.e. first find out what needs to be inserted and what updated, then get PKs for the updates, then run BULK INSERT for insertions, then run updat... | [
0.2119596153497696,
-0.37295544147491455,
0.24687471985816956,
0.23146118223667145,
-0.35307884216308594,
-0.12380621582269669,
0.12947964668273926,
-0.08862031251192093,
-0.3670262396335602,
-0.8257001638412476,
0.012642313726246357,
0.2561703026294708,
-0.48669546842575073,
0.02877752482... | |
I have a pathological issue with SQL, so I usually sort all of my database issues by building quickie software applications to handle my SQL problems.
*(as I am also doing in this case)*
Thanks to StackOverflow I think I can be shamed into correctness, so I would like to learn how to make this kind of SQL troubleshoo... | [
0.09939828515052795,
0.3611685037612915,
0.2456485778093338,
0.03360971435904503,
0.07643558084964752,
0.04083522409200668,
-0.06356324255466461,
-0.14967995882034302,
-0.3123481869697571,
-0.5624977350234985,
0.1976533830165863,
0.4295767545700073,
0.03792082145810127,
0.18097779154777527... | |
from Database DB2 and vice versa.
2. There can be more than one unit with the same unit number, this will happen because the same unit number can be given to units of different buildings.
3. *I do not have write access to any of the databases.*
I hope this isn't seen as a "gimme teh codz" post, I would like to know ho... | [
0.552061140537262,
0.2999841868877411,
0.2088412493467331,
0.01789354532957077,
-0.39382830262184143,
-0.3969694674015045,
0.5006839036941528,
0.16564880311489105,
-0.003245808184146881,
-0.5825113654136658,
0.018678689375519753,
0.23531273007392883,
-0.05988882854580879,
0.234260231256484... | |
could just get all the unit numbers from one table and exclude them on a select from the other like so:
```
select concated.unit from
( SELECT ( unitNo + ',' + CONVERT(varchar(12), BuildingNo) ) as unit
FROM A) concated
having concated.unit not in
(
'201,1',
'202,1',
'203,1',
'204,1',
'205,1',
'206,1',
[...]
```
... | [
-0.10048963129520416,
-0.16222935914993286,
0.5648280382156372,
-0.09175936132669449,
0.035103678703308105,
0.10826846957206726,
-0.07338126003742218,
-0.5291728973388672,
-0.2937081754207611,
-0.38958287239074707,
-0.18431752920150757,
0.45175260305404663,
-0.12660913169384003,
0.02165719... | |
DB2.dbo.TableB B
on A.UnitNumber = B.UnitNumber
and A.BuildingNumber = B.BuildingNumber
Where
A.UnitNumber is null or B.UnitNumber is null
```
Other queries that might be of interest I've outlined below.
This gives you the records in A not in B.
```
Select
A.UnitNumber
From
DB1.dbo.TableA... | [
0.042792025953531265,
0.35400956869125366,
0.34337693452835083,
-0.18618859350681305,
-0.11900489777326584,
0.11300715804100037,
0.2444692701101303,
-0.5196358561515808,
-0.004688284359872341,
-0.48775357007980347,
-0.13984011113643646,
0.437438428401947,
-0.15219593048095703,
0.3901163339... | |
the records in B that aren't in A.
```
Select
B.UnitNumber
From
DB2.dbo.TableB B left join DB1.dbo.TableA A
on B.UnitNumber = A.UnitNumber
and B.BuildingNumber = A.BuildingNumber
Where
A.UnitNumber is null
``` | [
-0.07495514303445816,
0.4529222846031189,
0.2781534492969513,
-0.1813787966966629,
0.013579036109149456,
0.19499395787715912,
0.16201254725456238,
-0.5727935433387756,
0.03504510968923569,
-0.5544278025627136,
-0.2778021991252899,
0.19693288207054138,
-0.12265472114086151,
0.49406206607818... | |
My table has the following columns:
```
A | B | C | D | E | F
```
I want to displays this as follow:
```
MyColumn | MyColumn2
A | B
C | D
E | F
```
As you can see i want to display the columns as pairs with a custom column name. The pairs are Column A and B, | [
0.16597335040569305,
0.40707361698150635,
0.801196813583374,
-0.11727305501699448,
-0.1491674780845642,
0.31571751832962036,
-0.4205983281135559,
0.2936265468597412,
-0.35177740454673767,
-0.7315472364425659,
0.09279022365808487,
0.0676359236240387,
-0.4962981939315796,
0.17521345615386963... | |
column C and D and column C and D.
```
select A as [Col 1], B as [Col 2] from table
union all
select C,D from table
union all
select E,F from table
``` | [
-0.6190468668937683,
0.4661043882369995,
0.5773999691009521,
-0.14292775094509125,
0.15573729574680328,
0.5158286094665527,
-0.40570035576820374,
-0.20523253083229065,
-0.4007595479488373,
-0.6756225228309631,
-0.773830235004425,
0.11832667142152786,
-0.5050687193870544,
-0.034657459706068... | |
If I have a TreeView (myTreeview),how can I obtain a list of all the nodes that are parent nodes? i.e. nodes that have children
myTreeview.Nodes will give you a list of root nodes as defined by MS which basically means nodes on the root branch of the tree.
This code will build a list of root nodes with children:
```
... | [
0.021267391741275787,
-0.07535459846258163,
0.5867324471473694,
0.06450091302394867,
0.2407311201095581,
0.4210336208343506,
0.23813581466674805,
-0.009902840480208397,
-0.16255103051662445,
-0.9503226280212402,
-0.05356605723500252,
0.2191164642572403,
0.056628577411174774,
0.424750983715... | |
a child regardless of how deep into the tree then use a bit of recursion, e.g.
```
private static IList<TreeNode> BuildParentNodeList(TreeView treeView)
{
IList<TreeNode> nodesWithChildren = new List<TreeNode>();
foreach( TreeNode node in treeView.Nodes )
AddParentNodes(nodesWithChildren, node);
... | [
-0.2684401869773865,
0.07399509847164154,
0.28934532403945923,
-0.17871835827827454,
0.31920498609542847,
0.4169299602508545,
0.3597313463687897,
-0.2668308913707733,
0.07111071795225143,
-0.7071173191070557,
-0.34218332171440125,
0.4614656865596771,
-0.2118537575006485,
0.3562049567699432... | |
AddParentNodes( nodesWithChildren, node );
}
}
```
---
Update 2: Recursion method with only 1 foreach loop:
```
private static IList<TreeNode> BuildParentNodeList(TreeView treeView)
{
IList<TreeNode> nodesWithChildren = new List<TreeNode>();
AddParentNodes( nodesWithChildren, treeView.Nodes );
retur... | [
-0.19783635437488556,
0.08535965532064438,
0.35283777117729187,
-0.3689323961734772,
0.0765400379896164,
0.34891635179519653,
0.3130200207233429,
-0.39732715487480164,
0.03565876558423042,
-0.34787657856941223,
-0.1820312887430191,
0.5945085287094116,
-0.5015525817871094,
0.155469715595245... | |
AddParentNodes(nodesWithChildren, node.Nodes);
}
}
}
``` | [
0.09294585883617401,
0.15305477380752563,
0.5134527087211609,
-0.2361072450876236,
0.233387291431427,
0.010122491978108883,
0.2964921295642853,
0.14051960408687592,
-0.08716204762458801,
-0.5980134606361389,
-0.12688131630420685,
0.6293334364891052,
-0.39829468727111816,
0.2472196370363235... | |
I'm archiving a directory. This directory has a file that is being written by another process. When I tar this using Linux tar/Perl Tar module, in the archive the entry for the file is there but the contents are null.
Before tarring the files are...
```
-rw-r--r-- 1 irraju dba 28 Feb 18 02:22 a
-rw-r--r-- 1 irraju ... | [
-0.046149417757987976,
0.2571726441383362,
0.21647708117961884,
-0.15884524583816528,
-0.2931474447250366,
0.18066884577274323,
0.5719715356826782,
-0.1538776010274887,
0.1563073843717575,
-0.489946573972702,
-0.10271105170249939,
0.7719864845275879,
-0.035860709846019745,
0.27209922671318... | |
0 2009-02-18 03:33:12 c
```
How can I fix this problem? I want the file to be in the archive with the contents it has at the instant it is archived. This file can be a log file and assume that we can not close the file handle before tarring.
As you tagged the question with "Linux" there's a chance you're using an LVM... | [
0.10795524716377258,
0.21362999081611633,
0.46186569333076477,
-0.07130660861730576,
0.08954060077667236,
-0.3506816327571869,
0.27598437666893005,
-0.10410967469215393,
-0.21357133984565735,
-0.49441301822662354,
-0.5119901895523071,
0.6219511032104492,
-0.19294095039367676,
-0.0057011167... | |
A wonderful facility provided by LVM is 'snapshots'. This allows the administrator to create a new block device which presents an exact copy of a logical volume, frozen at some point in time. Typically this would be used when some batch processing, a backup for instance, needs to be performed on the logical volume, but... | [
0.20897890627384186,
0.1252260059118271,
0.522996723651886,
0.23503170907497406,
0.32906612753868103,
-0.2335803210735321,
-0.16952812671661377,
0.10764280706644058,
-0.6716228723526001,
-0.32732847332954407,
-0.29129689931869507,
0.07884200662374496,
-0.010180418379604816,
0.3847300708293... | |
the logical volume is in a consistent state - the VFS-lock patch for LVM1 makes sure that some filesystems do this automatically when a snapshot is created, and many of the filesystems in the 2.6 kernel do this automatically when a snapshot is created without patching. | [
-0.17342253029346466,
-0.1371087282896042,
0.7019774317741394,
0.18762975931167603,
0.12925976514816284,
-0.27435463666915894,
0.05423569679260254,
-0.1763572096824646,
-0.4673927128314972,
-0.5578569173812866,
-0.5282596349716187,
0.5475013256072998,
-0.350157231092453,
-0.089606538414955... | |
Let's say I've got the following ActiveRecord class:
```
[ActiveRecord]
public class Account
{
...
[BelongsTo("CustomerId")]
public Customer Customer { get; set; }
}
```
Currently, to set the value of the CustomerId field I have to get the entire Customer object from the database and assign it to the Ac... | [
-0.2264842689037323,
0.06970879435539246,
0.4554951786994934,
-0.18856672942638397,
-0.004697140771895647,
0.14575813710689545,
0.16337642073631287,
-0.14714759588241577,
-0.11208543181419373,
-0.47508272528648376,
0.02948050945997238,
0.6875486373901367,
-0.3600221276283264,
0.30623066425... | |
var ghostCustomer = Customer.Find(customerId);
var account = Account.TryFind(accountId);
account.Customer = ghostCustomer;
}
```
Two important points:
The Customer.Find must be in a SessionScope. The Find method checks and will fully load your object if a SessionScope is not defined.
The Customer class mus... | [
-0.3461498022079468,
0.20950907468795776,
0.5615280270576477,
-0.07646259665489197,
0.2749243378639221,
0.03127368167042732,
0.40803518891334534,
-0.05370087921619415,
-0.10693316906690598,
-0.20949013531208038,
0.09636422991752625,
0.6978527903556824,
-0.30536147952079773,
0.3236280977725... | |
When using jQuery Ajax, I am receiving a parseerror in IE 6, Firefox works just fine.
My code is like this:
```
$.ajax({
url: 'test.xml',
type: 'GET',
dataType: 'xml',
error: function(XMLHttpRequest, textStatus, errorThrown) {
alert('Error: ' + textStatus + ", " + errorThrown);
},
success: ... | [
-0.1413099765777588,
0.16010703146457672,
0.40962493419647217,
-0.15399137139320374,
-0.3350827991962433,
-0.4128745198249817,
0.4124845266342163,
0.07773260027170181,
0.1047656387090683,
-1.0021528005599976,
-0.15456748008728027,
0.7808359861373901,
-0.2157726287841797,
-0.061501361429691... | |
I'm trying to get an ASP page to work, but it keeps blowing up. How do I get it to display "response.write" info instead of blowing up?
p.s. I noticed this as a technique and plan to give it a try.
2. On top of page ad On Error Resume Next
After each line of code use
If Err.Number <> 0 Then
Response.Write Err.Descrip... | [
0.13767394423484802,
-0.008997705765068531,
0.6677898168563843,
-0.16664251685142517,
-0.45011550188064575,
0.021881546825170517,
0.42286571860313416,
-0.3507773280143738,
-0.20272457599639893,
-0.7627128958702087,
-0.14884038269519806,
0.39505842328071594,
-0.4322243630886078,
0.038650929... | |
because I didn't see a tag for asp.
Ultimate, my hacked solution was to make a huge if statement, e.g.
if 1 = 1 then
' continue happily displaying page
(bunch of code until end)
else
Response.write "messed up variable: " & messed\_up\_variable | [
0.21561431884765625,
-0.09825621545314789,
0.37788891792297363,
-0.05602480098605156,
-0.20274493098258972,
0.07092742621898651,
0.5150546431541443,
-0.06262972950935364,
-0.11200734227895737,
-0.3044409155845642,
-0.24514369666576385,
0.14715856313705444,
-0.4755480885505676,
0.0262503642... | |
I am having some issues with word-splitting in bash variable expansion. I want to be able to store an argument list in a variable and run it, but any quoted multiword arguments aren't evaluating how I expected them to.
I'll explain my problem with an example. Lets say I had a function `decho` that printed each positio... | [
0.06728900969028473,
0.19811344146728516,
0.027288058772683144,
-0.2654015123844147,
-0.26558756828308105,
0.04134434461593628,
0.10489427298307419,
-0.2579907774925232,
-0.4516744911670685,
-0.4033900201320648,
0.0446065217256546,
0.8024521470069885,
-0.18639017641544342,
0.02409068681299... | |
if I get the arguments list from a variable I get this:
```
[~]$ args='a b "c d"'
[~]$ decho $args
a
b
"c
d"
```
Which is not what I want. I can go:
```
[~]$ echo decho $args | bash
a
b
c d
```
But that seems a little clunky. Is there a better way to make the expansion of `$args` in `decho $args` be word-split th... | [
0.1986430287361145,
0.33051010966300964,
0.10544301569461823,
-0.47435280680656433,
-0.21236759424209595,
0.17845912277698517,
0.17833104729652405,
-0.23469190299510956,
-0.3395030200481415,
0.043929193168878555,
-0.19691243767738342,
0.7412664294242859,
-0.43189099431037903,
-0.0130771612... | |
is there this kind of function available in AS3:
```
g.fillArc(5,5,w-10,h-10,90,-360*value/limit); // JAVA
```
You can use:
```
eval decho $args
``` | [
-0.3611864745616913,
-0.022122178226709366,
0.10597246140241623,
-0.3194528818130493,
-0.027804352343082428,
0.0702606663107872,
0.007485916372388601,
0.053045906126499176,
-0.26084911823272705,
-0.1208455041050911,
-0.173849955201149,
0.5961747765541077,
-0.43259477615356445,
-0.175422102... | |
Sending email is easy with commons-email, and with spring it is even easier. What about receiving incoming email? Are there easy to use APIs that allow to bounce emails, process attachments, etc.
[SubEthaSMTP Mail Server](http://code.google.com/p/subethasmtp/) allows you to create your own SMTP Server for receiving ema... | [
0.2304413914680481,
-0.3494163453578949,
0.47177812457084656,
0.2645418643951416,
-0.4342469573020935,
-0.09840255230665207,
0.4211997091770172,
0.1186850368976593,
-0.44189372658729553,
-0.6013514995574951,
-0.019394470378756523,
-0.12966105341911316,
-0.34519150853157043,
-0.110124133527... | |
How many parameters can you pass to a string.Format() method?
There must be some sort of theoretical or enforced limit on it. Is it based on the limits of the params[] type or the memory usage of the app that is using it or something else entirely?
OK, I emerge from hiding... I used the following program to verify wha... | [
0.30989769101142883,
-0.0880822017788887,
0.12651227414608002,
0.3233772814273834,
0.033481478691101074,
-0.012304270640015602,
0.3786526918411255,
-0.21338815987110138,
-0.33063051104545593,
-0.27306100726127625,
0.06750637292861938,
0.6490841507911682,
-0.1580241471529007,
0.142828866839... | |
put in a string.Format method call has to be **107713904**.
```
int i = 0;
long sum = 0;
while (sum < int.MaxValue)
{
var s = sizeof(char) * ("{" + i + "}").Length;
sum += s; // pseudo append
++i;
}
Console.WriteLine(i);
Console.ReadLine();
```
Love the discussion people! | [
0.10460780560970306,
-0.13325367867946625,
0.511295735836029,
-0.19889825582504272,
0.22694510221481323,
0.1100844219326973,
0.4476923942565918,
-0.15373380482196808,
-0.28268787264823914,
-0.8036590814590454,
-0.4233052730560303,
0.6652015447616577,
-0.3230196535587311,
0.0902240872383117... | |
I have a FlowDocumentScrollViewer I want to automatically scroll to the bottom
when text is added.
```
<FlowDocumentScrollViewer Name="Scroller">
<FlowDocument Foreground="White" Name="docDebug" FontFamily="Terminal">
<Paragraph Name="paragraphDebug"/>
</FlowDocument>
</FlowDocumentScrollViewer>
```
In code I ad... | [
-0.01185314729809761,
0.12562952935695648,
0.8949292898178101,
-0.14022383093833923,
-0.19170613586902618,
-0.05634599179029465,
0.14950375258922577,
-0.1981671154499054,
0.12175172567367554,
-0.8364825248718262,
0.17488181591033936,
0.8309884071350098,
-0.2609570324420929,
0.0468073152005... | |
(VisualTreeHelper.GetChildrenCount(flowDocumentScrollViewer) == 0)
{
return null;
}
// Border is the first child of first child of a ScrolldocumentViewer
DependencyObject firstChild = VisualTreeHelper.GetChild(flowDocumentScrollViewer, 0);
if (firstChild == null)
{
return null;
... | [
0.16447904706001282,
-0.2765777111053467,
0.7035169005393982,
0.0033350661396980286,
-0.05939023196697235,
0.21010975539684296,
0.12346253544092178,
-0.2992834448814392,
0.17350226640701294,
-0.8550491333007812,
-0.04473450034856796,
0.44877561926841736,
-0.17468537390232086,
0.20733682811... | |
}
return border.Child as ScrollViewer;
}
``` | [
-0.12925635278224945,
0.24974606931209564,
0.2247498333454132,
-0.28318458795547485,
0.40918830037117004,
-0.1542077213525772,
0.2010619193315506,
0.39939436316490173,
0.12072625011205673,
-0.6586891412734985,
-0.013681506738066673,
0.6686042547225952,
-0.05667587369680405,
0.5549249649047... | |
I've asked some questions here and seen this geometric shape mentioned a few times among other geodesic shapes, but I'm curious how exactly would I generate one about a point xyz?
[Here](http://www.opengl.org.ru/docs/pg/0208.html) is one reference that I've used for subdivided icosahedrons, based on the OpenGL Red Book... | [
0.2852061688899994,
0.1502145230770111,
0.42609405517578125,
0.058079786598682404,
-0.0761914923787117,
0.02088870108127594,
-0.19199945032596588,
-0.09030313789844513,
-0.24888084828853607,
-0.5681494474411011,
0.050929874181747437,
0.09513363242149353,
-0.2087402045726776,
0.281055450439... | |
Is there a good java API for manipulating RAR archive files someone could recommend? Googling did not turn up anything overwhelmingly convincing.
You could try [JUnRar](https://github.com/edmund-wagner/junrar), "a RAR handling API implemented in pure Java" (quoting the site). | [
0.08947198837995529,
-0.025763940066099167,
-0.4454330503940582,
-0.07221616804599762,
-0.14725343883037567,
-0.023312756791710854,
0.2677496373653412,
0.022910458967089653,
-0.1122005432844162,
-0.16164597868919373,
0.06835726648569107,
0.5685586333274841,
-0.23201671242713928,
-0.0195243... | |
I have a href tag, and next to it is a tag. I want to put new text in between the bold tags.
```
<a href=""></a> <b>old text</b>
```
So in my click handler, how can I get a reference to the text between the bold tag?
I know there is $(this + b) but how do I make sure it only gets the first and not ALL next items (... | [
0.10513076186180115,
0.3201242685317993,
0.6294772028923035,
-0.2630610466003418,
-0.07153157144784927,
0.18395724892616272,
0.04188327491283417,
-0.37585872411727905,
-0.049874257296323776,
-0.5820321440696716,
-0.3378106653690338,
0.5992797017097473,
-0.3768084943294525,
-0.0881190001964... | |
Is there a way to `String.Format` a message without having to specify `{1}, {2},` etc? Is it possible to have some form of auto-increment? (Similar to plain old `printf`)
Afraid not -- where would it put the objects into the string? Using printf, you still need to put specifiers in somewhere. | [
0.21156232059001923,
0.009707745164632797,
0.15277619659900665,
0.26433873176574707,
-0.06373075395822525,
-0.09774865210056305,
0.24423672258853912,
-0.03397849574685097,
-0.27225711941719055,
-0.29108917713165283,
-0.012071113102138042,
0.4895399212837219,
-0.32463377714157104,
-0.168367... | |
I have a ComboBox that doesn't seem to update the SelectedItem/SelectedValue.
The ComboBox ItemsSource is bound to a property on a ViewModel class that lists a bunch of RAS phonebook entries as a CollectionView. Then I've bound (at separate times) both the `SelectedItem` or `SelectedValue` to another property of the V... | [
-0.11676275730133057,
-0.4176467955112457,
0.5340867638587952,
0.018683254718780518,
0.11867254972457886,
-0.06807612627744675,
0.07048484683036804,
-0.24647052586078644,
-0.030083537101745605,
-0.8963451981544495,
-0.017477814108133316,
0.6608238220214844,
-0.2773723304271698,
0.159266456... | |
PhonebookEntries
{
get { return _phonebookEntries; }
}
public string PhonebookEntry
{
get { return _phonebookEntry; }
set
{
if (_phonebookEntry == value) return;
_phonebookEntry = value; | [
-0.09154460579156876,
-0.25848588347435,
0.788048267364502,
-0.24638810753822327,
0.49262431263923645,
0.006980785634368658,
0.2941986918449402,
-0.07079607248306274,
0.35588082671165466,
-0.5260620713233948,
-0.5934098958969116,
0.7736409902572632,
-0.09030003100633621,
-0.100789472460746... | |
OnPropertyChanged("PhonebookEntry");
}
}
}
```
The \_phonebookEntries collection is being initialised in the constructor from a business object. The ComboBox XAML looks something like this:
```
<ComboBox ItemsSource="{Binding Path=PhonebookEntries}"
DisplayMemberPath="Name"
SelectedValuePath="Nam... | [
-0.09847237914800644,
-0.18221576511859894,
0.8082072138786316,
-0.264177531003952,
0.26691892743110657,
0.047171518206596375,
-0.015709465369582176,
-0.20627212524414062,
-0.12008742243051529,
-0.8216121196746826,
-0.3603894114494324,
0.6307942271232605,
-0.35009485483169556,
0.0028432221... | |
ComboBox is in a `DataTemplate` applied to an `ItemsControl` on a Window whose DataContext has been set to a ViewModel instance.
The ComboBox displays the list of items correctly, and I can select one in the UI with no problem. However when I display the message box from the command, the PhonebookEntry property still ... | [
-0.14394672214984894,
-0.24797271192073822,
0.6512775421142578,
0.09386568516492844,
0.02625357359647751,
-0.0100199393928051,
0.1248088851571083,
-0.2690189778804779,
0.04302150756120682,
-0.9150485992431641,
0.06939217448234558,
0.6407635807991028,
-0.2373368740081787,
-0.034729227423667... | |
is the behaviour I'm seeing, however it's not working for some reason in my particular context.
I have a MainWindowViewModel which has a `CollectionView` of ConnectionViewModels. In the MainWindowView.xaml file code-behind, I set the DataContext to the MainWindowViewModel. The MainWindowView.xaml has an `ItemsControl`... | [
0.068220354616642,
-0.40856072306632996,
0.6273924708366394,
-0.1362818330526352,
-0.21331451833248138,
0.16056667268276215,
0.12424000352621078,
-0.2270376980304718,
-0.29873472452163696,
-0.7916994094848633,
-0.30201879143714905,
0.5791392922401428,
-0.5409285426139832,
0.076065480709075... | |
MainWindowViewModel : ViewModelBase
{
// List<ConnectionViewModel>...
public CollectionView Connections { get; set; }
}
```
The XAML code-behind:
```
public partial class Window1
{
public Window1()
{
InitializeComponent();
DataContext = new MainWindowViewModel();
}
}
```
**Then ... | [
-0.21064908802509308,
-0.29630979895591736,
0.8643865585327148,
-0.1710115671157837,
-0.005060953088104725,
-0.03587977588176727,
0.11473552882671356,
-0.27331528067588806,
-0.33328577876091003,
-0.8505618572235107,
-0.3885950446128845,
0.5116034746170044,
-0.08750628679990768,
0.202818185... | |
SelectedValue="{Binding Path=PhonebookEntry}" />
<TextBox Text="{Binding Path=Password}" />
</Grid>
</DataTemplate>
<ItemsControl ItemsSource="{Binding Path=Connections}"
ItemTemplate="{StaticResource listTemplate}" />
```
The TextBoxes all bind correctly, and data moves between them and the ViewMode... | [
-0.32046571373939514,
-0.4925630986690521,
0.7061352729797363,
0.03988414630293846,
0.020461151376366615,
-0.16406364738941193,
-0.017555352300405502,
-0.33875787258148193,
-0.0063047041185200214,
-0.9077969789505005,
-0.07277004420757294,
0.4248356223106384,
-0.06130032241344452,
0.033162... | |
a bit silly to me.
---
Here is a test implementation that demonstrates the problem, based on the example above.
**XAML:**
```
<Window x:Class="WpfApplication7.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1"... | [
-0.014762151055037975,
-0.05959516018629074,
0.6104596853256226,
0.19838625192642212,
-0.07268597930669785,
-0.0666188895702362,
0.02856728993356228,
-0.1641121655702591,
-0.23334968090057373,
0.032419364899396896,
-0.04434772953391075,
0.341512531042099,
-0.007564614526927471,
-0.05026594... | |
DisplayMemberPath="Name"
SelectedValuePath="Name"
SelectedValue="{Binding Path=PhonebookEntry}"
Width="200"/>
</StackPanel>
</DataTemplate> | [
-0.204933300614357,
-0.452432781457901,
0.5890955924987793,
0.017008600756525993,
0.05916821211576462,
0.09139535576105118,
-0.03742755204439163,
-0.39578670263290405,
-0.25217685103416443,
-0.7784180045127869,
-0.10748589783906937,
0.37005293369293213,
-0.0679827332496643,
-0.185663506388... | |
</Window.Resources>
<Grid>
<ItemsControl ItemsSource="{Binding Path=Connections}"
ItemTemplate="{StaticResource itemTemplate}" />
</Grid>
</Window>
```
The **code-behind**:
```
namespace WpfApplication7
{
/// <summary>
/// Interaction logic for Window1.xaml
/// </summary>
... | [
-0.4133932292461395,
-0.28722238540649414,
0.48919421434402466,
-0.2705579400062561,
0.02274261601269245,
0.16549049317836761,
0.04939739406108856,
-0.18029019236564636,
-0.24390976130962372,
-0.8402292728424072,
-0.5170530676841736,
0.19517940282821655,
-0.35508131980895996,
0.14343266189... | |
DataContext = new MainWindowViewModel();
}
}
public class PhoneBookEntry
{
public string Name { get; set; }
public PhoneBookEntry(string name)
{
Name = name;
}
}
public class ConnectionViewModel : INotifyPropertyChanged | [
-0.3987361192703247,
-0.6046335697174072,
0.6451990604400635,
0.037793632596731186,
0.3110772371292114,
-0.11911801248788834,
0.20486171543598175,
0.16499386727809906,
-0.19257214665412903,
-0.877949059009552,
-0.3985094428062439,
0.6370278000831604,
-0.23101991415023804,
0.240853026509284... | |
{
private string _name;
public ConnectionViewModel(string name)
{
_name = name;
IList<PhoneBookEntry> list = new List<PhoneBookEntry> | [
-0.1810932159423828,
-0.46351316571235657,
0.3119366765022278,
-0.1785493940114975,
0.37130141258239746,
0.1395011693239212,
0.30643516778945923,
0.09063348919153214,
-0.28692808747291565,
-0.8192989230155945,
-0.3814416825771332,
0.8399391770362854,
-0.5057681202888489,
0.3755558133125305... | |
{
new PhoneBookEntry("test"), | [
-0.1116204485297203,
-0.10384565591812134,
0.20328685641288757,
0.2084108293056488,
0.7195469737052917,
0.08980561792850494,
0.291014164686203,
0.1015106812119484,
-0.056450266391038895,
-0.7497175335884094,
-0.2359820306301117,
0.5785202980041504,
-0.2876761853694916,
-0.19630008935928345... | |
new PhoneBookEntry("test2")
};
_phonebookEntries = new CollectionView(list);
}
private readonly CollectionView _phonebookEntries;
private string _phonebookEntry; | [
-0.1260511875152588,
-0.19390034675598145,
0.44122326374053955,
-0.21464447677135468,
0.37004247307777405,
-0.28195720911026,
0.4369833171367645,
-0.19531023502349854,
-0.08126804977655411,
-0.6242042779922485,
-0.5447063446044922,
0.6569051146507263,
-0.28167563676834106,
0.34412497282028... | |
public CollectionView PhonebookEntries
{
get { return _phonebookEntries; }
}
public string PhonebookEntry
{
get { return _phonebookEntry; }
set
{ | [
0.15884889662265778,
-0.2764047086238861,
0.3733522593975067,
0.15066123008728027,
0.16447727382183075,
-0.16401474177837372,
0.18625718355178833,
-0.09387284517288208,
0.07997278869152069,
-0.46650898456573486,
-0.4719316065311432,
0.7041095495223999,
-0.13352012634277344,
0.0382743217051... | |
if (_phonebookEntry == value) return;
_phonebookEntry = value;
OnPropertyChanged("PhonebookEntry");
}
}
public string Name
{
get { | [
-0.12732918560504913,
-0.29312482476234436,
0.3672194182872772,
-0.18036825954914093,
0.565700352191925,
-0.09337406605482101,
0.2933472990989685,
0.010984379798173904,
0.23576074838638306,
-0.4215034544467926,
-0.37212371826171875,
0.7710340023040771,
-0.1940026730298996,
0.32637771964073... | |
return _name; }
set
{
if (_name == value) return;
_name = value;
OnPropertyChanged("Name");
} | [
-0.2546161711215973,
-0.15756581723690033,
0.30853405594825745,
-0.20282912254333496,
0.48690229654312134,
0.16990964114665985,
0.2673693299293518,
-0.17841684818267822,
-0.04489940032362938,
-0.1933404505252838,
-0.3841799199581146,
0.719262957572937,
-0.4108104109764099,
0.15114736557006... | |
}
private void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
public event PropertyChangedEventHandler PropertyChanged;
}
public class MainWindowViewModel
... | [
-0.0076230610720813274,
-0.5700516104698181,
0.2722361385822296,
0.009557876735925674,
0.4789496660232544,
-0.20623552799224854,
0.2997833788394928,
0.05950510501861572,
-0.40334388613700867,
-0.45536869764328003,
-0.43172600865364075,
0.7669486403465271,
-0.10059218853712082,
0.5644919872... | |
public MainWindowViewModel()
{
IList<ConnectionViewModel> connections = new List<ConnectionViewModel>
{ | [
-0.31656426191329956,
-0.5614228844642639,
0.2631687521934509,
0.04755229502916336,
0.0564725324511528,
0.06057849898934364,
0.21081218123435974,
0.23682460188865662,
-0.3534744083881378,
-0.7981656789779663,
-0.12985892593860626,
0.5451783537864685,
-0.46811559796333313,
0.368905305862426... | |
new ConnectionViewModel("First"), | [
0.003688845317810774,
-0.6948623657226562,
0.6505529284477234,
0.2722313404083252,
-0.0012849930208176374,
-0.20629534125328064,
-0.1528639793395996,
-0.14715170860290527,
-0.22952674329280853,
-1.0491516590118408,
-0.12337548285722733,
0.35933464765548706,
-0.26005446910858154,
0.11088097... | |
new ConnectionViewModel("Second"),
new ConnectionViewModel("Third") | [
-0.1863376349210739,
-0.6228490471839905,
0.9373817443847656,
0.048825666308403015,
-0.11183743923902512,
0.21336765587329865,
0.11858344078063965,
-0.08981591463088989,
-0.35960671305656433,
-1.4591349363327026,
-0.12078574299812317,
0.20749859511852264,
-0.309498131275177,
-0.01061373949... | |
};
_connections = new CollectionView(connections);
}
public CollectionView Connections
{
get { return _connections; }
} | [
0.031138019636273384,
-0.5853910446166992,
0.4097497761249542,
0.14810946583747864,
0.049950696527957916,
-0.11996994912624359,
0.19140751659870148,
0.12139440327882767,
-0.5005547404289246,
-0.8872284293174744,
-0.3815619647502899,
0.5013083815574646,
-0.33076047897338867,
0.3833389282226... | |
}
}
```
If you run that example, you will get the behaviour I'm talking about. The TextBox updates its binding fine when you edit it, but the ComboBox does not. Very confusing seeing as really the only thing I've done is introduce a parent ViewModel.
I am currently labouring under the impression that an item bound t... | [
0.06104675680398941,
0.12962517142295837,
0.33983084559440613,
-0.13633987307548523,
-0.006301735062152147,
-0.06675223261117935,
0.24656261503696442,
0.12455151230096817,
-0.1924668848514557,
-0.7746623158454895,
-0.15199479460716248,
0.39378929138183594,
-0.3191889226436615,
0.6212733983... | |
(implicitly associated)
I don't know if that explains my assumption any better(?).
---
To confirm my assumption, change the binding of the TextBox to be
```
<TextBox Text="{Binding Mode=OneWay}" Width="50" />
```
And this will show the TextBox binding root (which I'm comparing to the DataContext) is the Connectio... | [
-0.08269058912992477,
-0.34780558943748474,
0.7645673155784607,
-0.016605496406555176,
-0.051192693412303925,
0.03999480977654457,
0.06963983178138733,
-0.34954676032066345,
-0.037267908453941345,
-0.8251297473907471,
0.2323235422372818,
0.7071328163146973,
-0.3439503312110901,
0.086636498... | |
changes, and I can change the selected item in the combobox and the view models PhoneBookEntry property is set correctly.
Here is my XAML content:
```
<Window x:Class="WpfApplication6.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx... | [
-0.21404044330120087,
-0.0737726092338562,
1.089916706085205,
-0.19372262060642242,
0.04001125693321228,
0.27530908584594727,
-0.07780720293521881,
-0.4398757517337799,
-0.05981048569083214,
-0.5175217390060425,
-0.25769975781440735,
0.3614346981048584,
0.06918752938508987,
0.0606629513204... | |
SelectedValuePath="Name"
SelectedValue="{Binding Path=PhonebookEntry}" />
</StackPanel>
</Grid>
</Window>
```
And here is my code-behind:
```
namespace WpfApplication6
{
/// <summary>
/// Interaction logic for Window1.xaml
/// </summary>
public partial class Window1 : Window
... | [
-0.2319362759590149,
-0.45715877413749695,
0.518395721912384,
-0.33502811193466187,
0.0653960108757019,
0.028274770826101303,
-0.06565964221954346,
-0.3093213737010956,
0.021359922364354134,
-0.9549931883811951,
-0.2953776717185974,
0.42919978499412537,
-0.2532519996166229,
-0.009289509616... | |
ConnectionViewModel vm = new ConnectionViewModel();
DataContext = vm;
}
private void Button_Click(object sender, RoutedEventArgs e)
{
((ConnectionViewModel)DataContext).PhonebookEntry = "test";
}
}
public class PhoneBookEntry
{ | [
-0.16859540343284607,
-0.48622140288352966,
0.7749994993209839,
-0.03676794841885567,
0.32677459716796875,
-0.1671578735113144,
0.32817086577415466,
-0.027389004826545715,
-0.1790788173675537,
-0.8302243947982788,
-0.46031031012535095,
0.7056737542152405,
-0.31677600741386414,
0.2331752479... | |
public string Name { get; set; }
public PhoneBookEntry(string name)
{
Name = name;
}
public override string ToString()
{
return Name;
}
}
public class ConnectionViewModel : INotifyPropertyChanged | [
-0.16129760444164276,
-0.6034173965454102,
0.4595044255256653,
0.11070902645587921,
0.3858526051044464,
-0.18586210906505585,
0.21336771547794342,
0.20627781748771667,
-0.16129814088344574,
-0.6687206029891968,
-0.32957953214645386,
0.747297465801239,
-0.2978070378303528,
0.323765397071838... | |
{
public ConnectionViewModel()
{
IList<PhoneBookEntry> list = new List<PhoneBookEntry>();
list.Add(new PhoneBookEntry("test"));
list.Add(new PhoneBookEntry("test2"));
_phonebookEntries = new CollectionView(list);
}
private readonly Collect... | [
-0.06281296908855438,
-0.39446449279785156,
0.42727670073509216,
-0.007835164666175842,
0.2598235309123993,
-0.030065445229411125,
0.40623679757118225,
-0.2506202459335327,
-0.24337443709373474,
-0.7939109206199646,
-0.5060731768608093,
0.694898247718811,
-0.4729059040546417,
0.30148285627... | |
private string _phonebookEntry;
public CollectionView PhonebookEntries
{
get { return _phonebookEntries; }
}
public string PhonebookEntry
{
get { return _phonebookEntry; }
set | [
0.037359222769737244,
-0.24569375813007355,
0.5242792963981628,
-0.04271550104022026,
0.35930994153022766,
-0.08279222249984741,
0.2393813282251358,
-0.015481705777347088,
0.1894313395023346,
-0.544014573097229,
-0.5533269643783569,
0.7600234746932983,
-0.15098075568675995,
-0.048033889383... | |
{
if (_phonebookEntry == value) return;
_phonebookEntry = value;
OnPropertyChanged("PhonebookEntry");
}
}
private void OnPropertyChanged(string propertyName)
{ | [
0.01940922625362873,
-0.18252822756767273,
0.5001108050346375,
-0.20848414301872253,
0.9217369556427002,
-0.019728465005755424,
0.2205621898174286,
-0.2040814757347107,
0.006411139387637377,
-0.42337581515312195,
-0.2953914701938629,
0.9512940049171448,
-0.21511529386043549,
0.365045130252... | |
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
public event PropertyChangedEventHandler PropertyChanged;
}
}
```
**Edit:** Geoffs second example does not seem to work, which seems a bit odd to me. If I **change the PhonebookEntries... | [
-0.0713866576552391,
-0.3774264454841614,
0.5519370436668396,
0.13218870759010315,
0.23689725995063782,
-0.4176613390445709,
0.4481038749217987,
-0.19465580582618713,
-0.33287638425827026,
-0.6956391334533691,
-0.08772657066583633,
0.8485850095748901,
-0.03308594226837158,
0.39999786019325... | |
issue with the CollectionView? I noticed a warning in the output console:
> System.Windows.Data Warning: 50 : Using CollectionView directly is not fully supported. The basic features work, although with some inefficiencies, but advanced features may encounter known bugs. Consider using a derived class to avoid these p... | [
0.448018342256546,
-0.308380126953125,
0.4967351257801056,
0.10494077205657959,
-0.006818453315645456,
-0.37065330147743225,
0.21830911934375763,
-0.25105607509613037,
-0.19411376118659973,
-0.34551379084587097,
-0.24636614322662354,
0.654327929019928,
-0.3863193392753601,
-0.0470957905054... | |
Am I correct in thinking the following snippet does not work (the array items are not modified) *because* the array is of integer which is value type.
```
class Program
{
public static void Main()
{
int[] ints = new int[] { 1,2 };
Array.ForEach(ints, new Action<int>(AddTen));
// ints... | [
0.18674510717391968,
0.1602705419063568,
0.5589630007743835,
-0.5112816095352173,
0.16193436086177826,
0.12163978070020676,
0.5578851103782654,
-0.79477858543396,
0.07329066097736359,
-0.47427496314048767,
-0.46019446849823,
0.6701576113700867,
-0.1356230080127716,
-0.13903416693210602,
... | |
}
}
```
The same would apply if the example used an array of string, presumably because string is immutable.
The question I have is:-
Is there a way around this? I can't change the signature of the callback method - for instance by adding the ref keyword and I don't want to wrap the value type with a class - which ... | [
0.17435573041439056,
0.11307693272829056,
0.20938517153263092,
-0.3545880913734436,
0.05679889768362045,
-0.10476028919219971,
0.17406779527664185,
-0.22805754840373993,
-0.07170530408620834,
-0.40035369992256165,
-0.08936453610658646,
0.8385835289955139,
-0.32688266038894653,
0.2801016271... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.