text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
In order to help my team write testable code, I came up with this simple list of best practices for making our C# code base more testable. (Some of the points refer to limitations of Rhino Mocks, a mocking framework for C#, but the rules may apply more generally as well.) Does anyone have any best practices that they f... | [
0.7808015942573547,
0.2728821337223053,
-0.40235039591789246,
0.15133251249790192,
-0.1343015730381012,
-0.39299389719963074,
0.46104687452316284,
-0.23024165630340576,
-0.0051346817053854465,
-0.5417490601539612,
0.1534765213727951,
0.8878424763679504,
-0.018682565540075302,
-0.3636802136... | |
You cannot mock or test what cannot be seen.
3. **Separate UI code from its behavior using Model-View-Controller or Model-View-Presenter.** Reason: Allows the business logic to be tested while the parts that can't be tested (the UI) is minimized.
4. **Do not write static methods or classes.** Reason: Static methods are... | [
0.2689070999622345,
0.22348929941654205,
0.2869572937488556,
0.27029499411582947,
-0.36242714524269104,
0.07053675502538681,
0.3612588346004486,
-0.25924423336982727,
-0.19513754546642303,
-0.6775188446044922,
0.1339276134967804,
0.6646111607551575,
-0.4178588390350342,
0.12921349704265594... | |
frameworks.
6. **Isolate external dependencies.** Reason: Unresolved external dependencies cannot be tested.
7. **Mark as virtual the methods you intend to mock.** Reason: Rhino Mocks is unable to mock non-virtual methods.
Definitely a good list. Here are a few thoughts on it:
> **Write the test first, then the code.*... | [
0.2825382649898529,
0.2308424860239029,
0.3006124794483185,
0.15742741525173187,
-0.23297065496444702,
0.10498231649398804,
0.521075427532196,
-0.41052278876304626,
-0.2828967571258545,
-0.8403404355049133,
0.30116531252861023,
0.8916313052177429,
-0.14859557151794434,
-0.29177141189575195... | |
have no control over them. Inversion of Control / Dependency Injection gives you that control, allowing you to isolate the object under test with mocks/stubs/etc. This is how you test objects in isolation.
> **Separate UI code from its behavior using Model-View-Controller or Model-View-Presenter.**
Agreed. Note that ... | [
0.2175699919462204,
-0.025851674377918243,
-0.05949011072516441,
0.12878145277500153,
-0.5360360741615295,
-0.2836569845676422,
0.28515926003456116,
-0.3318442404270172,
-0.2241644710302353,
-0.39538848400115967,
0.1812644749879837,
0.4026508927345276,
-0.3376850485801697,
0.13425660133361... | |
of those Rhino Mock specific rules you mentioned.
> **Program off interfaces, not classes.**
I agree, but for a slightly different reason. Interfaces provide a great deal of flexibility to the software developer - beyond just support for various mock object frameworks. For example, it is not possible to support DI pr... | [
0.46619269251823425,
0.16125524044036865,
0.14633233845233917,
0.33014705777168274,
-0.21767404675483704,
0.0017121325945481658,
0.11434321850538254,
-0.2853975296020508,
-0.29259899258613586,
-0.5447112917900085,
0.4149939715862274,
0.77919602394104,
-0.16273969411849976,
-0.0283367950469... | |
team doesn't control the dependency (a.k.a. external).
> **Mark as virtual the methods you intend to mock.**
That's a limitation of Rhino Mocks. In an environment that prefers hand coded stubs over a mock object framework, that wouldn't be necessary.
And, a couple of new points to consider:
**Use creational design ... | [
0.2580166459083557,
-0.1394685059785843,
-0.19839437305927277,
0.21371552348136902,
-0.27660420536994934,
-0.17059171199798584,
0.31379231810569763,
-0.2926258444786072,
-0.1474170833826065,
-0.5966772437095642,
0.3285605311393738,
0.7777518033981323,
0.10696227103471756,
-0.62935012578964... | |
mocks/stubs.** Often, you'll find that using mock object frameworks makes your tests incredibly hard to read. By rolling your own, you'll have complete control over your mocks/stubs, and you'll be able to keep your tests readable. (Refer back to previous point.)
**Avoid the temptation to refactor duplication out of yo... | [
0.47677120566368103,
0.4294505715370178,
-0.17207349836826324,
0.23879677057266235,
-0.20998916029930115,
0.37735259532928467,
0.5153619050979614,
-0.21038174629211426,
-0.26081088185310364,
-0.7935705780982971,
-0.1279066652059555,
0.5415080189704895,
0.02882254868745804,
-0.0183129422366... | |
and run your full suite of unit tests on every check-in. (Sure, this isn't a coding practice, per se; but it is an incredible tool for keeping your software clean and fully integrated.) | [
0.7219119071960449,
0.2826441526412964,
-0.33187004923820496,
0.2341632843017578,
0.31338995695114136,
-0.2925907373428345,
0.1555764526128769,
0.03315669670701027,
-0.02703051269054413,
-0.404805988073349,
0.06061617657542229,
0.45992541313171387,
0.3071560561656952,
-0.2682275176048279,
... | |
I work on Linux all the time and I'm clueless about Windows, not even having a Windows box. Is Git nowadays working on Windows? Or am I making problems for my Windows pals by using it?
As far as I can tell [msysgit](http://code.google.com/p/msysgit/) works perfectly well under Windows Vista.
This after a whole 2-month... | [
0.21663282811641693,
-0.0667162537574768,
0.36054494976997375,
0.038568031042814255,
-0.31069231033325195,
-0.23709458112716675,
0.2785945236682892,
0.6071172952651978,
-0.03225751221179962,
-0.7698301672935486,
0.10148444771766663,
0.5911436080932617,
-0.09966734051704407,
0.2409022897481... | |
I'm tired of using:
```
tail -f development.log
```
To keep track of my rails logs. Instead I would like something that displays the info in a grid and allows my to sort, filter and look at stack traces per log message.
Does anyone know of a GUI tool for displaying rails logs. Ideally I would like a standalone app... | [
0.5114725232124329,
-0.07109638303518295,
0.03600648418068886,
0.004598148632794619,
-0.046402737498283386,
-0.3615516722202301,
0.1023557260632515,
0.017759814858436584,
-0.49488452076911926,
-0.6606495380401611,
0.10760819911956787,
0.26678285002708435,
-0.25480741262435913,
-0.102189652... | |
Let's say that I have a widget that displays summary information about how many posts or comments that I have on a site.
What's the cleanest way to persist this information across controllers?
Including the instance variables in the application controller seems like a bad idea. Having a before filter that loads the ... | [
0.6709360480308533,
0.0985918864607811,
0.10114447772502899,
0.31916964054107666,
-0.15417587757110596,
-0.14710748195648193,
0.18015027046203613,
-0.08430149406194687,
-0.315180242061615,
-0.7957051396369934,
0.44684141874313354,
0.12830956280231476,
-0.4631178677082062,
0.413309365510940... | |
need in ApplicationHelper or as class methods on whatever model(s) you're getting the data from. Then call that method in the partial when you need to display it. | [
0.00019819260342046618,
0.08001714944839478,
0.22394543886184692,
0.208654522895813,
0.06857088953256607,
-0.014044826850295067,
-0.15458570420742035,
-0.0039026939775794744,
-0.16298982501029968,
-0.7750300168991089,
-0.23863361775875092,
0.5692769885063171,
-0.15198464691638947,
-0.12051... | |
So I'm using hibernate and working with an application that manages time.
What is the best way to deal with times in a 24 hour clock?
I do not need to worry about TimeZone issues at the beginning of this application but it would be best to ensure that this functionality is built in at the beginning.
I'm using hiberna... | [
0.5025704503059387,
-0.13015182316303253,
0.6960029006004333,
0.08846372365951538,
-0.0010291102807968855,
-0.18105313181877136,
0.3680903911590576,
0.012548090890049934,
-0.13517096638679504,
-0.8124932050704956,
0.05594382807612419,
0.409991979598999,
-0.13964973390102386,
0.110273480415... | |
trivial -- just implement either org.hibernate.UserType or org.hibernate.CompositeUserType (load=nullSafeGet and store=nullSafeSet methods in them).
See <http://docs.jboss.org/hibernate/core/3.3/reference/en/html/mapping.html#mapping-types-custom>
But I'd still save absolute time anyway. May help in future.
P.S. Th... | [
0.11457878351211548,
-0.16918201744556427,
0.42850804328918457,
0.0986919105052948,
0.13141725957393646,
-0.11791430413722992,
0.2879171073436737,
-0.09481746703386307,
-0.2155836969614029,
-0.4644799828529358,
-0.020093699917197227,
0.48911887407302856,
-0.37629884481430054,
-0.2296275794... | |
I'm not sure if this is a strange thing to do or not, or if it is some how code smell...but I was wondering if there was a way (some sort of oop pattern would be nice) to "cast" a base type to a form of its derived type. I know this makes little sense as the derived type will have additional functionality that the pare... | [
0.4867028594017029,
0.16830343008041382,
-0.02162659913301468,
0.19000378251075745,
-0.07919048517942429,
-0.3086223006248474,
0.19602054357528687,
0.017191458493471146,
0.11238308995962143,
-0.5544940233230591,
0.16049328446388245,
0.47096681594848633,
-0.3441283702850342,
0.2370540201663... | |
{
public string GetBaseClassName {get;set;}
public bool BooleanEvaluator {get;set;}
}
public class SomeDerivedClass : SomeBaseClass {
public void Insert(SqlConnection connection) {
//...random connection stuff
cmd.Parameters["IsItTrue"].Value = this.BooleanEvalutar;
//...
... | [
0.33113572001457214,
-0.08539839833974838,
0.5664281845092773,
-0.026877835392951965,
0.07814718037843704,
-0.19392535090446472,
0.2281751185655594,
0.19560305774211884,
-0.16324128210544586,
-0.3448789417743683,
-0.26427143812179565,
0.5370244979858398,
-0.28878822922706604,
0.18730352818... | |
way to accomplish something of this sort?
Not soundly, in "managed" languages. This is *downcasting*, and there is no sane down way to handle it, for exactly the reason you described (subclasses provide more than base classes - where does this "more" come from?). If you really want a similar behaviour for a particular ... | [
0.17252928018569946,
-0.3478615880012512,
-0.11688720434904099,
0.3745419979095459,
-0.05603823810815811,
-0.12167775630950928,
0.8061653971672058,
-0.1332852691411972,
-0.50513756275177,
-0.7674078941345215,
-0.2410731166601181,
0.5185233354568481,
-0.1824376881122589,
-0.1004717200994491... | |
operators between base/derived types. An oddity of Microsoft trying to "protect you" against yourself. Ah well, at least they're no where near as bad as Sun. | [
0.39230039715766907,
-0.12913118302822113,
-0.0544949471950531,
0.05471682921051979,
0.08098030090332031,
-0.20787738263607025,
0.16118909418582916,
0.2991562783718109,
0.11178313195705414,
-0.45816585421562195,
-0.14745227992534637,
0.7970079779624939,
-0.11270136386156082,
-0.20860303938... | |
Is it the case that the entire restful verb is under a single all encompassing transaction? That is to say, if I raise a Error in the validation or callbacks at any point in the handling of a UPDATE, DELETE, or CREATE operation, is every database operation that I may have performed in previous callbacks also rolled bac... | [
-0.22860601544380188,
-0.02568729966878891,
0.030123773962259293,
0.007210302632302046,
-0.5947067141532898,
0.057593293488025665,
0.47368311882019043,
0.05120671167969704,
-0.42149752378463745,
-0.10054527223110199,
-0.5226122736930847,
0.4504759609699249,
-0.5906157493591309,
-0.09809792... | |
if I raise a Error in the validation or callbacks at any point in the handling of a UPDATE, DELETE, or CREATE operation, is every database operation that I may have performed in previous callbacks also rolled back?
No.
> does raising a Error on any callback or validation make it such that no change at all occurs in t... | [
0.07285633683204651,
-0.2024887204170227,
0.045796480029821396,
-0.002751729916781187,
-0.2010306864976883,
0.13839955627918243,
0.3846871852874756,
-0.17602409422397614,
-0.3516305088996887,
-0.3351233899593353,
-0.1843126267194748,
0.4843706786632538,
-0.5232839584350586,
-0.037239223718... | |
Is there a way in PHP to make asynchronous HTTP calls? I don't care about the response, I just want to do something like `file_get_contents()`, but not wait for the request to finish before executing the rest of my code. This would be super useful for setting off "events" of a sort in my application, or triggering long... | [
0.2163514792919159,
-0.21410176157951355,
0.5519731640815735,
0.12376494705677032,
-0.2091415524482727,
-0.16863325238227844,
0.26383012533187866,
-0.24762625992298126,
-0.32589948177337646,
-0.3851517140865326,
-0.31081581115722656,
0.44096797704696655,
-0.13745711743831635,
-0.0225968435... | |
if (is_array($val)) $val = implode(',', $val);
$post_params[] = $key.'='.urlencode($val);
}
$post_string = implode('&', $post_params);
$parts=parse_url($url);
$fp = fsockopen($parts['host'],
isset($parts['port'])?$parts['port']:80,
$errno, $errstr, 30);
$out = "POST ".$par... | [
-0.4584856331348419,
-0.13565687835216522,
0.8552008867263794,
-0.19393755495548248,
0.18649107217788696,
0.38679713010787964,
0.13784758746623993,
-0.26696541905403137,
-0.33464330434799194,
-0.481538861989975,
-0.8573943376541138,
0.41208869218826294,
-0.43346530199050903,
0.188325017690... | |
fwrite($fp, $out);
fclose($fp);
}
``` | [
0.10089710354804993,
0.18174099922180176,
0.3693006932735443,
-0.4615471363067627,
0.4240322709083557,
-0.12336506694555283,
0.30157706141471863,
-0.14969676733016968,
0.12262602150440216,
-0.33174920082092285,
-0.2860631048679352,
0.7034575343132019,
-0.5685111284255981,
-0.02195957489311... | |
I have a function that I use called sqlf(), it emulates prepared statements. For instance I can do things like:
```
$sql = sqlf("SELECT * FROM Users WHERE name= :1 AND email= :2",'Big "John"','bj@example.com') ;
```
For various reasons, I cannot use prepared statements, but I would like to emulate them. The problem... | [
0.23872774839401245,
0.40172383189201355,
0.051268309354782104,
-0.05048057436943054,
-0.2278122752904892,
-0.02018316090106964,
0.5044758319854736,
-0.15073713660240173,
0.1718016266822815,
-0.5975513458251953,
0.11476923525333405,
0.4019315838813782,
-0.3082062900066376,
0.10597928613424... | |
into sql that can be injected into an IN clause? Substituting NULL will not work.
Null is the only value that you can guarantee is not in the set. How come it is not an option? Anything else can be seen as part of the potential set, they are all values. | [
0.34099897742271423,
-0.1521458625793457,
-0.22646388411521912,
0.1134972870349884,
0.08363930881023407,
-0.17235122621059418,
0.3948064148426056,
0.14896267652511597,
-0.017779996618628502,
-0.18837274610996246,
0.06511211395263672,
0.5450939536094666,
-0.5223118662834167,
-0.056727964431... | |
This is probably a really stupid newbie-sounding question to you developer type people, but I'm at a loss :( I've been trying to learn how to use Subversion for keeping the history of my code, but I'm finding it pretty confusing. I read the 'book' that comes with Subversion, but I didn't find it all that helpful. I'm u... | [
0.6767013669013977,
-0.002809129888191819,
0.06036389246582985,
0.19085337221622467,
0.05919620022177696,
-0.33439603447914124,
0.2969920337200165,
0.2912587821483612,
-0.4101216197013855,
-0.33092832565307617,
-0.02060982957482338,
0.6628366708755493,
-0.09836113452911377,
0.2070749402046... | |
see how it works. I created a 'repository' (in svn\_repository/test), and if anyone could tell me how I'm supposed to go about creating a new file/putting a file in it, and then updating that file I'd be really happy :) Knowing my luck it'll be something as simple as "drag and drop the file into the directory". Apologi... | [
0.5442663431167603,
-0.4295348823070526,
0.23918993771076202,
0.3147644102573395,
-0.029529044404625893,
-0.021472515538334846,
-0.11653854697942734,
-0.023028455674648285,
-0.17585445940494537,
-0.24433231353759766,
-0.020140118896961212,
0.4279929995536804,
0.13663196563720703,
-0.195882... | |
So, create these folders somewhere convenient, in a new folder.
Right click in the parent folder of these folders, go to TortoiseSVN and select Import. Enter the url to the repository you created here (ie\_ <https://JUNK:8443/svn/Test/> is one I just made, on my local machine). Hit the ok button and the folders will b... | [
-0.01392341312021017,
-0.05664094164967537,
0.5428920388221741,
0.01029360480606556,
0.1859063357114792,
0.3392375707626343,
0.26431527733802795,
0.215762197971344,
-0.8725028038024902,
-0.3753572404384613,
-0.38149264454841614,
0.8362672328948975,
-0.16181538999080658,
0.23205482959747314... | |
button.
Create a new file in this directory. Right click on it and go to TortoiseSVN, then Add. Hit ok, and the file is now marked as a new file for the repo. Right click in the parent folder of the file and you should see SVN Update and SVN Commit. SVN Update will refresh the local files with files from the repositor... | [
0.07637792080640793,
-0.30431294441223145,
0.906976044178009,
-0.04272031784057617,
-0.02930152229964733,
0.25047212839126587,
0.42146798968315125,
-0.010226111859083176,
-0.938182532787323,
-0.33502131700515747,
-0.23633280396461487,
1.2443865537643433,
-0.07284989953041077,
0.21283911168... | |
How do I pick a random element from a set?
I'm particularly interested in picking a random element from a
HashSet or a LinkedHashSet, in Java.
Solutions for other languages are also welcome.
```
int size = myHashSet.size();
int item = new Random().nextInt(size); // In real life, the Random object should be rather more ... | [
-0.11002493649721146,
-0.19516070187091827,
0.03263280913233757,
-0.0364186130464077,
-0.021779952570796013,
-0.043412622064352036,
0.06263422220945358,
-0.20261907577514648,
-0.30101069808006287,
-0.8823011517524719,
-0.02390996739268303,
0.20577801764011383,
-0.27343350648880005,
0.18881... | |
I have no experience with web services. Historically I've built client-server systems using proprietary communication protocols (even they happen to be XML). I just spent a few hours looking over Axis2 and it sent a shudder down my spine. The learning curve of WS scares me, and seeing all that XML surround so little fu... | [
0.8043122291564941,
0.14835701882839203,
0.126920685172081,
0.09524840116500854,
-0.038088396191596985,
-0.010415097698569298,
0.21113038063049316,
0.040062036365270615,
-0.1261216551065445,
-0.48545554280281067,
0.1561088263988495,
0.3231218457221985,
0.1906186193227768,
0.249592825770378... | |
piece :)**
Build RESTful web APIs; then you get a lot of automatic caching and etc benefits that you don't get if you use other methods (SOAP, XML-RPC, etc)
See [this post](https://stackoverflow.com/questions/106546/performance-of-soap-vs-xml-rpc-or-rest#106701) for more details
Another benefit is that if you build a... | [
0.5398765206336975,
0.0033409513998776674,
0.11725755780935287,
0.10477500408887863,
-0.27791473269462585,
-0.13994210958480835,
0.19944316148757935,
-0.3709021508693695,
-0.2425285279750824,
-0.5221388339996338,
-0.21344061195850372,
0.5194653272628784,
0.11321118474006653,
-0.05098032951... | |
When writing GUIs, I've frequently come over the following problem: Assume you have a model and a controller. The controller has a widget `W` that is used to show a property `X` of the model.
Because the model might be changed from outside the controller (there might be other controllers using the same model, undo ope... | [
0.04809313267469406,
-0.35576197504997253,
0.2905173599720001,
0.22349900007247925,
-0.042594462633132935,
-0.29280462861061096,
-0.020192358642816544,
-0.1955767571926117,
-0.03364214301109314,
-0.9679199457168579,
-0.0056282454170286655,
0.9071859121322632,
-0.4585975110530853,
-0.033451... | |
the **controller** sets the new value for `X` in the **model**
4. the **model** emits events because it has been changed
5. the **controller** receives a change event from the **model**
6. the **controller** gets the value of `X` and sets it in the widget
7. goto 1.
There are several possible solutions for that:
1. M... | [
0.1718442291021347,
-0.4824214577674866,
0.7095275521278381,
0.0917489230632782,
0.09518835693597794,
-0.24960725009441376,
0.3174457252025604,
-0.1942037045955658,
-0.32075393199920654,
-0.38940680027008057,
-0.5075307488441467,
0.43626368045806885,
-0.509821891784668,
0.25243523716926575... | |
I usually went for option 1., because it's the simplest thing. It has the drawback of cluttering your classes with flags, but the other methods have their drawbacks, too.
Just for the record, I've had this problem with several GUI toolkits, including GTK+, Qt and SWT, so I think it's pretty toolkit-agnostic.
Any best... | [
0.1092502772808075,
-0.2201310098171234,
-0.04471129924058914,
0.1795928180217743,
-0.22566835582256317,
-0.07001796364784241,
0.2549884021282196,
0.1328016221523285,
-0.17602820694446564,
-0.41550326347351074,
-0.15462470054626465,
0.6149739623069763,
-0.19758029282093048,
-0.041479866951... | |
is updated and fires an event. In order to prevent another (useless) update to the model, the event generated by the widget has to be swallowed.
In other cases, the model might be more complex and a simple check on what exactly has changed might not be feasible, e.g. a complex tree view.
Usually you should respond t... | [
-0.011744587682187557,
-0.4172777831554413,
0.7437955737113953,
0.14195585250854492,
-0.10947787016630173,
-0.37636199593544006,
0.26638156175613403,
-0.384586900472641,
-0.22021476924419403,
-0.6094881892204285,
-0.1444651335477829,
0.5719295144081116,
-0.43159011006355286,
-0.05330355092... | |
in the model
4. Model emits event
5. Controller responds, changes value in widget
6. Value change event emitted, but not listened to by controller | [
-0.03781622648239136,
-0.23991140723228455,
0.8189414143562317,
0.1689881980419159,
0.041915491223335266,
-0.12104148417711258,
0.41410237550735474,
-0.5943225026130676,
-0.2030918151140213,
-0.28451815247535706,
-0.2646532654762268,
0.27871549129486084,
-0.2529085576534271,
0.081371031701... | |
I was just tinkering around with calling GetPrivateProfileString and GetPrivateProfileSection in kernel32 from .NET and came across something odd I don't understand.
Let's start with this encantation:
```
Private Declare Unicode Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringW" ( _
... | [
-0.08214480429887772,
0.041397131979465485,
0.40884244441986084,
-0.26958486437797546,
0.0992112010717392,
-0.05359969660639763,
0.1301308423280716,
-0.0505017451941967,
-0.00783432275056839,
-0.6282649040222168,
-0.2676607370376587,
0.9899204969406128,
-0.28437140583992004,
-0.00884506478... | |
should get all of the keys for that section, and indeed I do: 50% of the time.
If the ini file has the lpApplicationName starting on the first line, the buffer returns nothing. If lpApplicationName stats on the second line in the file, it returns the expected values.
At first I though it was a matter of using the W v... | [
0.21781986951828003,
0.16871994733810425,
0.45842456817626953,
-0.21567292511463165,
0.08283675462007523,
-0.14074337482452393,
-0.09981030225753784,
-0.01705409400165081,
-0.2390243113040924,
-0.6705196499824524,
-0.22238877415657043,
0.5992572903633118,
-0.24664463102817535,
-0.130112558... | |
don't seem to grok byte order marks and is causes them to miss the first section (hence everything works fine if there is a blank line). | [
0.021806595847010612,
0.17181716859340668,
0.20580309629440308,
0.06699060648679733,
0.052686676383018494,
0.004879937972873449,
0.7078549861907959,
0.2818986773490906,
-0.27295196056365967,
-0.42447295784950256,
-0.42436447739601135,
0.16894090175628662,
-0.03667982667684555,
-0.268586903... | |
I have written the following simple test in trying to learn Castle Windsor's Fluent Interface:
```
using NUnit.Framework;
using Castle.Windsor;
using System.Collections;
using Castle.MicroKernel.Registration;
namespace WindsorSample {
public class MyComponent : IMyComponent {
public MyComponent(int start_... | [
-0.1296626329421997,
-0.11332187056541443,
0.7363071441650391,
-0.20449426770210266,
0.2225535660982132,
0.20672279596328735,
0.5228186845779419,
-0.06477377563714981,
-0.012296121567487717,
-0.5867318511009216,
-0.4247713088989258,
0.5641753673553467,
-0.22932174801826477,
0.0727970972657... | |
get; }
}
[TestFixture]
public class ConcreteImplFixture {
[Test]
public void ResolvingConcreteImplShouldInitialiseValue() {
IWindsorContainer container = new WindsorContainer();
container.Register(Component.For<IMyComponent>().ImplementedBy<MyComponent>().Parameters(... | [
-0.0824371948838234,
-0.31845858693122864,
0.6207748651504517,
-0.03989824652671814,
0.17816229164600372,
0.31812188029289246,
0.5192044973373413,
-0.6488388180732727,
-0.039097193628549576,
-0.4583098888397217,
-0.15480095148086548,
0.64091956615448,
-0.16492997109889984,
0.36384716629981... | |
}
}
}
```
When I execute the test through TestDriven.NET I get the following error:
```
System.TypeLoadException : Could not load type 'Castle.MicroKernel.Registration.IRegistration' from assembly 'Castle.MicroKernel, Version=1.0.3.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc'.
at WindsorSample.ConcreteIm... | [
0.34992143511772156,
0.1340900957584381,
0.22657084465026855,
-0.07354823499917984,
-0.09150926023721695,
0.11623300611972809,
0.7820743918418884,
-0.2533606290817261,
0.10537771135568619,
-0.6144989728927612,
0.050244662910699844,
0.5449720025062561,
-0.1174306645989418,
0.283122211694717... | |
[latest build of Castle](http://builds.castleproject.org/cruise/DownloadBuild.castle?number=956) though I have never worked with nant so I didn't bother re-compiling from source and just took the files in the bin directory. I should also point out that my project compiles with no problem.
Is the assembly in the Global ... | [
-0.05119144544005394,
0.05578507110476494,
0.536994457244873,
-0.11075036227703094,
0.10374660789966583,
0.0368461087346077,
0.32336071133613586,
-0.0897013247013092,
-0.5318470597267151,
-0.46961817145347595,
-0.0399683378636837,
0.33456650376319885,
0.24590881168842316,
0.318506240844726... | |
I am asking this out of a curiosity. Basically my question is when you have a database which needs a row entry to have things which act like flags, what is the best practice? A good example of this would be the badges on stack overflow, or the operating system field in bugzilla. Any subset of the flags may be set for a... | [
0.6172121167182922,
0.2501329183578491,
-0.17010854184627533,
0.2160433530807495,
-0.047752924263477325,
-0.3031816780567169,
0.024349858984351158,
-0.09354890882968903,
-0.5264869928359985,
-0.3587365746498108,
0.10362324863672256,
0.21844317018985748,
-0.5238537192344666,
0.2339358478784... | |
several reasons. The most obvious of which is scale-ability, there will be a hard upper limit on how many flags I can have.
I can also think of a couple of other solutions which scale better but would have performance issues because they would require multiple selects to get all the information.
So, what is the "righ... | [
0.34372931718826294,
0.07398468255996704,
0.06481321156024933,
0.4367830753326416,
0.07916171848773956,
-0.25422894954681396,
0.04570550471544266,
-0.2535001039505005,
-0.4341198801994324,
-0.5902730226516724,
0.2486874908208847,
0.4774578809738159,
-0.16484054923057556,
0.0398142263293266... | |
flags and usersToFlags.
However, if space efficiency is a serious concern and query-ability is not, an unsigned mask would work almost as well. | [
0.102945975959301,
-0.2646123766899109,
-0.009700528346002102,
0.38990283012390137,
0.05674419552087784,
-0.1675807684659958,
0.14111444354057312,
-0.20088060200214386,
-0.3483976721763611,
-0.7001602649688721,
-0.33170101046562195,
0.3687525689601898,
-0.31871646642684937,
-0.295691072940... | |
I have an `<img>` in an HTML document that I would like to highlight as though the user had highlighted it using the mouse. Is there a way to do that using JavaScript?
I only need it to work in Mozilla, but any and all information is welcome.
*EDIT: The reason I want to select the image is actually not so that it app... | [
0.41365912556648254,
0.27831822633743286,
0.4815884232521057,
-0.05194184184074402,
-0.20549938082695007,
-0.18022753298282623,
0.08110541850328445,
0.2341052144765854,
-0.31305521726608276,
-0.8819307684898376,
0.029932189732789993,
0.5310491323471069,
-0.1949995905160904,
-0.180688947439... | |
(which will be the Stack Overflow logo if you test it out on this page in Firebug):
```
var s = window.getSelection()
var r = document.createRange();
r.selectNode(document.images[0]);
s.addRange(r)
```
Relevant documentation:
* <http://developer.mozilla.org/en/DOM/window.getSelection>
* <http://developer.mozilla.or... | [
0.2566520869731903,
0.095401331782341,
0.6355947852134705,
-0.44257545471191406,
0.09846105426549911,
0.08914994448423386,
0.29413142800331116,
-0.5298546552658081,
-0.4477873742580414,
-0.6646270155906677,
-0.40582895278930664,
0.6071750521659851,
-0.5161705017089844,
0.11425559967756271,... | |
What choices do I have for creating stateful dynamic content in an ASP.Net web site?
Here's my scenario. I have a site that has multiple, nested content regions. The top level are actions tied to a functional area `Catalog`, `Subscriptions`, `Settings`.
When you click on the functional action, I want to dynamically a... | [
0.0413302481174469,
-0.26408329606056213,
0.2349858433008194,
0.3711073696613312,
-0.041196007281541824,
0.2828238606452942,
-0.05864681676030159,
0.07116507738828659,
-0.512571394443512,
-0.8496863842010498,
-0.01357723493129015,
0.2937001585960388,
-0.07872322201728821,
0.178267121315002... | |
(like properties or options to manage the files).
---
I started with `UserControls`. They worked fine as long as I kept loading everything into the page, and never let one disappear. As soon as one disappeared, `ViewState` for the page blew up because the view state tree was invalid.
(I didn't want to keep loading s... | [
-0.25396180152893066,
-0.08330038189888,
0.33902594447135925,
0.23738108575344086,
-0.33163321018218994,
0.09529959410429001,
0.2683814764022827,
0.2589167356491089,
-0.20877763628959656,
-0.7027973532676697,
-0.07412607222795486,
0.08524946868419647,
-0.35899055004119873,
0.26956826448440... | |
pages I didn't run into any `ViewState` problems.
But, I'm concerned that `IFrames` might be a bad design choice, but don't fully understand why. The site is not public, so search engines aren't a concern.
---
So, finally to my question.
What are my options for this scenario? If I choose an Ajax Solution (jQuery), ... | [
0.23491188883781433,
-0.17070099711418152,
0.5357472896575928,
0.30962321162223816,
-0.41416341066360474,
-0.2738088369369507,
0.04421910271048546,
0.2951961159706116,
-0.484576553106308,
-0.7008909583091736,
-0.02697092667222023,
0.4349679946899414,
-0.1723780333995819,
0.0687613561749458... | |
messing with view state and such, but means your page has a bigger footprint.
2. Add controls to the page dynamically. You've already been playing with this, so you've seen some of the issues here. Just remember that the place to create your dynamic controls for postbacks is in the Page\_Init() event, and that if you w... | [
0.21227797865867615,
-0.34648218750953674,
0.3452158570289612,
0.1677817553281784,
0.09741447120904922,
-0.24617956578731537,
0.1975030153989792,
0.17457252740859985,
-0.3148267865180969,
-0.6428589224815369,
0.061157070100307465,
0.5852027535438538,
-0.3567628264427185,
0.1247166469693183... | |
I'm a long-time Windows developer, having cut my teeth on win32 and early COM. I've been working with .NET since 2001, so I'm pretty fluent in C# and the CLR. I'd never heard of Castle Windsor until I started participating in Stack Overflow. I've read the Castle Windsor "Getting Started" guide, but it's not clicking.
... | [
0.22513560950756073,
0.377121239900589,
0.09201852977275848,
0.033782802522182465,
0.3469547629356384,
-0.03109331987798214,
0.251906156539917,
0.042539652436971664,
-0.2775191366672516,
-0.3080448508262634,
0.0005666091456077993,
0.5837451219558716,
0.13162526488304138,
0.1943922638893127... | |
object graph created via reflection and configuration rather than the "new" operator.**
Start here: <http://tech.groups.yahoo.com/group/altdotnet/message/10434>
---
Imagine you have an email sending class. EmailSender. Imagine you have another class WorkflowStepper. Inside WorkflowStepper you need to use EmailSender... | [
0.22028730809688568,
-0.034338708966970444,
0.24570108950138092,
0.0763402059674263,
-0.35105276107788086,
-0.016383396461606026,
0.3944590091705322,
-0.04736042395234108,
-0.4919686019420624,
-0.8649652004241943,
0.1626863330602646,
0.33564552664756775,
-0.47186142206192017,
0.24459558725... | |
only have one responsibility (google SRP).. and you use a few of them in WorkflowStepper:
`new WorkflowStepper(emailSender, alertRegistry, databaseConnection).Step()`
Imagine not worrying about the details of `EmailSender` when you are writing `WorkflowStepper` or `AlertRegistry`
You just worry about the concern you... | [
0.23613965511322021,
-0.0413668192923069,
0.5881819725036621,
0.20689156651496887,
-0.035365164279937744,
-0.35244128108024597,
-0.031200353056192398,
-0.1893845647573471,
-0.41108182072639465,
-0.714302122592926,
-0.3426654636859894,
0.6708098649978638,
-0.5308241844177246,
-0.10812573134... | |
DRY code in a testable and repeatable way. | [
0.25609463453292847,
0.2062208354473114,
-0.2653328776359558,
0.1705961674451828,
-0.05590318888425827,
0.14699992537498474,
0.23031757771968842,
-0.04214799031615257,
0.003664557356387377,
-0.5839060544967651,
0.04408686235547066,
0.3397260904312134,
-0.07116156816482544,
0.12244124710559... | |
I'm trying to display an array of files in order of date (last modified).
I have done this buy looping through the array and sorting it into another array, but is there an easier (more efficient) way to do this?
> **Warning** `create_function()` has been DEPRECATED as of PHP 7.2.0. Relying on this function is highly d... | [
0.44650325179100037,
0.2544938325881958,
0.6339792609214783,
-0.36861252784729004,
-0.030681023374199867,
-0.041775304824113846,
0.531341552734375,
0.09329719096422195,
-0.28416764736175537,
-0.5727274417877197,
-0.06888987123966217,
0.2962242066860199,
-0.4664730429649353,
0.3833202421665... | |
as desired. I used a similar approach (written in Python) for determining the last updated files on my website as well. | [
0.3068675696849823,
0.027429496869444847,
0.4124968647956848,
0.01783190481364727,
0.2340174913406372,
-0.2225004881620407,
0.1684243381023407,
0.15896081924438477,
-0.16083425283432007,
-0.3157569169998169,
-0.10681115835905075,
0.342366486787796,
0.10951648652553558,
-0.04899832606315613... | |
At work I have a standard desk (4 legs, flat surface, you get the picture). For a while now I've been thinking about converting to a standing desk. What would be the best way to go about this on a limited budget? Are there some good laptop/keyboard stands I could place on my existing desk? Which ones are the best?
I'm... | [
0.5765607357025146,
0.16705253720283508,
0.16883093118667603,
-0.03690509498119354,
0.10436785221099854,
0.21658068895339966,
0.07381859421730042,
0.003433004952967167,
-0.5248301029205322,
-0.9301083087921143,
0.34501367807388306,
0.6275901198387146,
0.14957457780838013,
-0.04042588546872... | |
people with disabilities and their carers (if you're in Australia, look up the Independent Living Centre in your capital city) would be a good start. You'll be able to test out a variety of models if they have a showroom and get advice from a medical professional not a furniture salesman. | [
0.7563127875328064,
0.1572755128145218,
0.056258995085954666,
0.2153148502111435,
0.3921741545200348,
0.6336011290550232,
0.3967434763908386,
-0.049961335957050323,
-0.7244626879692078,
-0.5692448616027832,
-0.12465330958366394,
-0.06450676918029785,
0.44544291496276855,
-0.000830897537525... | |
As a complete beginner with no programming experience, I am trying to find beautiful Python code to study and play with. Please answer by pointing to a website, a book or some software project.
I have the following criterias:
* complete code listings (working, hackable code)
* beautiful code (highly readable, simple ... | [
0.7134994268417358,
0.18128667771816254,
-0.24082985520362854,
0.08437974750995636,
0.11969903111457825,
-0.12402218580245972,
0.3516279458999634,
0.15871401131153107,
-0.042339153587818146,
-0.5327637195587158,
-0.37696439027786255,
0.5885429978370667,
0.09894346445798874,
0.0241248328238... | |
but think of it as too advanced and confusing for a beginner.
Buy [Programming Collective Intelligence](https://rads.stackoverflow.com/amzn/click/com/0596529325). Great book of interesting AI algorithms based on mining data and all of the examples are in very easy to read Python.
The other great book is [Text Processi... | [
-0.11949092894792557,
0.09272567927837372,
-0.19276690483093262,
0.3284665644168854,
0.170665442943573,
-0.10642310976982117,
0.2748427987098694,
-0.17038454115390778,
0.13784246146678925,
-0.4639759063720703,
0.008574236184358597,
0.5428096055984497,
-0.2131369262933731,
-0.31287458539009... | |
So my favourite web tool, [Subtlety](http://subtlety.errtheblog.com), was recently discontinued, which means that I no longer have easy access to the commit logs of various SVN projects that I follow. Are there any other tools that easily pump out an RSS feed of commits for a public SVN repo?
I was going to suggest Tra... | [
0.42769286036491394,
-0.10916890949010849,
0.385673463344574,
-0.07216901332139969,
0.011570379137992859,
-0.03233809396624565,
0.23147614300251007,
0.23404285311698914,
-0.38629254698753357,
-0.4273412823677063,
0.3353079557418823,
0.4037823975086212,
0.18976598978042603,
0.19631050527095... | |
Say I have the following string:
```
"I am the most foo h4ck3r ever!!"
```
I'm trying to write a makeSpecial(foo) function where the foo substring would be wrapped in a new span element, resulting in:
```
"I am the most <span class="special">foo></span> h4ck3r ever!!"
```
BeautifulSoup seemed like the way to go, ... | [
0.13120679557323456,
0.31679993867874146,
0.6732499003410339,
-0.14806140959262848,
-0.12361147999763489,
-0.12838004529476166,
0.32351264357566833,
-0.15048979222774506,
-0.30268511176109314,
-0.18262122571468353,
-0.02515852451324463,
0.3920586407184601,
-0.34105533361434937,
0.292214363... | |
"credits" or "license" for more information.
>>> def makeSpecial(mystring, special_substr):
... return mystring.replace(special_substr, '<span class="special">%s</span>
' % special_substr)
...
>>> makeSpecial("I am the most foo h4ck3r ever!!", "foo")
'I am the most <span class="special">foo</span> h4ck3r ever!!'
>>... | [
0.20804305374622345,
0.21119318902492523,
0.6558782458305359,
0.08763852715492249,
0.12014041095972061,
-0.11597884446382523,
-0.05813867226243019,
-0.2893901467323303,
-0.3777291178703308,
-0.2496398687362671,
-0.4156762957572937,
0.5754409432411194,
0.21836210787296295,
0.298822939395904... | |
I'm looking for a good template on server-side installation of software for a project I'm working on.
The client-side is pretty straight-forward. The server-side installation is a little trickier. It is made up of several pieces (services, database connections, dependencies, ports that need to be unblocked, etc.). Dur... | [
0.7111501097679138,
0.19398891925811768,
-0.2904195189476013,
0.4561341106891632,
0.14611175656318665,
-0.12300968170166016,
-0.023217741400003433,
0.11509671062231064,
-0.210943341255188,
-0.6300802230834961,
0.250133752822876,
0.3158656358718872,
-0.04892527312040329,
0.11199568957090378... | |
document. I'd like it to be something that an operator could read and comprehend in the heat of a recovery.
---
[EDIT]
Our current documentation comes mainly from the questions our administrators have had during off-site tests. As new code is written, I'd like to make sure the documentation is written ahead of time. ... | [
0.704456627368927,
0.3237636387348175,
0.25198379158973694,
0.15185034275054932,
0.21730871498584747,
-0.37200844287872314,
0.18032345175743103,
-0.1437489241361618,
-0.23283186554908752,
-0.5771859884262085,
0.27055901288986206,
0.7066976428031921,
0.10609132796525955,
0.07174746692180634... | |
great as well.
---
[2nd EDIT]
I've gotten several good ideas from the answers posted. After changing my Google search, I came up with some good starting points. They're not perfect, but they are a good start.
Microsoft Exchange - <http://technet.microsoft.com/en-us/library/bb125074(EXCHG.65).aspx>
iPhone - <http://m... | [
0.21515154838562012,
0.16672512888908386,
0.025895411148667336,
0.26181578636169434,
0.27146556973457336,
-0.11153591424226761,
0.16436229646205902,
-0.14200806617736816,
-0.3082575798034668,
-0.3646990954875946,
-0.06675664335489273,
0.22775329649448395,
0.15885329246520996,
0.03949857503... | |
starting point and let the admin click through to a certain point. It is not necessary for the admin to go through the whole QA cycle, just a confirmation that what you meant to be deployed is really what got deployed.
---
**Other ideas**
Also, we (my team at my last job) had QA test the deployment. As a QA person sh... | [
0.5871073007583618,
0.04705358296632767,
0.031720321625471115,
-0.19547413289546967,
-0.11290132254362106,
-0.04252180829644203,
0.26216161251068115,
-0.01784382574260235,
-0.040428534150123596,
-0.5117595195770264,
-0.03828169405460358,
0.5331737399101257,
0.2979544401168823,
-0.273536950... | |
and make sure they understand them the same way you do.
---
**Template?** Just make sections that have fields for data such as URL to DEV, QA, and PROD. When you write out the instruction you can refer to those. Just make it clear what is being deployed. | [
0.9229273796081543,
0.058704350143671036,
-0.18781132996082306,
0.15361623466014862,
-0.012241526506841183,
-0.3479017913341522,
0.3169533312320709,
0.1016862615942955,
-0.0027032906655222178,
-0.5703704357147217,
-0.40474626421928406,
0.6252738833427429,
-0.006840705871582031,
-0.45875933... | |
What is the most efficient way to convert a MySQL query to CSV in PHP please?
It would be best to avoid temp files as this reduces portability (dir paths and setting file-system permissions required).
The CSV should also include one top line of field names.
```
SELECT * INTO OUTFILE "c:/mydata.csv"
FIELDS TERMINATED ... | [
-0.13118809461593628,
0.07429998368024826,
0.6727997064590454,
-0.057406019419431686,
-0.28912585973739624,
0.010431334376335144,
-0.08018834888935089,
-0.3801182210445404,
-0.28308624029159546,
-0.5236534476280212,
-0.2568930983543396,
0.2524096667766571,
-0.3330222964286804,
-0.073246210... | |
$header .= mysql_field_name( $export , $i ) . "\t";
}
while( $row = mysql_fetch_row( $export ) )
{
$line = '';
foreach( $row as $value )
{
if ( ( !isset( $value ) ) || ( $value == "" ) | [
-0.37758538126945496,
-0.14714407920837402,
0.41372042894363403,
-0.31224143505096436,
0.1111711785197258,
0.19431710243225098,
0.29021507501602173,
-0.1858791708946228,
-0.09000144153833389,
-0.1442898064851761,
-0.29477885365486145,
0.33365771174430847,
-0.4802629351615906,
0.24305619299... | |
)
{
$value = "\t";
}
else
{
$value = str_replace( '"' , '""' , $value );
$value = '"' . $value . '"' . "\t";
} | [
-0.10488609969615936,
0.11590813100337982,
0.5456612706184387,
-0.4858071208000183,
0.4534526467323303,
0.2467547506093979,
0.31281381845474243,
-0.4247700273990631,
-0.04761097952723503,
-0.1961483508348465,
-0.7264618277549744,
0.8310559988021851,
-0.4779886305332184,
0.05266409739851951... | |
$line .= $value;
}
$data .= trim( $line ) . "\n";
}
$data = str_replace( "\r" , "" , $data );
if ( $data == "" )
{
$data = "\n(0) Records Found!\n";
}
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=your_desired_name.xls");
header... | [
-0.09302573651075363,
-0.07706999033689499,
0.756314218044281,
-0.06295745074748993,
0.3592652380466461,
0.06573335081338882,
0.17735889554023743,
-0.3048584759235382,
-0.018125444650650024,
-0.3753662109375,
-0.7200040817260742,
0.34438931941986084,
-0.43909749388694763,
0.339916616678237... | |
I am developing a forms app (not web) for Windows Mobile, using .NET CF 3.5. I need an HTML editor control. I'm looking for something along the lines of a simple FCKEditor, but for using in a forms app (EXE).
Any suggestions?
Pocket IE (the web browser included with Windows Mobile) is about as powerful as Netscape 2..... | [
0.3720836639404297,
-0.14881451427936554,
0.5427376627922058,
-0.08645106106996536,
-0.17923356592655182,
-0.14593230187892914,
0.0451999306678772,
-0.22075167298316956,
-0.05120021477341652,
-0.9370490312576294,
0.08207996189594269,
0.47744593024253845,
-0.4583004415035248,
-0.28056019544... | |
it would mean your app would need a copy of Opera to work and it is commercial software.
I'd suggest you either: Scale back your plans somewhat and forget about WYSIWYG HTML editing. It's a small device with a small screen - is it really necessary for people to edit web content on it?
Or: You write your own small edi... | [
0.31589722633361816,
-0.04212569445371628,
0.32000067830085754,
0.29447734355926514,
0.11844373494386673,
-0.041310686618089676,
0.0028203779365867376,
-0.28182920813560486,
-0.1478394865989685,
-0.5600432753562927,
0.07501114904880524,
0.565317690372467,
-0.0057050324976444244,
-0.1534346... | |
for an experienced .NET forms developer. | [
0.1863708347082138,
-0.25469261407852173,
0.21149414777755737,
0.2289482206106186,
0.026555825024843216,
-0.4417799115180969,
0.04186469689011574,
-0.12444474548101425,
0.0061755795031785965,
-0.6882166862487793,
-0.17784295976161957,
0.3950790464878082,
0.16209599375724792,
-0.47759020328... | |
I need to pass a regex substitution as a variable:
```
sub proc {
my $pattern = shift;
my $txt = "foo baz";
$txt =~ $pattern;
}
my $pattern = 's/foo/bar/';
proc($pattern);
```
This, of course, doesn't work. I tried eval'ing the substitution:
```
eval("$txt =~ $pattern;");
```
but that didn't work ei... | [
0.09460828453302383,
0.08242825418710709,
0.5455617904663086,
-0.39507824182510376,
-0.029113171622157097,
0.07430368661880493,
0.5761483311653137,
-0.14790204167366028,
0.037315864115953445,
-0.4327453076839447,
-0.37189680337905884,
0.5543677806854248,
-0.5465421676635742,
0.232151344418... | |
you want to pass "something that does something" to a subroutine ("a regex substitution" in the case of your question) the answer is to pass a reference to a piece of code. [Higher Order Perl](http://hop.perl.plover.com/) is a good book on the topic. | [
0.6485940217971802,
-0.31815847754478455,
0.22152037918567657,
0.15620701014995575,
-0.20534610748291016,
-0.20325516164302826,
0.13500988483428955,
0.29973214864730835,
-0.5701480507850647,
-0.21667172014713287,
-0.18677100539207458,
-0.1088871881365776,
-0.19745522737503052,
-0.120282933... | |
Is there a good test suite or tool set that can automate website navigation -- with Javascript support -- and collect the HTML from the pages?
Of course I can scrape straight HTML with BeautifulSoup. But this does me no good for sites that require Javascript. :)
You could use [Selenium](http://selenium.dev/) or [Watir... | [
0.11204719543457031,
-0.1315009593963623,
0.14760546386241913,
0.17563796043395996,
-0.3837568759918213,
-0.03498365730047226,
0.1847568303346634,
-0.04065621271729469,
0.04232728108763695,
-0.6210305690765381,
0.15461358428001404,
0.2734701931476593,
0.02038334123790264,
-0.10481642186641... | |
URLs to be scraped.
* [Zombie](http://zombie.labnotes.org/) for [Node.js](http://nodejs.org)
Personally, I'm most familiar with Selenium, which has support for writing automation scripts in a good number of languagues and has more mature tooling, such as the excellent [Selenium IDE](http://selenium-ide.openqa.org/) ex... | [
0.25323331356048584,
0.14415577054023743,
-0.09570571035146713,
0.02547929808497429,
-0.140274778008461,
-0.009424872696399689,
0.032568562775850296,
0.05367979779839516,
-0.09362776577472687,
-0.8724605441093445,
0.020631389692425728,
0.17916253209114075,
-0.1062266081571579,
0.0409736558... | |
In reading about Perl 6, I see a feature being trumpeted about, where you no longer have to do:
```
return "0 but true";
```
...but can instead do:
```
return 0 but True;
```
If that's the case, how does truth work in Perl 6? In Perl 5, it was pretty simple: 0, "", and undef are false, everything else is true.
W... | [
0.0073270187713205814,
0.017148947343230247,
0.36706408858299255,
0.000012959583727933932,
-0.2704067826271057,
-0.18844038248062134,
0.4586520195007324,
-0.1562848836183548,
-0.08316100388765335,
-0.006489147897809744,
-0.04998559132218361,
0.8813573718070984,
-0.2557430863380432,
-0.0671... | |
a Perl 5-style <0, "", undef> check of the object's value, but when you say "but True" or "but False", this method is overridden with one that doesn't look at the value just returns a constant.
One could conceivable write a true() method which, say, returned true when the value was even and false when it was odd. | [
-0.033216867595911026,
-0.17291389405727386,
0.16016864776611328,
0.05856574699282646,
-0.3603033125400543,
-0.23644600808620453,
0.3989015817642212,
-0.1492205262184143,
-0.02021496742963791,
-0.05588584765791893,
-0.07713145762681961,
0.6627499461174011,
-0.4166586995124817,
0.0783048197... | |
A recent article on [Ars Technica](http://arstechnica.com/news.ars/post/20080923-study-confirms-users-are-idiots.html) discusses a recent study performed by the Psychology Department of North Carolina State University, that showed users have a tendency to do whatever it takes to get rid of a dialog box to get back to t... | [
0.109194315969944,
0.09328550845384598,
0.20131784677505493,
0.03988556191325188,
-0.061878904700279236,
-0.04075475037097931,
0.5476560592651367,
0.19332124292850494,
-0.3086405098438263,
-0.1990627646446228,
-0.13351976871490479,
0.4188123345375061,
-0.0402938574552536,
-0.31822711229324... | |
aren't really reading those dialog boxes.
So, knowing this, how would this effect your design, and what would you try to do about it (if anything)?
I try to design applications to be robust in the face of accidents -- either slips (inadvertent operations, such as clicking in the wrong place) or mistakes (cognitive er... | [
0.08654753863811493,
0.10646926611661911,
0.06283485889434814,
0.4396290183067322,
0.1382085084915161,
-0.10824839770793915,
0.45245397090911865,
-0.4370667636394501,
-0.24855481088161469,
-0.7063032984733582,
0.017012812197208405,
0.8266698718070984,
-0.322651743888855,
-0.418341219425201... | |
Explain, Reward'](http://loki.lokislabs.org/weblog/archives/2003/09/17/surpriseexplainreward.php) (direct link: [SER](ftp://ftp.cs.orst.edu/pub/burnett/chi03.curiosity.pdf)) -- using typical psychological responses to unexpected behavior to inform users)
3. Incorporate the state of the system into said documentation (u... | [
0.08187645673751831,
0.18745118379592896,
-0.23780345916748047,
0.2923506796360016,
0.05766744911670685,
-0.21105064451694489,
0.524343729019165,
-0.6442696452140808,
-0.10138914734125137,
-0.06872692704200745,
0.025815442204475403,
0.27133989334106445,
-0.13570575416088104,
0.212908536195... | |
(1) Program defensively, and (2) Keep the user as well informed as you can. If the system's interface is easy to use, and behaves according to their expectations then they are more likely to *know* which button to click when an annoying dialog appears.
I also try very, very hard to avoid anything modal, so users *can*... | [
0.24719791114330292,
0.18796518445014954,
0.05749082937836647,
0.15322314202785492,
-0.1282711923122406,
-0.1943044513463974,
0.5913404822349548,
0.2036316841840744,
-0.010661386884748936,
-0.40423423051834106,
-0.014266901649534702,
0.735161542892456,
-0.28118494153022766,
-0.294996112585... | |
the above techniques go a long way in the right direction. (and they have been incorporated in the systems used to develop Surprise Explain Reward and other tools that have been vetted by extensive user studies.) | [
0.04216475412249565,
-0.02710793726146221,
-0.19492821395397186,
0.27801981568336487,
-0.0423712357878685,
-0.1840795874595642,
0.13370323181152344,
-0.24363183975219727,
-0.18684735894203186,
-0.20243336260318756,
-0.0668119490146637,
0.8552577495574951,
0.45546451210975647,
0.09541539847... | |
I'm relatively new to Mercurial and my team is trying it out right now as a replacement for Subversion.
How can I commit and push a single file out to another repository while leaving other modifications in my working directory uncommitted (or at least not pushed to the other repository)?
This happens for us with da... | [
0.6293759942054749,
0.08700346201658249,
0.2379794865846634,
-0.027628770098090172,
-0.13592053949832916,
-0.19216851890087128,
0.0659182071685791,
0.10285530984401703,
-0.15511183440685272,
-0.6561784744262695,
0.07745138555765152,
0.33479219675064087,
-0.14340025186538696,
0.463052719831... | |
all of them out.
In subversion, I'd simply do:
```
svn add my_migration.sql
# commit only the migration, but not the other files I'm working on
svn commit -m "migration notes" my_mygration.sql
```
and continue working locally.
This doesn't work with mercurial as when I'm pushing it out to the other repository, i... | [
0.20595993101596832,
0.04775483161211014,
0.14938287436962128,
-0.08856052160263062,
0.0840398296713829,
0.1747090369462967,
-0.03506490960717201,
0.07364477962255478,
-0.6873686909675598,
-0.7381334900856018,
-0.25230637192726135,
0.1946091651916504,
-0.4964384138584137,
0.438165247440338... | |
out is to commit the file to my local repository, clone my local repository, fetch any new changes from the actual repository, merge them and commit that merge, and them push my changes out.
```
hg add my_migration.sql
hg commit -m "migration notes" my_migration.sql
cd ..
hg clone project project-clone
cd project-cl... | [
0.02275492250919342,
0.07453065365552902,
0.5157801508903503,
-0.29525429010391235,
-0.014489980414509773,
0.2359878569841385,
-0.32425642013549805,
-0.2514500021934509,
-0.32502561807632446,
-0.6901695728302002,
-0.009805336594581604,
0.252658873796463,
-0.4669506251811981,
0.335728585720... | |
Mercurial feature that implements shelve and unshelve commands, which give you an interactive way to specify changes to store away until a later time: [Shelve](http://www.selenic.com/mercurial/wiki/index.cgi/ShelveExtension).
Then you can `hg shelve` and `hg unshelve` to temporarily store changes away. It lets you wor... | [
-0.16804970800876617,
-0.312377393245697,
0.6682226061820984,
-0.05013323575258255,
-0.0937277153134346,
0.14923910796642303,
-0.13448457419872284,
-0.10122281312942505,
-0.20079441368579865,
-0.6080166101455688,
-0.1195889487862587,
0.5233145952224731,
-0.0165235735476017,
0.2809902429580... | |
(before shelve was included -- this is no longer necessary):
I didn't see any great install instructions with some googling, so here is the combined stuff I used to get it working:
Get it with:
```
hg clone http://freehg.org/u/tksoh/hgshelve/ hgshelve
```
The only file (currently) in the project is the hgshelve.py... | [
0.32614022493362427,
-0.3936999440193176,
0.6081188321113586,
-0.037730198353528976,
-0.0234209094196558,
0.040351126343011856,
0.13670209050178528,
-0.06021728366613388,
-0.35441434383392334,
-0.4186669886112213,
-0.2661541998386383,
0.2473715990781784,
-0.05406999588012695,
0.39647519588... | |
I have been running [StyleCop](http://en.wikipedia.org/wiki/StyleCop) over some C# code, and it keeps reporting that my `using` directives should be inside the namespace.
Is there a technical reason for putting the `using` directives inside instead of outside the namespace?
There is actually a (subtle) difference betw... | [
0.9101609587669373,
0.13149188458919525,
0.19897158443927765,
-0.3924657702445984,
0.03868851810693741,
0.18087159097194672,
0.05773474648594856,
-0.3340429663658142,
-0.02555728890001774,
-0.4315791428089142,
0.07108377665281296,
0.34689193964004517,
-0.4779069423675537,
0.094440691173076... | |
}
}
}
```
Now imagine that someone adds another file (File2.cs) to the project that looks like this:
```
// File2.cs
namespace Outer
{
class Math
{
}
}
```
The compiler searches `Outer` before looking at those `using` directives outside the namespace, so it finds `Outer.Math` instead of `System.Mat... | [
0.21378649771213531,
0.16284821927547455,
0.2311103790998459,
-0.21866284310817719,
0.14713788032531738,
0.15286943316459656,
0.2374109923839569,
-0.3767693042755127,
-0.19961073994636536,
-0.6715812683105469,
-0.13501639664173126,
0.2869749367237091,
-0.6025781631469727,
0.066310152411460... | |
static void Bar()
{
double d = Math.PI;
}
}
}
```
Now the compiler searches `System` before searching `Outer`, finds `System.Math`, and all is well.
Some would argue that `Math` might be a bad name for a user-defined class, since there's already one in `System`; the point here is just... | [
0.2223496437072754,
0.07812173664569855,
0.44248437881469727,
-0.3050623834133148,
0.00018448085756972432,
0.10210618376731873,
0.2244855761528015,
-0.10272694379091263,
-0.27462393045425415,
-0.5558779835700989,
-0.1879640519618988,
0.5147184729576111,
-0.337826669216156,
0.10299677401781... | |
happens if `Foo` is in namespace `Outer`, rather than `Outer.Inner`. In that case, adding `Outer.Math` in File2 breaks File1 regardless of where the `using` goes. This implies that the compiler searches the innermost enclosing namespace before it looks at any `using` directive. | [
0.07869042456150055,
0.19572263956069946,
0.04939009249210358,
-0.2076694220304489,
0.24808017909526825,
-0.4538957476615906,
0.5160531997680664,
0.05317589268088341,
-0.19302748143672943,
-0.4212872087955475,
-0.45014652609825134,
0.5816619992256165,
-0.34642863273620605,
-0.0568451136350... | |
I come across this problem when i am writing an event handler in SharePoint. My event handler has a web reference. When i create this web reference, the URL of the web service will be added in the .config file of the assembly. If i have to change the web reference URL i just have to change the link in the config file. ... | [
-0.00007177348015829921,
0.04163951799273491,
0.3706478774547577,
-0.005720957648009062,
-0.1386866718530655,
-0.19547532498836517,
0.26884323358535767,
0.052036162465810776,
-0.34826380014419556,
-0.7187719345092773,
0.13898810744285583,
0.4648849070072174,
-0.486167848110199,
0.542078375... | |
One workaround i have found is to modify the constructor method Reference.cs class which is autogenerated by visual studio when i add a reference, so that the constructor reads the web service url from some other location, say a registry or an XML file in some predetermined location. But this poses a problem sometimes,... | [
0.2770785689353943,
0.21436023712158203,
0.17402994632720947,
0.11354401707649231,
-0.23147596418857574,
-0.22423066198825836,
0.25306716561317444,
-0.12701210379600525,
-0.26777392625808716,
-0.6687344908714294,
0.04515809565782547,
0.6447421312332153,
-0.3982486426830292,
0.2770197391510... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.