text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
I am developing a J2ME application.
I want to split the following string at `"<br>"` & comma:
```
3,toothpaste,2<br>4,toothbrush,3
```
How can I do this?
```
private String[] split(String original,String separator) {
Vector nodes = new Vector();
// Parse nodes into vector
int index = original.indexOf(... | [
0.24027596414089203,
-0.04815000295639038,
0.6659914255142212,
-0.20800529420375824,
0.2677980363368988,
0.3903845548629761,
0.01912732422351837,
-0.3435012996196747,
0.022052040323615074,
-0.7202602624893188,
-0.022677062079310417,
0.43461328744888306,
-0.3177284896373749,
0.3412361443042... | |
nodes.addElement( original );
// Create split string array
String[] result = new String[ nodes.size() ];
if( nodes.size() > 0 ) {
for(int loop = 0; loop < nodes.size(); loop++)
{
result[loop] = (String)nodes.elementAt(loop);
System.out.println(result[loop]);
... | [
-0.03279700130224228,
-0.3894522488117218,
0.38911426067352295,
-0.3103722631931305,
0.28431829810142517,
0.19184477627277374,
0.2104288637638092,
-0.630772054195404,
-0.38888272643089294,
-0.3631010055541992,
-0.29205235838890076,
0.23271246254444122,
-0.5219032168388367,
0.18534030020236... | |
method will let you split a string about the passed separator, much like J2EE's String.split(). So first split the string on the line break tag, and then do it at each offset of the returned array for the "," comma.
e.g.
```
String[] lines = this.split(myString,"<br>");
for(int i = 0; i < lines.length; i++)
{
... | [
0.10984272509813309,
-0.481917142868042,
0.4930153489112854,
-0.0488266684114933,
-0.02383672073483467,
0.10132651776075363,
0.20470574498176575,
-0.6243844628334045,
-0.06756506860256195,
-0.2846962511539459,
-0.011582685634493828,
0.45001810789108276,
-0.525014340877533,
0.03865915536880... | |
I'm Currently reading two excellent books "Working Effectively with Legacy Code" and "Clean Code".
They are making me think about the way I write and work with code in completely new ways but one theme that is common among them is test driven development and the idea of smothering everything with tests and having tes... | [
0.6317389607429504,
0.37477391958236694,
-0.513585090637207,
0.05634584277868271,
0.19177056849002838,
-0.3169967234134674,
0.535114049911499,
-0.3123418092727661,
-0.19667686522006989,
-0.6810909509658813,
0.16133065521717072,
0.5915704965591431,
0.2017814815044403,
0.17198190093040466,
... | |
that I have a method 500 lines long. I would assume I'll have a set of equivalent testing methods to test that method. When I split this function up, do I create new tests for each new method/class that results?
According to "Clean Code" any test that takes longer than 1/10th of a second is a test that takes too long.... | [
0.6189921498298645,
-0.05242384597659111,
-0.2809136211872101,
0.31374382972717285,
0.06902848184108734,
-0.13539515435695648,
0.49844974279403687,
-0.0784263163805008,
-0.18620216846466064,
-0.2427978366613388,
0.3011772930622101,
0.4788336753845215,
0.001822384656406939,
0.22015210986137... | |
with is the initial test creation.
Question 2:
What happens when the code is re-factored so much that structurally it no longer resembles the original code (new parameters added/removed to methods etc). It would follow that the tests will need re-factoring also? In that case you could potentially altering the function... | [
0.4675481915473938,
-0.11552610248327255,
-0.3568039536476135,
0.1744469702243805,
-0.05235917493700981,
-0.3378538191318512,
0.09674633294343948,
-0.4122176766395569,
-0.07807064801454544,
-0.4292277693748474,
0.10556389391422272,
0.6668596267700195,
-0.18797193467617035,
-0.0560485608875... | |
code. Legacy meaning a system with no tests and which is tightly coupled. When adding tests for that code, you are effectively adding integration tests. When you refactor and add the more specific test methods that avoid the network calls, etc those would be your unit tests. You want to keep both, just have then separa... | [
0.42099958658218384,
-0.07334668189287186,
-0.17652398347854614,
0.2885913550853729,
0.32392093539237976,
-0.19514209032058716,
0.21280132234096527,
-0.4197803735733032,
-0.2650320529937744,
-0.6957085132598877,
0.03402067720890045,
0.3601565659046173,
-0.19487179815769196,
0.1683820337057... | |
"update 2" on [How can I improve my junit tests](https://stackoverflow.com/questions/589603/how-can-i-improve-my-junit-tests/589620#589620). It isn't about legacy code and dealing with the coupling it already has, but on how you go about writing logic + tests where external systems are involved i.e. databases, emails, ... | [
-0.00954264122992754,
-0.17766223847866058,
0.06492051482200623,
0.11539609730243683,
-0.2736954987049103,
-0.22845563292503357,
0.18296189606189728,
-0.6223061680793762,
0.2153455913066864,
-0.6995670795440674,
-0.25098827481269836,
0.48490601778030396,
-0.0020555343944579363,
-0.36734962... | |
I am starting atmost 5 threads in a program in C# .NET. But sometimes some of those threads just quit or become dead inexplicably even before the completion of execution of the function assigned to it.
It happens randomly . If I try to debug the code by putting breakpoints- It works fine.
And sometimes all the thread... | [
0.47517091035842896,
0.04904130846261978,
0.4343975782394409,
-0.20227570831775665,
0.3000617027282715,
0.18047025799751282,
0.45919108390808105,
-0.15540365874767303,
-0.21169890463352203,
-0.7864416837692261,
0.049332812428474426,
0.5355753898620605,
-0.5355992317199707,
0.00682058651000... | |
>= 0; --count)
{
ds[count] = dba.getData(ru[count]);
td[count] = new Thread(delegate() { runRule[count].performTask(ru[count], ds[count], count); });
td[count].Name = "Thread " + count.ToString();
td[count].Start(); | [
0.12067019939422607,
-0.5191977024078369,
0.45728394389152527,
-0.360046923160553,
0.10388369113206863,
0.07172992080450058,
0.6744167804718018,
-0.7267666459083557,
-0.10628483444452286,
-0.4040208160877228,
-0.37166815996170044,
0.25271371006965637,
-0.40971246361732483,
0.69074916839599... | |
Thread.Sleep(50);
}
```
If I remove the last line "Thread.Sleep(50)" only the first thread stared runs and rest of them just die.
can someone explain why the threads are becoming dead?
I suspect they're not becoming dead - I suspect the problem is that you're not actually running the rules you think you ... | [
0.42126768827438354,
-0.3074462413787842,
0.3257521092891693,
-0.06848646700382233,
0.40077003836631775,
-0.22483588755130768,
0.1392444223165512,
-0.21408160030841827,
-0.473800390958786,
-0.7956788539886475,
-0.2669236660003662,
0.3022160530090332,
-0.5906027555465698,
0.3708697259426117... | |
it (as the loop counter decreases). By the time a thread created when count=4 starts running, `count` may be 3 - so it will be calling `runRule[3].performTask(ru[3], ds[3], 3)`. In fact, `count` could change *while the expressions are being evaluated* which could cause a lot of fun.
The way to get round this is to hav... | [
0.308346688747406,
-0.44969937205314636,
0.5634042024612427,
-0.07718974351882935,
0.0009952494874596596,
-0.22105221450328827,
0.6040189266204834,
-0.4157465100288391,
-0.2762165069580078,
-0.49215131998062134,
-0.1131894588470459,
0.4861813485622406,
-0.5766504406929016,
0.45395404100418... | |
{
runRule[copy].performTask(ru[copy], ds[copy], copy);
});
td[count].Name = "Thread " + count.ToString();
td[count].Start();
Thread.Sleep(50);
}
```
Now the only variables being captured in the delegate are `copy` and `runRule`/`ru`/`ds` - I'm assuming that the latter three don't change. A ... | [
0.4362124502658844,
-0.2066238969564438,
0.16269199550151825,
0.09188219159841537,
0.4334268867969513,
-0.23706409335136414,
0.4839824140071869,
-0.3951227366924286,
-0.4279748797416687,
-0.36051204800605774,
-0.22819365561008453,
0.4600840210914612,
-0.39097124338150024,
0.512727260589599... | |
I am implementing a custom list definition that contains several columns. A requirement to one of the columns is, that it can only contain unique values. If a user enters a value that is already present in another list item, a validation error must be shown.
Are there any options for doing this OOTB, perhaps in the li... | [
0.40516290068626404,
0.14625714719295502,
0.44771575927734375,
-0.08550204336643219,
0.0366172268986702,
-0.0463271290063858,
0.08479394018650055,
-0.32853659987449646,
-0.35720887780189514,
-0.5208335518836975,
0.25034746527671814,
0.4081681966781616,
-0.43075984716415405,
0.2285879999399... | |
the same value and set the IsValid property accordingly.
2. Write your own ItemAdding and ItemUpdating eventreceivers to query the list. | [
-0.27891629934310913,
-0.5905408263206482,
0.34192824363708496,
0.18341480195522308,
-0.011315593495965004,
-0.2541055977344513,
-0.050580061972141266,
-0.3729369342327118,
-0.21110621094703674,
-0.7400315403938293,
-0.07907981425523758,
0.6416615843772888,
-0.23500432074069977,
-0.0730882... | |
I know C,C++,COBOL.
Now I am trying to learn C# and I want to do some hobby projects with C#.
So can you suggest where do I start from.
I searched on google but I want to start from a book which gives me more practice problems for a new comer to .net
Can anybody suggest a great book online which I should really start f... | [
0.7881587743759155,
-0.0237631406635046,
-0.03977416455745697,
-0.008045938797295094,
0.14988331496715546,
-0.39125141501426697,
0.21987766027450562,
0.41944393515586853,
-0.22315841913223267,
-0.4443541169166565,
0.2545022964477539,
0.7856960892677307,
0.032515134662389755,
-0.05809105932... | |
C# in 24 hours](http://www.flazx.com/ebook10401.php) | [
0.2965444028377533,
-0.16721569001674652,
0.5750139355659485,
-0.06096161529421806,
0.29949337244033813,
-0.27864328026771545,
0.1430882215499878,
-0.21490547060966492,
-0.3617682456970215,
-0.029318908229470253,
-0.27532729506492615,
0.660004734992981,
-0.14468513429164886,
-0.02441213279... | |
I've been told that ASP.NET is multithreaded by default in IIS. How is this threading achieved?
Does the server farm send different requests to different cores?
Does a single request make use of multiple cores?
More importantly, are there any advantages to adding threads to ASP.NET code if the threading is done hi... | [
0.30308249592781067,
-0.18779687583446503,
0.06771673262119293,
0.28963881731033325,
-0.08659375458955765,
-0.16302607953548431,
0.2619090676307678,
-0.11503725498914719,
-0.64066082239151,
-0.7754817605018616,
0.04664221778512001,
0.5154473185539246,
-0.37851303815841675,
0.17719601094722... | |
make all the decisions for you. | [
0.5722161531448364,
0.5928351283073425,
-0.22815680503845215,
0.04660441726446152,
-0.04048418626189232,
-0.09638088196516037,
-0.22036132216453552,
0.35008710622787476,
0.010943051427602768,
-0.6073826551437378,
-0.341378390789032,
0.5509710907936096,
-0.12421132624149323,
-0.366984009742... | |
In my plugin de.support.help are the plugin.properties files.
These properties files include the strings for the preference page.
I want to use this plugin for different customers, but the customer name is inside the properties files.
I want to patch the properties files by using the eclipse fragment mechanism. As fa... | [
0.5872159600257874,
0.3474467694759369,
0.39320680499076843,
-0.08201217651367188,
-0.013461269438266754,
-0.02952452190220356,
-0.018818873912096024,
-0.33393627405166626,
0.10986772179603577,
-0.8747550845146179,
-0.11589315533638,
0.6321176886558533,
-0.14351311326026917,
0.240959212183... | |
is shown, but it is not. I had tested the same with java classes a long time ago and i remember that t his was working. The java code from the fragment was placed to the original plugin.
Do you have any idea to handle this? Or do i misunderstand the fragment mechanism?
Thanks
**EDIT:**
When i remove the plugin.prop... | [
0.3690759837627411,
0.16244882345199585,
0.2622503340244293,
0.06536455452442169,
0.007709219586104155,
-0.13770784437656403,
0.07328112423419952,
-0.4110007882118225,
-0.2786705493927002,
-0.8108716607093811,
0.01884603686630726,
0.585867166519165,
-0.2571832835674286,
-0.1078987345099449... | |
intentions
```
Declare @RowNum as INT
SET @RowNum = 15 ---Just for example
WITH OrdersRN AS
(
SELECT ROW_NUMBER() OVER(ORDER BY OrderDate, OrderID) AS RowNum
,OrderID
,OrderDate
,CustomerID
,EmployeeID
FROM dbo.Orders
)
SELECT *
FROM OrdersRN
WHERE RowNum = @RowN... | [
0.3729522228240967,
0.09366122633218765,
0.6312464475631714,
-0.5092726945877075,
0.05354641005396843,
0.2380998283624649,
0.3917551040649414,
-0.4083070755004883,
-0.14744512736797333,
-0.4798569977283478,
0.03285982087254524,
0.6808272004127502,
-0.0507931262254715,
-0.13125263154506683,... | |
A beginner question:
I have a stored proc (just a procedure, without any packages) in the Oracle Database:
```
CREATE OR REPLACE procedure FII_DBO.CLEAR_UNIT_TEST_PRODUCT
IS
BEGIN
...
END CLEAR_UNIT_TEST_PRODUCT;
```
and it works fine in TOAD. However, when I try to run it from C# it complains:
```
System.Data.Or... | [
0.10851205885410309,
0.25868839025497437,
0.15521977841854095,
-0.17848864197731018,
0.07866648584604263,
-0.2781197726726532,
0.2929586172103882,
-0.23182198405265808,
0.2588156461715698,
-0.38157394528388977,
-0.3723665475845337,
0.668549120426178,
-0.1783279925584793,
-0.148127198219299... | |
I'm looking for a solution for producing SPSS format data files for loading into SPSS. The few offerings I can find are all commercial.
Has anyone experience with generating SPSS-format data files using open-source, freeware or home-grown solutions?
I'm not even sure that the file format is "open". Any hints apprecia... | [
0.3648447096347809,
0.14032192528247833,
0.09760274738073349,
0.10488813370466232,
-0.11219994723796844,
-0.028323642909526825,
0.053430505096912384,
0.22898277640342712,
-0.28507405519485474,
-0.5762739777565002,
-0.047078151255846024,
0.37208884954452515,
-0.20211045444011688,
-0.1180053... | |
data.
Syntax files themselves use a proprietary "language" to describe the load procedure. Unfortunately, open source alternatives to SPSS (e.g. PSPP) do not support the syntax language to the full extent needed to replicate this solution. | [
0.04704933613538742,
-0.058416176587343216,
0.2695130407810211,
0.4268791377544403,
-0.04964000731706619,
-0.24634742736816406,
-0.036986883729696274,
-0.1844111680984497,
-0.25801584124565125,
-0.20727907121181488,
-0.6096752285957336,
0.3500881493091583,
-0.34151190519332886,
-0.09467381... | |
Are there benefits of writing a web service interface whose methods all take and return XML documents, rather than the more usual parameter lists of native types and classes?
We have some existing web services that are designed like this. The XML documents that are passed to their methods are typically large (as in th... | [
0.3390536308288574,
0.11772575974464417,
0.10066995769739151,
0.5153193473815918,
-0.10629789531230927,
-0.1904342621564865,
0.020170792937278748,
-0.15201927721500397,
-0.14272910356521606,
-0.6282368898391724,
0.22852715849876404,
0.48548340797424316,
-0.16545487940311432,
-0.24130502343... | |
services are written in C#, and the clients are written in C# and also Java (some of our business partners use Java).
If you absolutely know for sure what your end-user/client technology is (for example pure .NET and Java where the feature set is probably the richest) then by all means go ahead and take advantage of st... | [
0.582176148891449,
0.22243064641952515,
0.24512124061584473,
0.07066597789525986,
0.005363865289837122,
0.09408872574567795,
0.2395443618297577,
0.4604058265686035,
-0.20110222697257996,
-0.7409144043922424,
-0.059761893004179,
0.6797218918800354,
0.0697346031665802,
-0.12897680699825287,
... | |
of mixed bag of clients, and whilst I'd love to make life simple for us, we have to dumb down a bit purely to ensure maximum interoperability. | [
0.5912293195724487,
0.21283772587776184,
0.342977374792099,
-0.23570501804351807,
0.22766470909118652,
0.20326803624629974,
0.31546658277511597,
0.11399246752262115,
0.019367491826415062,
-0.2528972327709198,
0.07302244007587433,
0.6177645921707153,
-0.15969641506671906,
-0.111954011023044... | |
I am really confused how to compute precision and recall in clustering applications.
I have the following situation:
Given two sets A and B. By using a unique key for each element I can determine which of the elements of A and B match. I want to cluster those elements based on features (not using the unique key of co... | [
-0.13270539045333862,
0.15111887454986572,
0.31332820653915405,
0.011410795152187347,
-0.07917702943086624,
0.19293232262134552,
-0.1776447296142578,
-0.2601466476917267,
-0.3076198101043701,
-0.5773786306381226,
-0.14951495826244354,
0.2756025791168213,
0.031933654099702835,
0.31294956803... | |
items
I really do not get what elements fall under which category.
What I did so far is, I checked within the clusters how many matching pairs I have (using the unique key). Is that already one of precision or recall? And if so, which one is it and how can I compute the other one?
Update: I just found another paper ... | [
0.09137728065252304,
-0.028749963268637657,
0.29063424468040466,
0.3254205286502838,
-0.48239666223526,
0.2545596957206726,
0.08629314601421356,
-0.09303134679794312,
-0.5386101603507996,
-0.4565820097923279,
0.07306251674890518,
0.24173417687416077,
0.21620535850524902,
0.2815360128879547... | |
true positives /( true positivies + false negatives) | [
0.04613475129008293,
0.14722955226898193,
-0.23204657435417175,
0.18313005566596985,
-0.2812107503414154,
0.4273723363876343,
0.697068989276886,
-0.0189797542989254,
-0.03233575075864792,
-0.34893086552619934,
0.030889682471752167,
0.8176658153533936,
-0.014917153865098953,
-0.338981360197... | |
It seems that serializing Entity Framework objects into JSON is not possible using either WCF's native DataContractJsonSerializer or ASP.NET's native JavaScript serializer. This is due to the reference counting issues both serializers reject. I have also tried [Json.NET](http://james.newtonking.com/projects/json-net.as... | [
-0.07866305112838745,
0.23951679468154907,
0.3862632215023041,
-0.1573331505060196,
-0.19887232780456543,
-0.18741153180599213,
0.384030818939209,
-0.07676013559103012,
-0.34224462509155273,
-0.4416668713092804,
-0.07932976633310318,
0.3879060745239258,
-0.461905300617218,
0.27083715796470... | |
went though at <https://blog.programx.co.uk/2009/03/18/wcf-json-serialization-woes-and-a-solution/>
Have I missed something obvious?
The way I do this is by projecting the data I want to serialize into an anonymous type and serializing that. This ensures that only the information I actually want in the JSON is seriali... | [
0.10870905220508575,
0.02738378383219242,
0.29336681962013245,
-0.08820480108261108,
-0.22964638471603394,
-0.4941900968551636,
0.10028509795665741,
0.1305040866136551,
-0.5038539171218872,
-0.338324636220932,
-0.04012462496757507,
0.4423801600933075,
-0.26332446932792664,
0.41285938024520... | |
Prop1 = entity.Prop1,
Prop2 = entity.Prop2,
ChildProp = entity.Child.Prop
}
return Json(records);
```
I find anonymous types just about ideal for this. The JSON, obviously, doesn't care what type was used to produce it. And anonymous types give you complete flexibilit... | [
0.09011298418045044,
-0.19997435808181763,
0.1081460490822792,
0.10151809453964233,
0.24701304733753204,
0.07314497232437134,
0.14699071645736694,
0.029842419549822807,
-0.23278899490833282,
-0.3081412613391876,
-0.23458610475063324,
0.5744140148162842,
-0.5230761170387268,
0.1806007772684... | |
structure you put into the JSON. | [
0.2836720049381256,
0.09038765728473663,
-0.18922735750675201,
0.3020278811454773,
0.024087756872177124,
-0.1910410076379776,
-0.16113139688968658,
0.02396768145263195,
-0.4038366675376892,
-0.760760486125946,
0.01365284901112318,
0.3634756803512573,
0.05239873006939888,
-0.018104942515492... | |
I have developed an application using .net 3.5 and have deployed it as an .exe on a number of machines with the same environment.
However, on one particular machine I get the following error. Stack Trace:
---
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.... | [
-0.02444036677479744,
0.23769362270832062,
0.15571200847625732,
0.052899882197380066,
-0.033018697053194046,
0.03261808305978775,
0.46961548924446106,
-0.2802189588546753,
-0.2907600700855255,
-0.6560931205749512,
0.03851933404803276,
0.18320193886756897,
-0.3399689495563507,
0.29454368352... | |
at System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, String location, Evidence evidence)
at System.Xml.Serialization.XmlSerializer.GetSerializersFromCache(XmlMapping[] mappings, Type type)
at System.Xml.Serialization.XmlSerializer.FromMappings(XmlMapping[... | [
-0.27296221256256104,
-0.17918376624584198,
0.698223352432251,
0.07045073807239532,
0.23562952876091003,
0.19905468821525574,
0.000290209281956777,
-0.417082816362381,
-0.5983893275260925,
-0.5424012541770935,
-0.5448951125144958,
0.35542067885398865,
-0.2270253598690033,
0.202425763010978... | |
Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
CashflowGenerator
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/DATA/DEVEL/Output/CashflowGenerator.exe
System.Windows.Forms
... | [
-0.6920976638793945,
-0.1039658933877945,
0.716223955154419,
-0.31388354301452637,
-0.1294308453798294,
0.45929959416389465,
0.08259676396846771,
-0.28948330879211426,
-0.3374485373497009,
-0.5829679369926453,
-0.06887177377939224,
0.4744948148727417,
-0.17529712617397308,
0.01958734728395... | |
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
... | [
-0.3039688467979431,
0.39811259508132935,
0.20427483320236206,
-0.10225607454776764,
-0.059055451303720474,
0.11573129892349243,
0.5058572888374329,
-0.3063734769821167,
-0.31357669830322266,
-0.6406749486923218,
-0.3661626875400543,
0.2368491291999817,
-0.3790099322795868,
0.3543837368488... | |
to the JIT debugger registered on the computer
rather than be handled by this dialog box.
---
Could someone help me with this?
As I am new to .net could someone also tell me when why a temporary class needs to be created in the first place?
XML Serialisation works by generating code to perform the serialisation. Thi... | [
0.3716595768928528,
-0.09833578020334244,
-0.15721428394317627,
0.14449790120124817,
-0.4409019649028778,
-0.13642467558383942,
0.37118494510650635,
0.15633052587509155,
-0.1835496723651886,
-0.6014350652694702,
0.04076078161597252,
0.24047134816646576,
-0.10837168991565704,
0.111365839838... | |
this is likely to be a bad idea). (2) Use the SDK tool ([sgen.exe](http://msdn.microsoft.com/en-us/library/bk3w6240(VS.80).aspx)) to pre-generate (at development/compile time) the serialisation assembly, and then use (and deplot) that assembly.
1Open question: the APIs exist to create assemblies dynamically in memory:... | [
0.16764777898788452,
-0.27549055218696594,
-0.05846291780471802,
0.15216025710105896,
0.16333669424057007,
-0.16371656954288483,
0.09579022973775864,
-0.33377835154533386,
-0.43575143814086914,
-0.30834469199180603,
-0.2413555234670639,
0.2992129325866699,
-0.5449678301811218,
-0.055554885... | |
I am using expat parser to parse an XML file of around 15 GB . The problem is it throws an "Out of Memory" error and the program aborts .
I want to know has any body faced a similar issue with the expat parser or is it a known bug and has been rectified in later versions ?
I've used expat to parse large files before a... | [
0.3004850745201111,
0.3479158580303192,
0.22186502814292908,
-0.03289080038666725,
0.14058293402194977,
-0.28644803166389465,
0.21514275670051575,
-0.07136690616607666,
-0.3726569712162018,
-0.3765329420566559,
-0.2751733958721161,
0.5466467142105103,
-0.1466628611087799,
-0.05726372078061... | |
to load the whole file into memory.
Are you allocating objects as you parse the XML and maybe not deallocating them? That would be the first thing I would check for. One way to check if the problem is really with expat or not - if you reduce the program to a simple version that has empty tag handlers (i.e. it just par... | [
0.2563876509666443,
-0.27651333808898926,
-0.37423017621040344,
0.3133254647254944,
-0.11441249400377274,
-0.2409534901380539,
-0.004750017076730728,
-0.01062547042965889,
-0.5320343375205994,
-0.22165527939796448,
0.039928581565618515,
0.5029094219207764,
-0.6130994558334351,
-0.151409447... | |
I seem to be confused about PHP output buffering. I have code like this:
```
function return_json($obj) {
ob_get_clean();
ob_start();
header("Content-Type: application/json");
echo json_encode($obj);
exit;
}
```
But it doesn't seem to like the ob\_get\_clean(). I do that because some HTML might accidentall... | [
0.16782832145690918,
0.12455099076032639,
0.5631208419799805,
-0.3353036344051361,
-0.07698401063680649,
-0.24186940491199493,
0.4306221902370453,
0.05260471999645233,
-0.4195623993873596,
-0.6632731556892395,
-0.13070151209831238,
0.4841654598712921,
-0.5186977386474609,
0.107559047639369... | |
If I need to retrieve a large string from a DB, Is it faster to search for it using the string itself or would I gain by hashing the string and storing the hash in the DB as well and then search based on that?
If yes what hash algorithm should I use (security is not an issue, I am looking for performance)
If it matte... | [
0.1393556147813797,
0.10942564904689789,
0.11269834637641907,
0.08043823391199112,
-0.2680915892124176,
-0.18033643066883087,
0.2092949002981186,
-0.39300093054771423,
0.009822344407439232,
-0.7241030931472778,
-0.040399324148893356,
0.6320265531539917,
-0.1007099524140358,
0.0528842844069... | |
performance to be tuned by a DBA using tried and trusted methods. Hard coding your own index optimisation will prevent this and may stop you gaining for any performance improvements in indexing in future versions of the DB. | [
0.2741757929325104,
0.06480870395898819,
0.3495999872684479,
0.35765063762664795,
-0.019586874172091484,
-0.27490565180778503,
0.37750768661499023,
-0.4107385575771332,
0.14381276071071625,
-0.5865599513053894,
-0.16519537568092346,
0.7354693412780762,
-0.11805567145347595,
-0.174357637763... | |
Does SCP have a problem setting file permissions or have I misconfiguration my server?
Use case:
---------
There is a file on a server that I want to edit called "importantFile.txt". The file has owner and group of "master":
```
ls -l importantFile.txt:
-rw-rw-r-- 1 master master 7 Mar 18 08:11 importantFile.tx... | [
-0.26745688915252686,
-0.012367826886475086,
0.7657715082168579,
-0.09408457577228546,
0.25435763597488403,
-0.5761737823486328,
-0.07990443706512451,
0.1473473757505417,
-0.476047545671463,
-0.6250346302986145,
-0.17777496576309204,
0.23446974158287048,
-0.16562405228614807,
-0.0525501854... | |
to the server:
```
echo "bored slave info" > importantFile.txt
scp importantFile.txt slave@theServerAddress:/pathToFile/importantFile.txt
```
If I do this, the contents of the file on the server are uploaded fine and the timestamp of the file is updated but the permissions of the file don't change, the file is still... | [
0.5218076705932617,
0.06745978444814682,
0.7338034510612488,
0.14282678067684174,
-0.03794360160827637,
-0.2060355246067047,
0.21436680853366852,
0.0319695807993412,
-0.4856983721256256,
-0.5976769924163818,
-0.12185865640640259,
0.5919138789176941,
-0.22017619013786316,
0.5921242833137512... | |
- try logging on to the server as slave, and editing the file using your favourite text editor... You'll find the same behaviour occurs... Writing to a file does not make you the owner of the file.
---
Example:
as root
```
#cd /tmp
#mkdir fubar
#chgrp vboxusers fubar
#cd fubar/
#touch testfile
#chgrp vboxusers test... | [
0.06362790614366531,
0.1054299995303154,
0.5972046852111816,
-0.18448308110237122,
-0.3569249212741852,
0.3748621344566345,
0.8068010807037354,
-0.5003047585487366,
-0.20775531232357025,
-0.48687201738357544,
-0.11128285527229309,
0.5565373301506042,
-0.5692271590232849,
0.1951819360256195... | |
15 root root 12288 2009-03-19 10:29 ..
-rw-rw-r-- 1 root vboxusers 4 2009-03-19 10:30 testfile
```
as user (in vboxusers group)
```
>cd /tmp/fubar
>ls -al
total 20
drwxrwxr-x 2 root vboxusers 4096 2009-03-19 10:30 .
drwxrwxrwt 15 root root 12288 2009-03-19 10:29 ..
-rw-rw-r-- 1 root vboxusers 4... | [
-0.3016423285007477,
0.19934691488742828,
0.3717072904109955,
-0.12725196778774261,
-0.3168129324913025,
0.5975213646888733,
0.8167516589164734,
-0.3147599995136261,
-0.30681630969047546,
-0.3482103645801544,
-0.20199570059776306,
0.6739078164100647,
-0.26811498403549194,
0.135971814393997... | |
2009-03-19 10:31 testfile
>vim testfile
>ls -al
total 20
drwxrwxr-x 2 root vboxusers 4096 2009-03-19 10:31 .
drwxrwxrwt 15 root root 12288 2009-03-19 10:31 ..
-rw-rw-r-- 1 root vboxusers 12 2009-03-19 10:31 testfile
>cat testfile
foo
bar
baz
``` | [
-0.020789191126823425,
0.13598155975341797,
0.3182562291622162,
-0.32175877690315247,
-0.16386617720127106,
0.4877619743347168,
0.959632396697998,
-0.27783969044685364,
-0.19229990243911743,
-0.2501002252101898,
-0.29902493953704834,
0.742559015750885,
-0.5304496884346008,
-0.0788366794586... | |
I'm trying to bind to a `Readonly` property with `OneWayToSource` as mode, but it seems this cannot be done in XAML:
```
<controls:FlagThingy IsModified="{Binding FlagIsModified,
ElementName=container, | [
0.015161048620939255,
0.02487669698894024,
0.41320839524269104,
-0.07142850011587143,
0.3403347432613373,
-0.5015833973884583,
0.34125587344169617,
-0.2796007990837097,
-0.034605830907821655,
-0.5352376103401184,
0.11320739984512329,
0.24746887385845184,
-0.43210238218307495,
0.20763425529... | |
Mode=OneWayToSource}" />
```
I get:
> The property 'FlagThingy.IsModified' cannot be set because it does not have an accessible set accessor.
`IsModified` is a readonly `DependencyProperty` on `FlagThingy`. I want to bind that value to the `FlagIsModified` property on the container.
To be clear:
```
FlagThingy... | [
0.0419628843665123,
-0.33714377880096436,
0.7035980820655823,
0.060390572994947433,
0.17943300306797028,
-0.5612578988075256,
0.376690536737442,
-0.11227710545063019,
-0.13163939118385315,
-0.5878512263298035,
-0.15136896073818207,
0.8238966464996338,
-0.5324624180793762,
0.055891834199428... | |
definition
public partial class FlagThingy : UserControl
{
public static readonly DependencyProperty IsModifiedProperty =
DependencyProperty.Register("IsModified", typeof(bool), typeof(FlagThingy), new PropertyMetadata());
}
```
```xml
<controls:FlagThingy x:Name="_flagThingy" />
```
```cs
// Bindi... | [
-0.08960532397031784,
-0.21471983194351196,
0.5051776766777039,
0.023594291880726814,
0.10067863017320633,
-0.10604912787675858,
0.2667253613471985,
-0.6371273994445801,
0.012872256338596344,
-0.7103263735771179,
-0.3514029085636139,
0.3568112850189209,
-0.5018353462219238,
0.0610648505389... | |
get { return (bool)GetValue(IsModifiedProperty); }
set { throw new Exception("An attempt ot modify Read-Only property"); }
}
}
```
```xml
<controls:FlagThingy IsModified="{Binding Path=FlagIsModified,
ElementName=container, Mode=OneWayToSource}" />
```
Option # 3 (True read-only dependency property... | [
-0.36459794640541077,
-0.09223035722970963,
0.6289640069007874,
0.08601054549217224,
0.10233838856220245,
-0.11116470396518707,
0.273906946182251,
-0.5722134113311768,
-0.18853628635406494,
-0.515620231628418,
-0.5385149717330933,
0.4871065616607666,
-0.31394103169441223,
-0.12784743309020... | |
the answer:
```cs
internal static BindingExpression CreateBindingExpression(DependencyObject d, DependencyProperty dp, Binding binding, BindingExpressionBase parent)
{
FrameworkPropertyMetadata fwMetaData = dp.GetMetadata(d.DependencyObjectType) as FrameworkPropertyMetadata;
if (((fwMetaData != null) && !fwMet... | [
-0.2624221444129944,
0.10460244119167328,
0.5642693638801575,
-0.12367744743824005,
0.16411007940769196,
0.1824159026145935,
0.4910678267478943,
-0.7007154226303101,
0.03944961726665497,
-0.3664550185203552,
-0.4991385340690613,
0.3342481255531311,
-0.3012601435184479,
0.3066408634185791,
... | |
What's the best way to set up help (specifically [HTML Help](http://msdn.microsoft.com/en-us/library/ms670068(VS.85).aspx)) for a Delphi application? I can see several options, all of which has disadvantages. Specifically:
1. I could set HelpContext in the forms designer wherever appropriate, but then I'm stuck having... | [
-0.055849090218544006,
-0.12096679955720901,
0.5430778861045837,
0.1561891883611679,
-0.02926444076001644,
0.011795558966696262,
0.18728289008140564,
-0.29140809178352356,
0.028330525383353233,
-0.6122085452079773,
0.009100120514631271,
0.6440954804420471,
-0.19724515080451965,
-0.40281030... | |
jump (like Application.HelpJump), I'd have to make sure that each of my help pages has a unique, non-changing, top-level keyword; this seems like extra work. (And there are HelpKeyword-related VCL bugs like [this](http://qc.codegear.com/wc/qcmain.aspx?d=31175) and [this](http://qc.embarcadero.com/wc/qcmain.aspx?d=69784... | [
0.29167139530181885,
-0.2687475383281708,
0.6069820523262024,
0.1659580022096634,
-0.42471545934677124,
-0.22161296010017395,
0.0027831371407955885,
-0.36310842633247375,
-0.6109289526939392,
-0.11419694870710373,
-0.0376439094543457,
0.6158168315887451,
-0.32670584321022034,
-0.1475352346... | |
than with it.
**Which approach did you choose for your app?**
I create the help file, which gets the help topic ID, and then go around the forms and set their HelpContext values to them. Since the level of maintenance needed is very low - the form is unlikely to change help file context unless something major happens ... | [
0.3619977533817291,
-0.008235446177423,
0.6356082558631897,
0.14043863117694855,
0.26866140961647034,
0.1783522069454193,
0.12291542440652847,
-0.23808801174163818,
-0.006080583203583956,
-0.7037537693977356,
-0.13300609588623047,
0.7341479659080505,
0.0233425572514534,
-0.4641596078872680... | |
Is there anything explicitly wrong with using has\_and\_belongs\_to\_many associations in rails instead of has\_many :through? I'm aware of [these](http://blog.hasmanythrough.com/2006/4/20/many-to-many-dance-off) [articles](http://blog.hasmanythrough.com/2006/4/17/join-models-not-proxy-collections) [describing](http://... | [
0.01713845320045948,
0.18758626282215118,
0.2614310681819916,
-0.014259085059165955,
-0.14240890741348267,
-0.32640010118484497,
0.24091961979866028,
-0.23776546120643616,
-0.3940761089324951,
-0.37128308415412903,
0.3761546313762665,
0.4441162049770355,
-0.19960348308086395,
0.03863562270... | |
not to use has\_and\_belongs\_to\_many.
**Example many-to-many relationship:**
User belongs to zero or more groups, and group has zero or more members (users).
**Example many-to-many relationship with properties:**
User belongs to zero or more groups, and group has zero or more members with ranks.
For example, Ali... | [
-0.06707286834716797,
-0.13968425989151,
-0.17591769993305206,
0.11943444609642029,
-0.2768116891384125,
-0.09052366018295288,
0.104059599339962,
-0.19649016857147217,
-0.327937513589859,
-0.5434444546699524,
-0.19364620745182037,
0.4288649260997772,
-0.511336088180542,
0.1514662355184555,... | |
Fruits → Apple, Orange, etc.
>
> Vegetables → Carrot, Celery, etc.
therefore:
> Food → Apple, Orange, Carrot, Celery, etc. | [
-0.37997910380363464,
-0.21272346377372742,
-0.1608744114637375,
0.04827414080500603,
-0.02405226230621338,
0.717959463596344,
0.3123224675655365,
0.42056551575660706,
-0.4277377128601074,
-1.0115807056427002,
-0.3783118426799774,
0.152830109000206,
-0.10421782732009888,
-0.106400310993194... | |
I've got a table and want to outer-join another table, getting only the first row (the one with lowest nr) of the second table using Oracle 10g.
**Edit:** nr is unique within an id
```
Table x Table y
id id nr code
1 1 1 B
2 1 2 A
3 2 2 | [
0.20515941083431244,
0.3720570504665375,
0.527031421661377,
-0.15331850945949554,
-0.21340568363666534,
0.20862232148647308,
0.022181134670972824,
-0.5715134143829346,
-0.4487295150756836,
-0.6150201559066772,
0.1614934355020523,
-0.0005267705419100821,
0.13560082018375397,
0.1443202048540... | |
A
Expected result:
id nr code
1 1 B
2 2 A
3 NULL NULL
```
Example with test data (does not do the limitation to single row but should allow faster testing):
```
WITH
x AS( SELECT 1 id FROM dual UNION SELECT 2 FROM dual UNION SELECT 3 FROM dual ),
y AS( SELECT 1 id, 1 nr, 'B' code F... | [
0.10885243117809296,
-0.07407496869564056,
0.2601676881313324,
-0.08376647531986237,
-0.0728740245103836,
0.3276250660419464,
0.2479410618543625,
-0.8556629419326782,
-0.10880158096551895,
-0.3872028589248657,
-0.21338029205799103,
0.19097337126731873,
-0.08446674793958664,
0.1412020325660... | |
'A' FROM dual
UNION SELECT 2, 2, 'A' FROM dual
) -- end of test data
SELECT x.id, y.nr, y.code
FROM x
LEFT OUTER JOIN y ON ( y.id = x.id )
```
```
WITH
x AS( SELECT 1 id FROM dual UNION SELECT 2 FROM dual UNION SELECT 3 FROM dual ),
y AS( SELECT 1 id, 1 nr, 'B' code FROM dual
UNION SELECT 1, 2... | [
0.17112496495246887,
-0.08682947605848312,
-0.06032463535666466,
0.05884946510195732,
-0.14361004531383514,
0.44875115156173706,
0.4020478129386902,
-0.8829361796379089,
0.10881959646940231,
-0.3849697411060333,
-0.36823999881744385,
0.29508742690086365,
-0.024525417014956474,
0.2348070293... | |
-- end of test data
SELECT *
FROM (
SELECT x.id, y.nr, y.code, ROW_NUMBER() OVER (PARTITION BY x.id ORDER BY y.nr) AS rn
FROM x
LEFT OUTER JOIN y
ON y.id = x.id
)
WHERE rn = 1
``` | [
0.10739843547344208,
0.13244810700416565,
0.26320013403892517,
-0.08562099188566208,
0.13151615858078003,
0.3116520047187805,
0.25265854597091675,
-0.8489652872085571,
0.10514041036367416,
-0.33839666843414307,
-0.1729535609483719,
0.25104784965515137,
0.04760599136352539,
0.50722122192382... | |
I'm trying to narrow down some weirdness going on with my AJAX calls. My PHP scripts have this at the start:
```
ob_start("ob_gzhandler");
```
Works great with HTML. But are there any problems with doing it with application/json data? Any browser issues anyone is aware of?
I don't think so... I've used static files ... | [
-0.11348193138837814,
0.18554669618606567,
0.125403493642807,
-0.20382803678512573,
-0.49829038977622986,
-0.10809542238712311,
0.20238038897514343,
0.3685859143733978,
-0.27891242504119873,
-0.7400394082069397,
-0.053388483822345734,
0.5309277772903442,
-0.5615677833557129,
-0.07037286460... | |
Apart from [Fitnesse](http://fitnesse.org/) is there anything like concordion for .NET?
> [Concordion](http://www.concordion.org/) is an open source framework
> for Java that lets you turn a plain
> English description of a requirement
> into an automated test
David Peterson (the author of Concordion) has told me ... | [
0.7052773833274841,
-0.01180384960025549,
-0.23601630330085754,
0.08471128344535828,
-0.22949588298797607,
0.04555803909897804,
0.4375653862953186,
-0.5562825798988342,
0.033035337924957275,
-0.5558117032051086,
0.4289092421531677,
0.26550930738449097,
-0.3575924336910248,
-0.3616396784782... | |
Domain Specific Languages look a lot like Concordion. **However it is Java, not .NET** Thoughtworks claims..
> Twist is the next generation of
> software test automation tools. It
> provides a rich environment for
> authoring, executing, and maintaining
> tests.
[concordion-net](http://code.google.com/p/concordion... | [
0.16507749259471893,
-0.39984601736068726,
0.3263196647167206,
0.25602132081985474,
-0.3373691439628601,
-0.20650668442249298,
0.11462029814720154,
-0.004548538941890001,
0.11284371465444565,
-0.5908365249633789,
0.1534058004617691,
0.08996094763278961,
-0.4736767113208771,
0.0628406479954... | |
I need to implement the method:
```
object GetFactory(Type type);
```
This method needs to return a Func<T> where typeparam 'T' is the 'type'.
So, my problem is that I don't know how to create a Func<?> at runtime using reflection. Activator.CreateInstance doesn't work because there are no constructors on delegate... | [
0.3128059208393097,
0.10402935743331909,
0.23281922936439514,
0.24018660187721252,
0.036943525075912476,
0.15818800032138824,
0.29776039719581604,
-0.3537336587905884,
-0.10766994953155518,
-0.7833243608474731,
0.06906715780496597,
0.5153810977935791,
-0.38128945231437683,
0.42797619104385... | |
static object GetFactory(Type type)
{
Type funcType = typeof(Func<>).MakeGenericType(type);
MethodInfo method = typeof(Program).GetMethod("CreateFoo",
BindingFlags.NonPublic | BindingFlags.Static);
return Delegate.CreateDelegate(funcType, method);
}
static Foo CreateFoo()... | [
0.2646203339099884,
-0.1906736195087433,
0.5326322913169861,
-0.26451146602630615,
0.06605846434831619,
0.3833616077899933,
0.5928406715393066,
-0.274967759847641,
0.06813327968120575,
-0.6187992095947266,
-0.3222349286079407,
0.5019779205322266,
-0.8994168043136597,
0.4778323471546173,
... | |
Foo foo = factory();
}
}
```
For non-static methods, there is an overload of `Delegate.CreateDelegate` that accepts the target instance. | [
0.07429003715515137,
0.11496171355247498,
-0.03867446631193161,
-0.18059803545475006,
-0.1197415441274643,
0.04938312619924545,
0.3556557595729828,
-0.052501779049634933,
-0.12114443629980087,
-0.32904061675071716,
-0.1725078821182251,
0.3399357795715332,
-0.6691460609436035,
0.42740109562... | |
I've currently got in my office a few physical servers hosting a number of VMware guest OSs off VMWare server.
We need to expand the number of VMs we need to use to do some testing and development in house.
A smattering of them are world accessible for our clients, however they are not doing anything particularly loa... | [
0.3893093466758728,
0.10377529263496399,
0.4288213849067688,
0.1978198140859604,
0.13876262307167053,
0.2462276965379715,
-0.0698646828532219,
0.09251628071069717,
-0.40561866760253906,
-0.7728164792060852,
-0.04468254745006561,
0.5255816578865051,
-0.030099734663963318,
0.2793985903263092... | |
be to add a 2nd identical CPU to make it a 2xQuad core Xeon
* as well as upgrade to 8 gigs of ram
2. Get another server of identical specs (1x quadcore 4gig) and put the new VMs on there.
Each VM instance doesn't utilize more than 1 virtual CPU or more than a gig of ram tops. Most of them are rather lightweight linux... | [
0.4724574685096741,
-0.08795231580734253,
0.4787334203720093,
0.365023136138916,
-0.17561809718608856,
0.047967467457056046,
0.039942435920238495,
-0.0874846875667572,
-0.39144065976142883,
-0.5409901142120361,
0.07925420999526978,
0.5249533653259277,
-0.15816131234169006,
0.18803566694259... | |
on as many VMs as possible?
This seems like the VMware prescribed route for saving power and shelf space, especially for our low utilization...but is there any experience that suggests that more physical machines are still better?
The upgrade route for the machine is still an attractive option for us because it is a... | [
0.6748091578483582,
0.16023553907871246,
0.37603798508644104,
0.37780678272247314,
0.11882787197828293,
0.07190606743097305,
0.17595919966697693,
-0.020754007622599602,
-0.4206487536430359,
-0.7010655403137207,
0.14755384624004364,
0.7835755944252014,
0.07761023193597794,
0.090167216956615... | |
will eventually end up with the full 32Gb of RAM as our demands increase. Most are just testing machines for our support team to replicate customer environments so are just idling 24/7, we've got 8Gb physical ram with 16Gb allocated to VMs - usually not a problem unless we're actively using multiple Vista or Server 200... | [
0.27486881613731384,
0.049901820719242096,
0.7380425333976746,
0.22230660915374756,
0.053390633314847946,
-0.05227411538362503,
0.17191676795482635,
-0.183108389377594,
-0.37197285890579224,
-0.6042759418487549,
0.017020802944898605,
0.7430928349494934,
0.007027242332696915,
-0.08519479632... | |
more VMs. Once memory price falls enough we'll start replacing pairs of 2Gb sticks with pairs of 4Gb ones.
Even under heavy load, the bottleneck on our machine is memory. So I'd suggest upgrading your current machine, there's plenty of life left in it yet. | [
0.5363293290138245,
-0.042692411690950394,
0.36636069416999817,
0.5569086670875549,
0.1510290503501892,
-0.11692310869693756,
-0.08006657660007477,
0.1305033266544342,
-0.41975241899490356,
-0.4935319423675537,
0.4081161618232727,
0.7960612177848816,
-0.17108111083507538,
0.209754288196563... | |
In my template.php file I've this:
```
function myadmintheme_theme(&$existing, $type, $theme, $path) {
return array(
'node_form' => array(
'arguments' => array('form' => NULL),
'template' => 'ccktype',
),
);
}
```
And I've a ccktype.tpl.php in the same dir:
```
<b>works!</b>
```
But is... | [
0.43789759278297424,
0.2119034379720688,
0.49435219168663025,
0.024923913180828094,
0.20985417068004608,
-0.17938217520713806,
0.36341652274131775,
-0.3317452073097229,
-0.051563456654548645,
-0.860115647315979,
0.1234874427318573,
0.40076932311058044,
-0.29829853773117065,
0.0862028300762... | |
building, but they still have unique form ids. | [
0.4944700300693512,
0.3850152790546417,
0.26554086804389954,
0.06270157545804977,
0.30447760224342346,
0.19823986291885376,
0.17315761744976044,
-0.15958677232265472,
-0.28245222568511963,
-0.511608898639679,
-0.02890048176050186,
0.06989113241434097,
0.052556924521923065,
0.33235606551170... | |
I want to redefine an (default) implementation in a given windsor-container. Is that what OverWrite is for? Doesn't work, though.
```
container.Register(
Component.For<IServiceOperationAuthorization>()
.OverWrite()
.Instance(_authorization) | [
0.30362316966056824,
0.16244588792324066,
0.24310825765132904,
-0.13662193715572357,
0.446978896856308,
-0.07712763547897339,
0.47332802414894104,
-0.3184252381324768,
-0.13367213308811188,
-0.5790732502937317,
0.06787382066249847,
0.696588933467865,
-0.4581688344478607,
0.1694717705249786... | |
);
```
Any other Ideas?
cheers,
Lars
I actually found a nice solution where I combine xml-files for overrides and use fluent registrations for defaults.
The fluent-API takes the fullname of a impl as the default key. On the fly I override the id's of the xml-config to imitate the key-conventions of the fluent-API.... | [
0.30830174684524536,
0.12485673278570175,
0.6253330111503601,
0.007624672260135412,
-0.09059663861989975,
0.08114594221115112,
0.3764369785785675,
0.0435045026242733,
-0.03658932074904442,
-0.43564361333847046,
-0.12798835337162018,
1.0611674785614014,
-0.27328506112098694,
0.0107373576611... | |
you get it working. I'll do edits if you find any problems)*
```
IList<Type> unnamedServices = new List<Type>();
IDictionary<string, Type> namedServices = new Dictionary<string, Type>();
ComponentDataDelegate registered = captureRegistrations(unnamedServices, namedServices);
container.Kernel.ComponentRegistered += r... | [
0.10507159680128098,
-0.6292860507965088,
0.6594623923301697,
0.017394227907061577,
0.12372774630784988,
0.13127388060092926,
0.3724716305732727,
-0.5394278168678284,
-0.3361549973487854,
-0.5547677874565125,
-0.45231229066848755,
0.81758713722229,
-0.6001083850860596,
-0.02941134572029113... | |
{
unnamedServices.Add(handler.Service);
}
else
{ | [
0.33471953868865967,
-0.3412376344203949,
-0.1963418573141098,
-0.14661401510238647,
0.1129794642329216,
0.13581763207912445,
0.5595002174377441,
-0.06182164326310158,
0.01918422244489193,
-0.2706153988838196,
-0.004177513532340527,
0.7271279692649841,
-0.26149678230285645,
0.2843217849731... | |
namedServices.Add(key, handler.Service);
}
};
}
```
After that before I register services in code, I check if they already have been registered. I also created a base class that makes this more easy. This is an application configuration:
```
public class ApplicationConfiguration : W... | [
0.1839751899242401,
0.12268830090761185,
0.30910131335258484,
-0.13492178916931152,
0.22463074326515198,
0.2589273452758789,
0.39578577876091003,
-0.20291109383106232,
-0.08581482619047165,
-0.5511459112167358,
-0.16103297472000122,
0.6275145411491394,
-0.27276885509490967,
0.3369487822055... | |
var container = createWith(null, "components-config.xml", coreServices, caches, roles);
return new WindsorServiceLocator(container);
}
internal static IEnumerable<IRegistration> coreServices()
{
yield return Component.For<ISystemClock>()
.ImplementedBy<PreciseSystemClock>()
... | [
-0.03136533871293068,
-0.29124927520751953,
0.505928635597229,
0.21361199021339417,
0.28982722759246826,
0.3873687982559204,
0.41323035955429077,
-0.5834560990333557,
-0.10763073712587357,
-0.5279465317726135,
-0.14455735683441162,
0.6837885975837708,
-0.1287570744752884,
0.305022656917572... | |
.ImplementedBy<MailQueueService>()
.LifeStyle.Singleton;
}
internal static IEnumerable<IRegistration> caches()
{
yield return Component.For<IDataCache<ServiceAttributes>>()
.ImplementedBy<NoDataCache<ServiceAttributes>>()
.LifeStyle.Singleton;
// ....
... | [
0.6312440037727356,
0.007719725836068392,
0.2811945974826813,
0.1256076693534851,
0.4557090997695923,
0.2922581136226654,
0.3302496671676636,
-0.6990211606025696,
-0.18808124959468842,
-0.5091536641120911,
0.02403416484594345,
0.7166449427604675,
-0.2720487117767334,
0.07543592900037766,
... | |
typeof(WindsorConfigurationSkeleton));
internal static IWindsorContainer createWith(
IRegistration[] customs, string configFile, params Func<IEnumerable<IRegistration>>[] methods)
{
IWindsorContainer container = new WindsorContainer();
BugFix.Kernel = container.Kernel;
containe... | [
-0.1582159847021103,
-0.28864786028862,
0.6335605978965759,
-0.0005610031657852232,
0.24014276266098022,
0.5358158349990845,
0.2694724202156067,
-0.5207767486572266,
-0.2753506898880005,
-0.5121984481811523,
-0.23280151188373566,
0.6685869693756104,
-0.5311958193778992,
0.3279323875904083,... | |
captureRegistrations(unnamedServices, namedServices);
container.Kernel.ComponentRegistered += registered;
if (customs != null)
{
container.Register(customs);
}
if (configFile != null)
{
tryAddXmlConfig(container, configFile);
}
... | [
0.04297121241688728,
-0.5513118505477905,
0.5296028256416321,
0.13967488706111908,
0.23587168753147125,
0.1519331932067871,
0.04278571903705597,
-0.2199692726135254,
-0.40387779474258423,
-0.04685157537460327,
-0.3039950132369995,
0.5779260396957397,
-0.5965022444725037,
0.1516860276460647... | |
registered;
if (methods != null && methods.Length > 0)
{
container.Register(union(unnamedServices, namedServices, methods));
}
return container;
}
private static ComponentDataDelegate captureRegistrations(
IList<Type> unnamedServices, IDictionary<string, Ty... | [
0.2561686038970947,
-0.5687951445579529,
0.29164978861808777,
0.20535878837108612,
0.19719816744327545,
0.22731003165245056,
0.0851137712597847,
-0.6708210110664368,
-0.22130434215068817,
-0.1618071049451828,
-0.2443348467350006,
0.41858401894569397,
-0.6156788468360901,
0.4309997260570526... | |
{
if (handler.ComponentModel.Name == handler.ComponentModel.Implementation.FullName)
{
var text = unnamedServices.Contains(handler.Service) ? "another" : "default"; | [
0.017985878512263298,
-0.2903168201446533,
0.3851490616798401,
-0.38311296701431274,
0.21688374876976013,
0.22300942242145538,
0.443902850151062,
-0.3428112864494324,
0.14702947437763214,
-0.29648879170417786,
-0.39059266448020935,
0.7774934768676758,
-0.4327874481678009,
0.142051368951797... | |
_log.Info(
m => m(
"Registered {2} service for {0} with {1}.", | [
0.22157199680805206,
-0.1623595505952835,
0.5042988061904907,
0.14082148671150208,
0.5920193195343018,
-0.07804273813962936,
0.3404918909072876,
-0.14533716440200806,
-0.1689237505197525,
-0.48496177792549133,
-0.11362162977457047,
0.38352012634277344,
-0.3419496715068817,
0.42380705475807... | |
handler.Service.GetDisplayName(),
handler.ComponentModel.Implementation.GetDisplayName(),
text | [
0.12125758826732635,
-0.5111498236656189,
0.17487242817878723,
0.023979509249329567,
-0.016005000099539757,
0.20356199145317078,
0.11561466008424759,
-0.161817267537117,
-0.02836877480149269,
-0.6170718669891357,
-0.3571963608264923,
0.643182098865509,
-0.6040768623352051,
-0.2287730425596... | |
));
unnamedServices.Add(handler.Service);
}
else
{ | [
0.27242571115493774,
-0.3171147406101227,
0.19072741270065308,
-0.46732258796691895,
0.06875651329755783,
0.1512243002653122,
0.6509729623794556,
-0.29498517513275146,
-0.10101939737796783,
-0.2804613709449768,
-0.3289049565792084,
0.6666562557220459,
-0.443460077047348,
0.4620217084884643... | |
var text = namedServices.ContainsKey(key) ? "another" : "default";
_log.Info(
m => m( | [
-0.28662577271461487,
-0.13980820775032043,
0.48634591698646545,
-0.3362228572368622,
0.6364279985427856,
0.034067921340465546,
0.5230885148048401,
-0.26953813433647156,
-0.2919611632823944,
-0.4038260877132416,
-0.40411779284477234,
0.8454910516738892,
-0.4649515748023987,
0.2470516115427... | |
"Registered {3} service {0} with name '{1}' and {2}.",
handler.ComponentModel.Service,
handler.ComponentModel.Name, | [
0.4202960729598999,
-0.183991476893425,
0.2599043846130371,
-0.011025490239262581,
-0.18475164473056793,
0.3931249678134918,
0.10330097377300262,
-0.2180909365415573,
-0.05955144017934799,
-0.2917718291282654,
-0.18754234910011292,
0.2001638412475586,
-0.3671722412109375,
0.196281954646110... | |
handler.ComponentModel.Implementation.GetDisplayName(),
text | [
0.07209116965532303,
-0.5704370737075806,
0.11617178469896317,
0.23792041838169098,
0.016923855990171432,
0.15668968856334686,
0.12668448686599731,
-0.15402215719223022,
-0.045421961694955826,
-0.5255283117294312,
-0.39451029896736145,
0.752811074256897,
-0.5377917289733887,
-0.15064983069... | |
));
namedServices.Add(key, handler.Service);
}
};
}
protected static void tryAddXmlConfig(IWindsorContainer container, string filename)
{
var fi = Resources.GetFileFromResourceHierarchy(typeof(ApplicationContext).Namespace, filename); | [
0.15153613686561584,
-0.35943466424942017,
0.7630127668380737,
-0.23212872445583344,
0.6118188500404358,
0.10044883191585541,
0.416018009185791,
-0.36930638551712036,
-0.02299833670258522,
-0.6277193427085876,
-0.5569064617156982,
0.7179705500602722,
-0.4423920810222626,
0.4764616489410400... | |
if ( fi == null ) {
return;
}
var configFile = fi.FullName;
var xd = immitateFluentApiDefaultIdBehaviour(configFile);
container.Install(Configuration.FromXml(new StaticContentResource(xd.OuterXml)));
}
private static XmlDocument immitateFluentApiDefaultIdBehaviour(s... | [
-0.12880316376686096,
-0.5776275992393494,
0.6691767573356628,
-0.3256663680076599,
0.30054399371147156,
-0.05081671103835106,
0.17225800454616547,
-0.3315708637237549,
0.20318874716758728,
-0.6109228730201721,
-0.5489631295204163,
0.7686131596565247,
-0.3785548806190491,
0.126244857907295... | |
foreach (
XmlElement component in
xd.SelectNodes("/configuration/components/component[@type and (not(@id) or @id = '')]"))
{
var type = Type.GetType(component.GetAttribute("type"), true);
component.SetAttribute("id", type.FullName);
}
return x... | [
0.014819123782217503,
-0.22767828404903412,
0.5542579889297485,
-0.1933741718530655,
-0.011805840767920017,
0.2868264615535736,
0.09676532447338104,
-0.45046618580818176,
0.3700563907623291,
-0.5244749188423157,
-0.4669820964336395,
0.4452573359012604,
-0.3096993565559387,
0.08782145380973... | |
private static IRegistration[] union(
IList<Type> unnamed, IDictionary<string, Type> named, params Func<IEnumerable<IRegistration>>[] methods)
{
var all = new List<IRegistration>();
foreach (var method in methods)
{
foreach (var registration in method())
{
... | [
0.06627310812473297,
-0.226048082113266,
0.3900855779647827,
-0.03472839668393135,
-0.2076580822467804,
0.19224539399147034,
0.2060520499944687,
-0.6986751556396484,
-0.11508086323738098,
-0.5432193875312805,
-0.3312598466873169,
0.5783942341804504,
-0.8369153141975403,
0.20371073484420776... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.