text
stringlengths
0
30.5k
title
stringclasses
1 value
embeddings
listlengths
768
768
I would like to change the database files location of MySQL administrator to another drive of my computer. (I run Windows XP SP2 and MySQL Administrator 1.2.8.) --Under the startup variable --> General Parameters --> I changed `Data directory:` from `C:/Program Files/MySQL/MySQL Server 5.0/data` to `D:/.....`, but aft...
[ 0.013604681007564068, 0.14652647078037262, 0.4005526304244995, 0.010198881849646568, 0.08874823153018951, -0.24720093607902527, 0.4441421329975128, -0.0026458613574504852, -0.18900731205940247, -0.8576135635375977, -0.13652735948562622, 0.7410305142402649, -0.3487509787082672, 0.4467490613...
the MySQL configuration 3. change the `basedir` variable in the same section. 4. move the location over 5. restart MySQL If that doesn't work I have no idea. On linux you can try to move the socket to a new location too, but that shouldn't affect windows. Alternatively you can use a symbolic link on \*nix what most pe...
[ 0.4223864674568176, -0.17381766438484192, 0.3685106933116913, 0.14133918285369873, 0.014657621271908283, -0.12443966418504715, 0.2730613350868225, 0.33176949620246887, -0.16740286350250244, -0.8861275315284729, -0.014760501682758331, 0.635184109210968, -0.2500041425228119, 0.26813298463821...
What are the ways to eliminate the use of switch in code? Switch-statements are not an antipattern per se, but if you're coding object oriented you should consider if the use of a switch is better solved with [polymorphism](http://en.wikipedia.org/wiki/Polymorphism_in_object-oriented_programming) instead of using a swi...
[ 0.4793958365917206, -0.09812583029270172, -0.2396104782819748, 0.13211962580680847, 0.08069369941949844, -0.21079380810260773, 0.3503163754940033, -0.4930536150932312, -0.17789828777313232, -0.3661805987358093, 0.017064066603779793, 0.5001782774925232, -0.698383092880249, -0.08071420341730...
echo animal.meow(); break; } } ``` becomes this: ``` foreach (var animal in zoo) { echo animal.speak(); } ```
[ 0.17572855949401855, 0.04379548132419586, 0.24175281822681427, -0.4828372895717621, 0.07739264518022537, 0.13238832354545593, 0.5884689092636108, -0.42117226123809814, -0.08708140254020691, -0.15423907339572906, -0.29516130685806274, 0.5107542872428894, -0.6488621234893799, 0.1003289595246...
Is it possible to change the natural order of columns in Postgres 8.1? I know that you shouldn't rely on column order - it's not *essential* to what I am doing - I only need it to make some auto-generated stuff come out in a way that is more pleasing, so that the field order matches all the way from pgadmin through th...
[ 0.283840537071228, 0.27107328176498413, 0.3213670253753662, -0.11282199621200562, 0.19457605481147766, -0.1766778975725174, 0.10572918504476547, 0.0802755206823349, -0.1075517013669014, -0.652584969997406, 0.003848977154120803, 0.6960675716400146, -0.49087655544281006, -0.195085808634758, ...
int, b int, c int); # INSERT INTO test VALUES (1,2,3); # SELECT * FROM test; a | b | c ---+---+--- 1 | 2 | 3 (1 row) ``` Now for the tricky bit, you need to connect to your database using the postgres user so you can modify the system tables. ``` # SELECT relname, relfilenode FROM pg_class WHERE relname='test'; ...
[ -0.07447289675474167, -0.1518845558166504, 0.47461631894111633, 0.08177751302719116, 0.07321435958147049, 0.40476375818252563, 0.23727580904960632, -0.5008084177970886, -0.08297751843929291, -0.48994600772857666, -0.2627315819263458, 0.5340268015861511, -0.21308623254299164, 0.223277568817...
27666 | cmax | -6 27666 | xmax | -5 27666 | cmin | -4 27666 | xmin | -3 27666 | ctid | -1 27666 | b | 1
[ -0.29246556758880615, 0.34391024708747864, 0.5090714693069458, -0.026106039062142372, -0.4594290852546692, 0.4592978060245514, 0.05996725708246231, -0.41756802797317505, -0.4494200348854065, -0.24849683046340942, -0.3454125225543976, 0.11976520717144012, -0.43881386518478394, 0.15496714413...
27666 | a | 2 27666 | c | 3 (9 rows) ``` attnum is a unique column, so you need to use a temporary value when you're modifying the column numbers as such: ``` # UPDATE pg_attribute SET attnum=4 WHERE attname='a' AND attrelid=27666; UPDATE 1 # UPDATE pg_attribute SET attnum=1 WHERE attnam...
[ -0.47721439599990845, 0.07600516080856323, 0.9123398661613464, -0.2557290196418762, -0.09824200719594955, 0.48816293478012085, 0.2117059826850891, -0.5685302019119263, -0.4097349941730499, 0.09984886646270752, -0.3045635223388672, 0.3530084490776062, -0.5114837884902954, -0.069885917007923...
row) ``` Again, because this is playing around with database system tables, use extreme caution if you feel you really need to do this. This is working as of postgres 8.3, with prior versions, your milage may vary.
[ -0.02878275141119957, 0.260772705078125, 0.8941836357116699, -0.07534807175397873, 0.34632810950279236, -0.3513796627521515, 0.07815147936344147, -0.11395169049501419, -0.2446797639131546, -0.7498736381530762, 0.020504044368863106, 0.6196860671043396, -0.40406179428100586, 0.03554654121398...
I am implementing a design that uses custom styled submit-buttons. They are quite simply light grey buttons with a slightly darker outer border: ``` input.button { background: #eee; border: 1px solid #ccc; } ``` This looks just right in Firefox, Safari and Opera. The problem is with Internet Explorer, both 6...
[ 0.2468203604221344, -0.042636845260858536, 0.7808545827865601, -0.2703678607940674, -0.25572606921195984, -0.14438824355602264, 0.013272209092974663, -0.23450906574726105, -0.004440879449248314, -0.7950125336647034, -0.1910041868686676, 0.46995657682418823, -0.28924834728240967, -0.0602959...
I turn off borders, then the black extra border in IE goes away too. I am looking for a way to keep my normal borders, but remove the outline. Well this works here: ``` <html> <head> <style type="text/css"> span.button { background: #eee; border: 1px solid #ccc;
[ 0.4904022514820099, -0.017662370577454567, 1.0208079814910889, -0.13121141493320465, 0.19526685774326324, -0.13014748692512512, 0.1088651642203331, -0.1173187717795372, -0.31475767493247986, -0.7874908447265625, -0.1378287672996521, 0.21887722611427307, -0.14930228888988495, 0.245934098958...
} span.button input { background:none; border:0; margin:0; padding:0; }
[ -0.18926483392715454, -0.35411232709884644, 0.8125017881393433, -0.14474087953567505, 0.026951506733894348, 0.4896242916584015, -0.2565349340438843, -0.23636826872825623, -0.3079899251461029, -0.712723433971405, -0.21270596981048584, 0.4899776875972748, -0.19370530545711517, -0.26370072364...
</style> </head> <body> <span class="button"><input type="button" name="..." value="Button"/></span> </body> </html> ```
[ 0.17039185762405396, 0.003396865911781788, 0.7093490362167358, -0.14130406081676483, -0.3056793212890625, 0.07679180055856705, -0.2479477822780609, -0.4611893892288208, -0.3677799105644226, -0.6013623476028442, -0.21381154656410217, 0.4128713011741638, -0.1311279833316803, -0.1749210655689...
On the safari browser, the standard <asp:Menu> doesn't render well at all. How can this be fixed? Thanks for the advice, it led me into the following solution; I created a file named "safari.browser" and placed it in the App\_Browsers directory. The content of this file is shown below; ``` <browsers> <browser ref...
[ -0.19172707200050354, -0.07369296252727509, 0.4895460903644562, -0.004361273720860481, -0.037920981645584106, 0.020199144259095192, 0.37366315722465515, -0.052470769733190536, -0.2898670434951782, -0.9901217222213745, -0.15942709147930145, 0.5381816625595093, -0.562526524066925, -0.0239804...
normally use to render the control content and instead use uplevel rendering.
[ 0.0038615944795310497, -0.042923834174871445, 0.4065226912498474, 0.37358611822128296, 0.02484116144478321, -0.14548608660697937, -0.27507734298706055, 0.09076464176177979, 0.10294267535209656, -0.7330350279808044, -0.6273448467254639, 0.5263197422027588, -0.15557992458343506, 0.0870545059...
I have a requirement to be be able to embed scanned tiff images into some SSRS reports. When I design a report in VS2005 and add an image control the tiff image displays perfectly however when I build it. I get the warning : `Warning 2 [rsInvalidMIMEType] The value of the MIMEType property for the image ‘image1’ is “...
[ 0.2976098954677582, 0.055503349751234055, 0.5334004163742065, 0.007700188551098108, -0.11567986756563187, -0.2080528736114502, 0.39699608087539673, -0.06138329580426216, -0.252600759267807, -0.5374770760536194, 0.08002039790153503, 0.581669270992279, -0.39069756865501404, 0.197798192501068...
that you *can* use. ``` Response.ContentType = "image/png"; Response.Clear(); using (Bitmap bmp = new Bitmap(tifFilepath)) bmp.Save(Response.OutputStream, ImageFormat.Png); Response.End(); ```
[ 0.38648706674575806, -0.3000367283821106, 0.7157366871833801, -0.2914050221443176, 0.044255126267671585, 0.12354236841201782, 0.16213439404964447, -0.19046896696090698, -0.3992193937301636, -0.5926001667976379, -0.4920547306537628, 0.5892454981803894, -0.5355682969093323, -0.03017815202474...
I'm using Visual Studio 2008 and the built-in installation tools for a C# client application. How can I use this installer to install a font on the client machine (if it's not already there)? In VS2005 (so I assume 2008 as well), right click on the File System on Target Machine, Add Special Folder -> Fonts Folder, then...
[ 0.3428124487400055, 0.08397619426250458, 0.42274078726768494, -0.14168258011341095, -0.21793626248836517, -0.08100961148738861, 0.13800469040870667, 0.08373486250638962, -0.12622319161891937, -0.8957772850990295, 0.26482078433036804, 0.7144035696983337, -0.0980558767914772, -0.107323721051...
After watching The Dark Knight I became rather enthralled with the concept of the Prisoner's Dilemma. There *must* be an algorithm that that maximizes one's own gain given a situation. For those that find this foreign: <http://en.wikipedia.org/wiki/Prisoner%27s_dilemma> Very, very interesting stuff. Edit: The questi...
[ -0.0644289031624794, 0.014691201038658619, -0.029217978939414024, -0.10783534497022629, -0.24778130650520325, -0.014024119824171066, 0.20607736706733704, -0.2774316370487213, -0.19498609006404877, -0.6964760422706604, -0.2146836817264557, 0.4393593966960907, -0.3532070219516754, -0.0267194...
For example <http://www.iterated-prisoners-dilemma.info/> Even then it's not 'solvable' since the other player is not predictable.
[ -0.49276003241539, -0.350993812084198, -0.1245022639632225, 0.046520911157131195, 0.10720483958721161, -0.18269474804401398, 0.12212269753217697, -0.26298031210899353, -0.4240831136703491, -0.3422723114490509, -0.16374030709266663, 0.2262725979089737, -0.4718482494354248, 0.055414583534002...
Almost every Python web framework has a simple server that runs a wsgi application and automatically reloads the imported modules every time the source gets changed. I know I can look at the code and see how it's done, but that may take some time and I'm asking just out of curiosity. Does anyone have any idea how this ...
[ 0.6177869439125061, 0.13076452910900116, -0.23569545149803162, -0.06935330480337143, -0.1742556244134903, -0.006909982301294804, 0.2697221338748932, 0.21294265985488892, -0.4433082342147827, -0.3943723738193512, 0.05669204890727997, 0.24526451528072357, -0.37275809049606323, 0.066606350243...
that one module changed on the file system. Inline `reload()`ing doesn't work because references to the reloaded module are not updated.
[ 0.2788563072681427, 0.13185811042785645, 0.5810010433197021, 0.1266964077949524, -0.16677410900592804, -0.30790454149246216, 0.41215819120407104, -0.16072383522987366, -0.0158520694822073, -0.4213547706604004, 0.24941149353981018, 0.7528831958770752, -0.5816601514816284, 0.3596051335334778...
Does anyone know how to solve this java error? ``` java.io.IOException: Invalid keystore format ``` I get it when I try and access the certificate store from the Java option in control panels. It's stopping me from loading applets that require elevated privileges. [Error Image](http://img72.imageshack.us/my.php?ima...
[ 0.1089962050318718, 0.6554287672042847, 0.14196251332759857, -0.003855532268062234, 0.08315946161746979, -0.17817535996437073, 0.864203691482544, 0.005693003069609404, -0.16894976794719696, -0.7095195055007935, -0.01219876203685999, 0.4720994234085083, -0.27041909098625183, 0.1257613301277...
I saw [this](http://www.gnegg.ch/2008/09/automatic-language-detection/) on reddit, and it reminded me of one of my vim gripes: It shows the UI in German. I want English. But since my OS is set up in German (the standard at our office), I guess vim is actually trying to be helpful. What magic incantations must I perfor...
[ 0.03755858913064003, 0.06051107123494148, 0.44284573197364807, 0.06672973930835724, -0.2353454828262329, -0.20429851114749908, 0.7674292325973511, 0.18506577610969543, 0.046785302460193634, -0.5368981957435608, -0.4191441237926483, 0.5200104117393494, -0.12987034022808075, -0.0801805704832...
is loaded once at startup, very early on, and not re-read again later. So you really do need to set `LC_ALL` (or more specifically `LC_MESSAGES`) in your environment – or on non-Unixoid systems (eg. Windows), you can pass the `--cmd` switch (which executes the given command first thing, as opposed to the `-c` option): ...
[ -0.07661140710115433, 0.018145322799682617, 0.5366565585136414, 0.09440666437149048, 0.4024091958999634, -0.17558300495147705, 0.12866094708442688, 0.39154374599456787, -0.3045787215232849, -0.6763554215431213, -0.8173903226852417, 0.44755735993385315, -0.4474293887615204, -0.0686413794755...
for letters, except that the default sort order is ASCIIbetical (ie. sort by codepoint, not according to language conventions). You could use a different variation; see [`man 7 locale`](http://man.cx/locale%287%29) for more.
[ 0.012632406316697598, 0.012099778279662132, 0.2483830451965332, -0.30562910437583923, -0.19361603260040283, 0.3645235598087311, 0.6031016707420349, 0.21377533674240112, -0.6607811450958252, -0.5962186455726624, -0.5370124578475952, 0.07292096316814423, -0.048237938433885574, -0.11293658614...
I'm developing a C# assembly which is to be called via COM from a Delphi 7 (iow, native win32, not .net) application. So far, it seems to work. I've exported a TLB file, imported that into my Delphi project, and I can create my C# object and call its functions. So that's great, but soon I'm going to **really** want t...
[ 0.5127991437911987, 0.015348518267273903, 0.2679044008255005, -0.2683926224708557, -0.17484401166439056, 0.03569571301341057, 0.0881621390581131, 0.2522825598716736, -0.28361451625823975, -0.8181440234184265, -0.028223060071468353, 0.8572383522987366, -0.3375284969806671, 0.058991782367229...
but I can't find one. Is there a way to set VS2008 up to do this? I'd prefer to just be able to hit f5 and have VS start the Delphi executable, wait for the C# code to be called, and then attach itself to it.. But I could live with manually attaching to a process, I suppose. Just please don't tell me I have to make d...
[ 0.24147367477416992, -0.3002559244632721, 0.24113094806671143, 0.18529659509658813, 0.03335527703166008, -0.1878911256790161, 0.07972462475299835, -0.19486939907073975, -0.2936232388019562, -0.6015522480010986, -0.00679573742672801, 0.6834850907325745, -0.1764446645975113, 0.08319969475269...
you press F5.
[ -0.05971205607056618, 0.4417934715747833, 0.3403518795967102, -0.16035936772823334, -0.11619970947504044, 0.2784064710140228, 0.018771186470985413, -0.27704936265945435, -0.21182383596897125, -0.31892967224121094, -0.24006099998950958, 0.8627665638923645, -0.02161838673055172, -0.013898791...
we are using git-svn to manage branches of an SVN repo. We are facing the following problem: after a number of commits by user X in the branch, user Y would like to use git-svn to merge the changes in branch to trunk. The problem we're seeing is that the commit messages for all the individual merge operations look as i...
[ 0.05530611053109169, -0.3712819516658783, 0.23241949081420898, 0.35949647426605225, 0.11805111169815063, 0.11716949194669724, 0.17301538586616516, 0.0992753729224205, -0.6865267157554626, -0.21025855839252472, -0.11303683370351791, 0.26564812660217285, -0.22409753501415253, 0.3293909132480...
person doing the merge? The git-svn man page recommends that you *don't use merge*. ""It is recommended that you run git-svn fetch and rebase (not pull or merge)"". Having said that, you can do what you like :-) There are 2 issues here. First is that svn only stores the *commiter*, not the author of a patch as git doe...
[ 0.21677692234516144, -0.06262896955013275, -0.03518955036997795, 0.027925483882427216, -0.04922419413924217, 0.016590291634202003, 0.19323952496051788, 0.07288758456707001, -0.4140269160270691, -0.30594193935394287, 0.0250146072357893, 0.4587266445159912, -0.147586390376091, 0.151368856430...
can avoid legal problems down the road. Secondly, git doesn't seem to use the relatively new svn merge features. This may be a temporary thing, as git is actively developed and new features are added all the time. But for now, it doesn't use them. I've just tried with git 1.6.0.2 and it "loses" information compared t...
[ -0.19936424493789673, 0.05789238214492798, 0.5712215304374695, 0.1315803825855255, -0.15374617278575897, -0.07850665599107742, 0.42667558789253235, -0.08228077739477158, -0.2957821786403656, -0.685676097869873, -0.027237309142947197, 0.6398352384567261, -0.33143916726112366, 0.122071772813...
Sep 2008) | 1 line Merged release-1.0 into trunk ------------------------------------------------------------------------ r4 | X | 2008-09-24 15:16:13 +0200 (Wed, 24 Sep 2008) | 1 line Merged via: r5 Return 1 ------------------------------------------------------------------------ r3 | X | 2008-09-24 15:15:48 +0200 (...
[ -0.632830798625946, -0.3227076530456543, 0.5152654647827148, 0.22704894840717316, 0.044713567942380905, 0.40915411710739136, 0.43556275963783264, -0.24405699968338013, -0.37134259939193726, -0.07660380005836487, -0.3268674910068512, 0.3497374653816223, -0.18309716880321503, 0.4525441825389...
2 Y { G 4 X return 1; 2 Y } ``` Here assuming Y only commits to trunk, we can see that one line was editted by X (on the branch) and merged. So, if you are using svn 1.5.2, you are possibly better of merging with the real svn client for now. Although you would lose merge info...
[ 0.15650860965251923, -0.25179553031921387, 0.4209265112876892, 0.015107504092156887, -0.12171529233455658, -0.11836881190538406, 0.25706005096435547, 0.15244336426258087, -0.17964400351047516, -0.6491548418998718, -0.14945454895496368, 0.5039158463478088, -0.5114936828613281, 0.19865161180...
is usually clever enough not to complain. Update: I've just tried this with git 1.7.1 to see if there has been any advances in the interim. The bad news is that merge within git still does not populate the svn:mergeinfo values, so `git merge` followed by `git svn dcommit` will not set svn:mergeinfo and you will lose m...
[ 0.2983018457889557, -0.07468812167644501, 0.40408170223236084, 0.04096421226859093, 0.08088000863790512, -0.348705917596817, 0.42032331228256226, 0.10324428230524063, 0.10338382422924042, -0.8851643204689026, -0.07736928761005402, 0.5946304798126221, -0.25267621874809265, 0.160663127899169...
branches) then the git clone will look correct to git users.
[ 0.3869849443435669, -0.3756854236125946, 0.5894111394882202, 0.32613876461982727, 0.25701820850372314, 0.012479609809815884, 0.308186799287796, 0.2132682055234909, -0.007160784211009741, -0.6062636375427246, -0.4508519470691681, 0.2434825897216797, -0.11280661076307297, 0.14944125711917877...
I ran into a problem a few days ago when I had to introduce C++ files into a Java project. It started with a need to measure the CPU usage of the Java process and it was decided that the way to go was to use JNI to call out to a native library (a shared library on a Unix machine) written in C. The problem was to find a...
[ 0.20611359179019928, 0.20577076077461243, -0.20276440680027008, -0.0916832759976387, -0.22982953488826752, -0.09268790483474731, 0.08358348906040192, -0.04139088839292526, 0.02708105370402336, -0.5503180623054504, 0.24352793395519257, 0.42974984645843506, -0.42549893260002136, 0.2493073493...
putting the C files (specifically, one .h file and one .c file) at the top of the source base like: /vobs/myproduct/javasrc /vobs/myproduct/cppsrc I didn't like this because I have only two C files and it seemed very odd to split the source base at the language level like this. Had substantial portions of the project...
[ 0.2592557370662689, 0.40108752250671387, 0.014149665832519531, -0.12091842293739319, -0.18456757068634033, -0.11771492660045624, -0.016278915107250214, 0.001933207968249917, -0.036120668053627014, -0.5228728652000427, -0.09762851148843765, 0.44788798689842224, -0.3462488353252411, 0.069424...
C files just don't belong in the Java package. Has anybody solved a problem like this before? Generally, what's a good strategy to follow when organizing codebase that mixes two or more languages? Update: I don't have any plan to use any C or C++ in my project, some Jython perhaps, but you never know when my customer...
[ 0.4009152352809906, 0.1576126664876938, -0.14893509447574615, 0.02046029083430767, -0.1412069946527481, -0.18328870832920074, 0.12395220994949341, 0.15579451620578766, -0.455567330121994, -0.44991979002952576, -0.0496436208486557, 0.5944564342498779, -0.2069055140018463, -0.156537383794784...
it seem odd? Consider this project: ``` project1\src\java project1\src\cpp project1\src\python ``` Or, if you decide to split things up into modules: ``` project1\module1\src\java project1\module1\src\cpp project1\module2\src\java project1\module2\src\python ``` I guess it's a matter of personal t...
[ 0.2494805008172989, 0.15962575376033783, 0.14648571610450745, -0.11083599179983139, -0.14229561388492584, 0.016957387328147888, -0.14602850377559662, 0.014504151418805122, -0.24933652579784393, -0.1616860330104828, 0.2774990200996399, -0.01630903221666813, -0.35769715905189514, 0.138807520...
I have an Internet Explorer Browser Helper Object (BHO), written in c#, and in various places I open forms as modal dialogs. Sometimes this works but in some cases it doesn't. The case that I can replicate at present is where IE is running javascript to open other child windows... I guess it's getting a bit confused so...
[ 0.2683188021183014, 0.347380131483078, 0.4625118374824524, -0.21865558624267578, -0.2433360069990158, -0.04784734174609184, 0.3676709234714508, 0.30072247982025146, 0.061251942068338394, -0.988541841506958, 0.07061218470335007, 0.34277257323265076, -0.37289729714393616, 0.07161319255828857...
it appears that IE is hanging. Is there a way of ensuring that the form will be opened as modal, ie that it's not possible for the form to be hidden behind IE windows. (I'm using IE7.) NB: this is a similar question to [this post](https://stackoverflow.com/questions/73000/modal-dialogs-in-ie-gets-hidden-behind-ie-if...
[ 0.3716500997543335, -0.07379189133644104, 0.5492356419563293, -0.11573511362075806, -0.08968321979045868, -0.41074901819229126, 0.40748274326324463, -0.10836838185787201, -0.2314475029706955, -0.6112488508224487, -0.2856343984603882, 0.41065317392349243, -0.014872288331389427, -0.115100644...
how I did this, where 'siteObject' is the object passed in to the SetSite() method of the BHO: ``` IWebBrowser2 browser = siteObject as IWebBrowser2; if (browser != null) hwnd = new IntPtr(browser.HWND); (new MyForm(someParam)).ShowDialog(new WindowWrapper(hwnd)); ... // Wrapper class so that we can return an IWin32...
[ 0.30764469504356384, -0.1266462504863739, 0.513876736164093, -0.3796316981315613, 0.10210959613323212, -0.2558038830757141, 0.42210090160369873, -0.26024290919303894, -0.027004742994904518, -0.8411132097244263, -0.18431346118450165, 0.30882012844085693, -0.2425941377878189, 0.3747418820858...
private IntPtr _hwnd; } ``` Thanks to [Ryan](http://ryanfarley.com/blog/archive/2004/03/23/465.aspx) for the WindowWrapper class, although I'd hoped there was a built-in way to do this? UPDATE: this won't work on IE8 with Protected Mode, since it's accessing an HWND outside what it should be. Instead you'll have to ...
[ -0.06792125105857849, -0.06892582774162292, 0.26719143986701965, 0.09137757122516632, -0.24336424469947815, -0.28320932388305664, 0.6084532141685486, 0.38671115040779114, -0.25324130058288574, -0.6331085562705994, -0.21802948415279388, 0.66190105676651, -0.20972011983394623, 0.267441898584...
I'm using Spring.net with NHiberante (HibernateTemplate) to implement my DAO's. I also have some integration tests, that extend from 'AbstractTransactionalDbProviderSpringContextTests '. DI is working fine, and all test pass BUT sometimes they pass **even when they shouldn't**. For example if my hbm.xml files have ...
[ 0.4489588439464569, 0.010535415261983871, 0.009045258164405823, -0.0368618443608284, -0.3372972011566162, -0.143395334482193, 0.3918195366859436, -0.34931623935699463, 0.2114695906639099, -0.9221141934394836, 0.3556695282459259, 0.4572490453720093, -0.237055703997612, 0.06897564977407455, ...
do so. Can anyone tell me how to fix this issue? Thank you very much! @Ben: If I have to actually execute the SQL scripts to see if they work, what is the benefit of using this kind of Spring tests? If you have a syntax error in your mapping, then NHibernate will fail on config.BuildSessionFactory() But for mispell...
[ 0.3210824131965637, 0.007970137521624565, -0.13212455809116364, 0.328046053647995, -0.3518642783164978, 0.030127575621008873, 0.5312464237213135, -0.04880752041935921, -0.1857444792985916, -0.42071470618247986, 0.3027130663394928, 0.4844669699668884, -0.02617715671658516, 0.001417613821104...
I need to compress portions of our application's network traffic for performance. I presume this means I need to stay away from some of the newer algorithms like bzip2, which I think I have heard is slower. You can use [Deflater](https://docs.oracle.com/javase/8/docs/api/java/util/zip/Deflater.html)/[Inflater](http://d...
[ 0.08227096498012543, 0.09191425889730453, 0.28304335474967957, 0.033329252153635025, -0.10518510639667511, -0.16015858948230743, 0.12362045794725418, -0.04704159125685692, -0.2798216640949249, -0.9872064590454102, 0.06103646755218506, 0.72365802526474, -0.39183270931243896, -0.071975141763...
supports it. If your client is a webservices client or an [http client](http://hc.apache.org/httpclient-3.x/) check the documentation for that package to see if it is supported. It looks like jakarta-commons httpclient may require you to manually do the compression. To enable this on the client side you will need to d...
[ 0.12136878818273544, -0.08892880380153656, 0.2627948522567749, 0.2101656049489975, 0.08389904350042343, -0.34246116876602173, 0.08707685768604279, -0.19262513518333435, -0.13718119263648987, -0.4113287627696991, -0.33237066864967346, 0.5686127543449402, -0.7211151123046875, -0.394006788730...
Is there a way to determine how many capture groups there are in a given regular expression? I would like to be able to do the follwing: ``` def groups(regexp, s): """ Returns the first result of re.findall, or an empty default >>> groups(r'(\d)(\d)(\d)', '123') ('1', '2', '3') >>> groups(r'(\d)(\d)(...
[ -0.13878846168518066, -0.020185226574540138, 0.26199108362197876, -0.28272178769111633, 0.24894319474697113, 0.12502241134643555, 0.1762719601392746, -0.7201834321022034, -0.0873989388346672, -0.5164287090301514, -0.657805860042572, 0.44975030422210693, -0.7414597272872925, -0.245800063014...
('',) * num_of_groups(regexp) ``` This allows me to do stuff like: ``` first, last, phone = groups(r'(\w+) (\w+) ([\d\-]+)', 'John Doe 555-3456') ``` However, I don't know how to implement `num_of_groups`. (Currently I just work around it.) **EDIT:** Following the [advice from rslite](https://stackoverflow.com/qu...
[ -0.26531851291656494, 0.2268380969762802, 0.31782954931259155, -0.2783156931400299, -0.04316923767328262, 0.06570488959550858, 0.2590625584125519, -0.5689916014671326, -0.35230767726898193, -0.40065446496009827, -0.3984591066837311, 0.40476739406585693, -0.6118077039718628, -0.172420337796...
We have a production machine and are trying to slowly introduce some 3.0 and up features on our web application. 3.5 is installed but I would like to upgrade to SP1, I would just like to know if it requires a restart of the machine in the end so I can schedule some down time. Thanks! EDIT: so it did require the resta...
[ 0.5199076533317566, 0.061813950538635254, 0.5816863179206848, 0.3303834795951843, 0.11777111142873764, 0.14121630787849426, 0.28514599800109863, -0.019387846812605858, -0.3688916563987732, -0.4733355641365051, -0.020314428955316544, 0.37163054943084717, -0.20696885883808136, -0.04293279722...
no obvious way to determine why some needed a restart and others didn't. The best theory I have currently is that the ones which needed restarts tended to be the ones which were more active (they were all running ASP.Net sites), so it is possible that the framework bits had not yet been loaded by IIS for the ones which...
[ 0.2897256910800934, -0.12518279254436493, 0.012266797944903374, 0.35574403405189514, -0.08573819696903229, -0.3874104917049408, 0.5718297958374023, 0.05546364560723305, -0.2110104113817215, -0.31631961464881897, -0.1039980798959732, 0.4448775351047516, -0.12981431186199188, -0.084720179438...
I'm always wondering who should do it. In [Ruby](http://ruby-lang.org/), we have the [Daemons](http://daemons.rubyforge.org/) library which allows Ruby scripts to daemonize themselves. And then, looking at [God](http://god.rubyforge.org/) (a process monitoring tool, similar to [monit](http://www.tildeslash.com/monit/))...
[ 0.4003192186355591, 0.2840254008769989, -0.04463248699903488, 0.09236063808202744, -0.22499173879623413, 0.13140340149402618, 0.6279801726341248, 0.010942364111542702, -0.5636898875236511, -0.7076346278190613, 0.0386538989841938, 0.05138935148715973, -0.2650572955608368, 0.3518416881561279...
closely follow its children to restart them if they die, it can choose not to daemonize them. A SIGCHLD will be delivered to the monitor when one of its child processes exits. In embedded systems we do this a lot. 2. Typically when daemonizing, you also set the euid and egid. I prefer not to encode into every child ...
[ 0.17615769803524017, -0.30587488412857056, 0.5030853748321533, 0.12699784338474274, 0.10269133001565933, -0.3347565233707428, 0.0016765687614679337, 0.0014181897277012467, -0.02271624095737934, -0.6846036911010742, -0.16918687522411346, 0.25070980191230774, -0.1347193419933319, -0.07770591...
Can you explain STA and MTA in your own words? Also, what are apartment threads and do they pertain only to COM? If so, why? The COM threading model is called an "apartment" model, where the execution context of initialized COM objects is associated with either a single thread (Single Thread Apartment) or many threads...
[ 0.1510356366634369, -0.1326359361410141, -0.16645729541778564, 0.2605019211769104, -0.02196463756263256, 0.30192598700523376, 0.17564657330513, -0.2054816037416458, -0.4375729560852051, -0.7255454659461975, -0.22298426926136017, -0.02150791697204113, -0.3906228542327881, 0.3134558200836181...
common use of this is a UI component. So if another thread needs to interact with the object (such as pushing a button in a form) then the message is marshalled onto the STA thread. The windows forms message pumping system is an example of this. If the COM object can handle its own synchronization then the MTA model c...
[ 0.15180006623268127, -0.472068190574646, 0.3079131245613098, 0.20903663337230682, -0.1753474920988083, -0.04365608096122742, -0.05568387731909752, -0.14803294837474823, -0.3560476303100586, -0.6105533838272095, -0.17604345083236694, 0.2390325963497162, -0.5678274631500244, 0.26173552870750...
We are developing a .NET 2.0 winform application. The application needs to access [Web Services](http://ws.lokad.com/). Yet, we are encountering issues with users behind proxies. Popular windows backup applications (think [Mozy](http://mozy.com/)) are providing a moderately complex dialog window dedicated the proxy se...
[ 0.1579051911830902, 0.14543910324573517, 0.410933256149292, 0.09198616445064545, 0.3317207098007202, -0.11548948287963867, 0.11168617755174637, 0.060027457773685455, -0.04115572199225426, -0.8467607498168945, -0.09739658236503601, 0.5185278058052063, -0.12052623182535172, 0.017238736152648...
still prompted for his username and password when launching IE (both fields are pre-completed, the user just need to click OK) - and our winform application still fails at handling the proxy. What should we do to enforce that the user is not prompted for his username and password when launching IE? Put this in your ap...
[ 0.2732306718826294, 0.09986007958650589, 0.7580028772354126, 0.022206109017133713, 0.0937427505850792, -0.1900469958782196, 0.25839582085609436, 0.013923128135502338, 0.1558336615562439, -0.7596433162689209, -0.367832213640213, 0.5792338252067566, -0.15299606323242188, 0.17632026970386505,...
should be able to "see" it from your application.
[ 0.7575627565383911, 0.1528821438550949, 0.20650270581245422, 0.18433444201946259, 0.5234981179237366, -0.330804705619812, 0.012425062246620655, 0.22134609520435333, -0.05796715244650841, -0.441070020198822, 0.1667109876871109, 0.3929935693740845, 0.397969126701355, -0.19221454858779907, ...
I want to programmatically edit file content using windows command line ([cmd.exe](http://en.wikipedia.org/wiki/Windows_command_line)). In \*nix there is [sed](http://en.wikipedia.org/wiki/Sed) for this tasks. Is there any useful native equivalent in windows? Today powershell saved me. For `grep` there is: ``` get-co...
[ 0.35021257400512695, -0.009869991801679134, 0.513219952583313, 0.13409003615379333, -0.012050401419401169, -0.10482078045606613, 0.16106420755386353, 0.06946495920419693, -0.10718782991170883, -0.8098459243774414, -0.3445364534854889, 0.6693589091300964, -0.3020355999469757, 0.030275590717...
different programming languages have different features or lack certain features. Design patterns are a way to work around those shortcomings. I have seen the books and lists about design patterns in static, object oriented languages (Java, C++), but also the Videos about design patterns in Python. I'm interested in t...
[ 0.733815610408783, 0.10348699241876602, -0.3968068063259125, 0.4017857015132904, -0.21552948653697968, -0.16133272647857666, 0.29650890827178955, 0.31292882561683655, -0.1616864651441574, -0.8656342625617981, 0.03966763988137245, 0.37370535731315613, -0.5555989742279053, -0.140496402978897...
In non-OO languages (C, Forth, COBOL, etc.) they're just "the usual ways of doing things". Sometimes, they're called "algorithms". Every language (indeed, every discipline) has patterns of designing solutions. If you've seen something two or three times, you've seen a pattern. If you can describe the context, the prob...
[ 0.27273139357566833, 0.340030699968338, -0.18608921766281128, -0.0959993526339531, -0.09744269400835037, 0.09887932240962982, 0.18017947673797607, 0.3609442412853241, -0.34698525071144104, -0.6919869184494019, -0.5292990207672119, 0.14614388346672058, -0.5045366287231445, -0.24216622114181...
I was asked a question in C last night and I did not know the answer since I have not used C much since college so I thought maybe I could find the answer here instead of just forgetting about it. If a person has a define such as: ``` #define count 1 ``` Can that person find the variable name `count` using the 1 th...
[ 0.2216174602508545, 0.06837602704763412, -0.022572936490178108, -0.04088399186730385, -0.19045095145702362, -0.27604493498802185, 0.16630810499191284, -0.062074437737464905, -0.16050615906715393, -0.2649877965450287, -0.047692686319351196, 0.07823897898197174, -0.3742053806781769, 0.380416...
dealt with by the preprocessor, and they only point in one direction. Of course the other problem is that even the compiler wouldn't know - as a "1" could point to anything - multiple variables can have the same value at the same time.
[ -0.07616845518350601, 0.21327343583106995, 0.012862339615821838, 0.2391558140516281, -0.03730814531445503, 0.08421167731285095, 0.23685508966445923, -0.1854104846715927, -0.23766836524009705, -0.29703569412231445, -0.24870561063289642, 0.22613227367401123, -0.22552615404129028, 0.053882624...
I have defined an interface in C++, i.e. a class containing only pure virtual functions. I want to explicitly forbid users of the interface to delete the object through a pointer to the interface, so I declared a protected and non-virtual destructor for the interface, something like: ``` class ITest{ public: virt...
[ 0.05719830095767975, -0.26456356048583984, 0.26074934005737305, -0.0003553486312739551, 0.00482967309653759, -0.1090329959988594, 0.3185437023639679, -0.05378824099898338, 0.012530307285487652, -0.7558574080467224, -0.18964633345603943, 0.6479752659797668, -0.3924884796142578, 0.2918921113...
destructor is protected, what is the difference in having it virtual or non-virtual? Do you think this warning can be safely ignored or silenced? It's more or less a bug in the compiler. Note that in more recent versions of the compiler this warning does not get thrown (at least in 4.3 it doesn't). Having the destruct...
[ 0.29130399227142334, 0.14941860735416412, -0.05669543892145157, 0.21429158747196198, -0.27689221501350403, -0.32538503408432007, 0.4387795627117157, 0.11478181183338165, -0.18879620730876923, -0.27805617451667786, -0.2900390028953552, 0.9019818902015686, -0.5765663981437683, 0.168064117431...
I'm a pretty inexperienced programmer (can make tk apps, text processing, sort of understand oop), but Python is so awesome that I would like to help the community. What's the best way for a beginner to contribute? 1. Add to the docs. it is downright crappy 2. Help out other users on the dev and user mailing lists. 3. ...
[ 0.7043935656547546, 0.33850255608558655, -0.16250698268413544, 0.11855244636535645, -0.16670112311840057, -0.48118263483047485, 0.5347351431846619, 0.35531795024871826, -0.22914981842041016, -0.4109768271446228, 0.1588144451379776, 0.6929779648780823, -0.07685065269470215, -0.1523312032222...
Is anyone aware of a reasonably well documented example of simulated annealing in Visual Basic that I can examine and adapt? This project looks pretty well documented: <http://www.codeproject.com/KB/recipes/simulatedAnnealingTSP.aspx>. It's C# but contains only one important source file (TravellingSalesmanProblem.cs) s...
[ 0.1708976775407791, 0.07540982961654663, 0.36512625217437744, -0.01187992189079523, -0.0998692512512207, -0.04936308041214943, 0.04832664132118225, 0.0665770173072815, -0.45355895161628723, -0.516838550567627, 0.2220943719148636, 0.51507169008255, 0.0843905657529831, 0.103643998503685, -...
a large Momentum and slowly 'cools' by shrinking the Momentum and thus reducing the effect of output error in backpropagation. Cheers.
[ -0.3844453990459442, 0.21173064410686493, 0.7810507416725159, 0.045024093240499496, -0.005815019831061363, -0.031598735600709915, 0.19153399765491486, -0.2780427932739258, -0.49000075459480286, -0.3314753472805023, -0.3476102948188782, 0.24048228561878204, 0.4195513129234314, -0.0228594988...
I have a listbox where the items contain checkboxes: ``` <ListBox Style="{StaticResource CheckBoxListStyle}" Name="EditListBox"> <ListBox.ItemTemplate> <DataTemplate> <CheckBox Click="Checkbox_Click" IsChecked="{Binding Path=IsChecked, Mode=TwoWay}" Content="{Binding Path=DisplayText}" /> ...
[ 0.061419688165187836, 0.1137811467051506, 0.44786280393600464, -0.3451354503631592, -0.121575728058815, 0.009727702476084232, 0.05707897990942001, -0.30456143617630005, -0.16206558048725128, -0.9268835783004761, -0.02315532974898815, 0.27296116948127747, -0.5420669913291931, 0.261411458253...
be able to select one or many items in the list and use the spacebar to toggle the checkboxes on and off. Some more info: ``` private void Checkbox_Click(object sender, RoutedEventArgs e) { CheckBox chkBox = e.OriginalSource as CheckBox; } ``` In the code above when I click on a checkbox, e.Handled is false and...
[ -0.04979949817061424, 0.04367728531360626, 0.3196322023868561, 0.15383395552635193, -0.09994389861822128, 0.16227933764457703, 0.2103288620710373, -0.3285534977912903, -0.467761754989624, -0.8660820722579956, -0.19561269879341125, 0.15030857920646667, 0.015019819140434265, 0.02862013876438...
<CheckBox IsChecked="{Binding Path=IsChecked, Mode=TwoWay}" /> <TextBlock Text="{Binding DisplayText}"/> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> ``` I had to use PreviewKeyDown because by default when you hit the spacebar in a list box, it deselects eve...
[ -0.13409878313541412, -0.05870392546057701, 0.3143961727619171, -0.11352092027664185, -0.27191784977912903, -0.09353888779878616, 0.24399910867214203, -0.26455506682395935, -0.32174983620643616, -0.8397460579872131, -0.24949601292610168, 0.027064720168709755, -0.20279653370380402, 0.190069...
<TextBlock Text="{Binding DisplayText}"/> </StackPanel> ``` After that, you will need to ensure that pressing space on a `ListBoxItem` results in the `CheckBox` being checked. There are a number of ways of doing this, including a simple event handler on the `ListBoxItem`. Or you could specify a handler for `UIElement...
[ 0.025557948276400566, -0.027178894728422165, 0.46017324924468994, -0.12542042136192322, 0.09577921777963638, -0.3738225996494293, 0.11455817520618439, -0.2931545078754425, -0.34968823194503784, -0.6490159630775452, -0.5095332860946655, 0.4975317418575287, -0.1539342999458313, -0.1949761360...
So, I have Flex project that loads a Module using the ModuleManager - not the module loader. The problem that I'm having is that to load an external asset (like a video or image) the path to load that asset has to be relative to the Module swf...not relative to the swf that loaded the module. The question is - How can...
[ 0.2773608863353729, -0.17588822543621063, 0.0743759348988533, -0.1022900640964508, -0.16643881797790527, -0.32773658633232117, -0.13376949727535248, -0.18812422454357147, -0.44356876611709595, -0.608756422996521, 0.048269253224134445, 0.9600059390068054, -0.2576711177825928, 0.024747006595...
// make relative paths relative to the SWF loading it, not the top-level SWF if (!(url.indexOf(":") > -1 || url.indexOf("/") == 0 || url.indexOf("\\") == 0)) { var rootURL:String; if (SystemManagerGlobals.bootstrapLoaderInfoURL != null && SystemManagerGlobals.bootstrapLoaderInfoURL != "") ...
[ -0.30511853098869324, -0.34935975074768066, 0.42243340611457825, -0.3246118724346161, 0.323357492685318, 0.17803137004375458, 0.7915942072868347, -0.3973340392112732, -0.13674363493919373, -0.47535988688468933, -0.19997575879096985, 0.6491269469261169, -0.38929393887519836, 0.1439248323440...
rootURL = LoaderUtil.normalizeURL(root.loaderInfo); else if (systemManager) rootURL = LoaderUtil.normalizeURL(DisplayObject(systemManager).loaderInfo); if (rootURL) { var lastIndex:int = Math.max(rootURL.lastIndexOf("\\"), rootURL.lastIndexOf("/"));
[ -0.3960023820400238, -0.366377055644989, 0.5958495140075684, -0.3806219696998596, 0.18549813330173492, 0.3118732273578644, 0.5743325352668762, -0.1495104432106018, -0.09964878857135773, -0.5604053735733032, -0.3477902412414551, 0.5396212339401245, -0.1775035560131073, 0.0659957230091095, ...
if (lastIndex != -1) url = rootURL.substr(0, lastIndex + 1) + url; } } } ``` So apparently, Adobe has gone through the extra effort to make images load in the actual swf and not the top level swf (with no flag to choose otherwise...), so I guess I should submit a feat...
[ 0.283088356256485, -0.026449453085660934, 0.6932829022407532, -0.20853091776371002, -0.0760963186621666, -0.32978498935699463, 0.4480285942554474, -0.0790872871875763, -0.0933649018406868, -0.53839510679245, -0.33508768677711487, 0.6202154159545898, -0.1683150827884674, 0.181033656001091, ...
have some sort of "load relative to swf" flag, edit the SWFLoader directly, or maybe I should have everything relative to the individual swf and not the top level...any suggestions? You can import `mx.core.Application` and then use [Application.application.url](http://livedocs.adobe.com/flex/3/langref/mx/core/Applicati...
[ 0.5331422686576843, 0.1291188895702362, 0.5756605863571167, -0.05000944063067436, -0.3038766086101532, 0.0004747433413285762, 0.14821946620941162, -0.24981848895549774, -0.2518101632595062, -0.7207398414611816, -0.1787017583847046, 0.5598112940788269, -0.29990917444229126, 0.08448473364114...
I'm trying to generate customized xml files from a template xml file in python. Conceptually, I want to read in the template xml, remove some elements, change some text attributes, and write the new xml out to a file. I wanted it to work something like this: ``` conf_base = ConvertXmlToDict('config-template.xml') co...
[ 0.16715304553508759, 0.061035897582769394, 0.24199897050857544, -0.16799533367156982, -0.09240541607141495, -0.11441225558519363, -0.004446761682629585, -0.089228056371212, -0.11811260879039764, -0.7182703018188477, -0.05811913311481476, 0.14687049388885498, -0.1849215030670166, 0.15233647...
works something like this: Sample XML File: ``` <root> <level1>leaf1</level1> <level2>leaf2</level2> </root> ``` Python code: ``` from BeautifulSoup import BeautifulStoneSoup, Tag, NavigableString soup = BeautifulStoneSoup('config-template.xml') # get the parser for the xml file soup.contents[0].name # u'root...
[ -0.15406769514083862, -0.03998161479830742, 0.6456465125083923, 0.07230871915817261, -0.03253256902098656, -0.10793990641832352, 0.4075525999069214, -0.35114312171936035, -0.16972050070762634, -0.8339207172393799, -0.02939441427588463, 0.04495496302843094, -0.2055656462907791, -0.279528796...
When an error occurs in a function, I'd like to know the sequence of events that lead up to it, especially when that function is called from a dozen different places. Is there any way to retrieve the call stack in VB6, or do I have to do it the hard way (e.g., log entries in every function and error handler, etc.)? I'm...
[ 0.22635605931282043, 0.2239426225423813, -0.15412934124469757, 0.14504852890968323, 0.08486669510602951, -0.38120129704475403, 0.4054931402206421, -0.049378763884305954, -0.33903008699417114, -0.3913162648677826, -0.08408236503601074, 0.92106032371521, -0.1519687920808792, -0.1365317702293...
to be added to every method, so much that we had home-grown tools to insert it all for you. I can't provide too much insight on its implementation (both because I've forgotten most of it and there's a chance they may consider it a trade secret). One thing that does stand out was that the method name couldn't be derive...
[ 0.22526238858699799, -0.07656276226043701, 0.11995799839496613, 0.10827546566724777, 0.03425339609384537, -0.2243901938199997, 0.11242089420557022, -0.10719839483499527, -0.2791444659233093, -0.12811866402626038, 0.14637944102287292, 0.25569266080856323, -0.32452693581581116, 0.24970796704...
How do I view the grants (access rights) for a given user in MySQL? ``` mysql> show grants for 'user'@'host' ```
[ 0.5722445845603943, 0.36463895440101624, 0.33419427275657654, 0.2977387011051178, 0.16858530044555664, -0.28982752561569214, -0.13997958600521088, -0.20275649428367615, -0.024157386273145676, -0.5731894373893738, -0.049688100814819336, 0.18283584713935852, 0.16764120757579803, 0.2124184519...
I'm using VS2008 to debug an application that starts a new process. I believe that the spawned process is suffering (and handling) some kind of CLR exception during its start-up, but it is not being caught by turning on CLR Exception Notification in Debug -> Exceptions. Any suggestions on how I can see where the except...
[ 0.3944261074066162, 0.06187797710299492, 0.198513001203537, 0.18691053986549377, 0.11926919221878052, -0.600060760974884, 0.1642877608537674, 0.21014900505542755, -0.31770598888397217, -0.40424326062202454, -0.3665023446083069, 0.45380619168281555, -0.4391077160835266, 0.3197002410888672, ...
giving you the choice of using the running copy of VS2008 or a new copy) attached to the process. The same trick is handy for debugging Service startup issues.
[ 0.42842531204223633, -0.085691437125206, 0.36091315746307373, 0.4507257044315338, 0.27613142132759094, -0.3209807574748993, 0.5219146609306335, 0.03281245008111, -0.12937800586223602, -0.6848815679550171, -0.1909145563840866, 0.5710797309875488, -0.003293466055765748, 0.1663631647825241, ...
Greetings, currently I am refactoring one of my programs, and I found an interesting problem. I have Transitions in an automata. Transitions always have a start-state and an end-state. Some Transitions have a label, which encodes a certain Action that must be performed upon traversal. No label means no action. Some tr...
[ -0.003059371607378125, -0.2971639335155487, -0.16900360584259033, 0.18923360109329224, -0.11825552582740784, 0.15122202038764954, 0.3925863206386566, -0.18985719978809357, -0.2530781030654907, -0.7971236705780029, -0.11958453804254532, 0.05457768589258194, -0.42089253664016724, 0.096079945...
this label * add a label to a transition * check if the transition has a condition * get this condition * check for equality Judging from the first five points, this sounds like a clear decorator, with a base transition and two decorators: Labeled and Condition. However, this approach has a problem: two transitions ar...
[ 0.10324135422706604, -0.010443861596286297, 0.1707621067762375, -0.22058327496051788, -0.025941772386431694, 0.2418285608291626, 0.12268219888210297, -0.44443613290786743, 0.11976274102926254, -0.7553249001502991, -0.12270424515008926, 0.2474408894777298, -0.40637558698654175, 0.2395088076...
equality, that is, the decorators would need to collect all the data and the Transition must compare this collected data on a set-base: ``` class Transition(object): def __init__(self, start, end): self.start = start self.end = end def get_label(self): return None def has_label(self...
[ -0.09366586059331894, 0.24077589809894562, 0.16378375887870789, 0.019001439213752747, -0.10475993901491165, 0.2665260434150696, 0.27276477217674255, -0.6323967576026917, -0.23291577398777008, -0.7735482454299927, -0.33884772658348083, 0.4260595440864563, -0.31567496061325073, 0.09839341789...
other): try: return (self.start == other.start and self.end == other.end and my_decorations = other.collect_decorations()) def __eq__(self, other): return self.internal_equality(self.collect_decorations({}), other) class Labeled(object): def _...
[ -0.06362259387969971, -0.15425464510917664, 0.2617896497249603, 0.03901132196187973, 0.06719105690717697, 0.2310340851545334, 0.36848947405815125, -0.6184757351875305, -0.43183234333992004, -0.4745856821537018, -0.27081456780433655, 0.33864858746528625, -0.36567622423171997, 0.062722422182...
self.base = base self.label = label def has_label(self): return True def get_label(self): return self.label def collect_decorations(self, decorations): assert 'label' not in decorations decorations['label'] = self.label return self.base.collect_decorations(dec...
[ 0.5272786617279053, 0.41701626777648926, 0.3362061381340027, -0.13462918996810913, -0.22808107733726501, -0.16653716564178467, 0.3924758732318878, -0.884474515914917, -0.22646211087703705, -0.3594244718551636, -0.14921148121356964, 0.7565714716911316, -0.06030112877488136, -0.1705742180347...
missing something? I am mostly confused, because I can solve this - with longer class names - using cooperative multiple inheritance: ``` class Transition(object): def __init__(self, **kwargs): # init is pythons MI-madness ;-) super(Transition, self).__init__(**kwargs) self.start = kwargs[...
[ -0.0031727924942970276, -0.11412207037210464, -0.014257675968110561, -0.16722388565540314, 0.2321307510137558, -0.12952469289302826, 0.6153594255447388, -0.04212763532996178, -0.5522832870483398, -0.15573276579380035, -0.21386219561100006, 0.5776265859603882, -0.5196179747581482, 0.3645595...
def __eq__(self, other): try: return self.start == other.start and self.end == other.end except AttributeError: return False class LabeledTransition(Transition): def __init__(self, **kwargs): super(LabeledTransition).__init__(**kwargs) self.label = kwargs['la...
[ -0.1254129558801651, -0.12127577513456345, -0.09701787680387497, -0.14996950328350067, -0.049594298005104065, 0.06569434702396393, 0.7719532251358032, -0.5409455299377441, -0.15613983571529388, -0.3253836929798126, -0.34865662455558777, 0.6931182146072388, -0.2920502722263336, 0.2342550009...
super_result = super(LabeledTransition, self).__eq__(other) try: return super_result and self.label == other.label except AttributeError: return False class ConditionalTransition(Transition): def __init__(self, **kwargs): super(ConditionalTransition, self).__init__(*...
[ -0.10431305319070816, -0.29080402851104736, -0.03241227939724922, -0.14697584509849548, -0.028846174478530884, 0.22176414728164673, 0.8279368877410889, -0.48813772201538086, -0.2905195951461792, -0.33152535557746887, -0.44973841309547424, 0.5876310467720032, -0.35113924741744995, 0.2356270...
super_result = super(ConditionalTransition, self).__eq__(other) try: return super_result and self.condition = other.condition except AttributeError: return False # ConditionalTransition about the same, with get_condition class LabeledConditionalTransition(LabeledTransition, Cond...
[ -0.13485831022262573, -0.42331743240356445, 0.20395131409168243, 0.10511405766010284, -0.008594071492552757, 0.05305715277791023, 0.7041501402854919, -0.3810928165912628, -0.04550287500023842, -0.31804248690605164, -0.34674641489982605, 0.5447133779525757, -0.32279840111732483, -0.00493561...
would be to just hammer everything into a single transition class with a bunch of in has\_label/has\_transition. So... I am confused. Am I missing something? Which implementation looks better? How do you handle similar cases, that is, objects which look like a Decorator could handle them, but then, such a non-local me...
[ 0.13594041764736176, -0.07076440006494522, -0.12353043258190155, 0.014141150750219822, -0.1254420131444931, 0.05189898982644081, 0.3609670400619507, -0.15986193716526031, -0.1435946822166443, -0.5682623386383057, -0.14793623983860016, 0.4688904881477356, -0.36552590131759644, 0.18971441686...
nobody really understands your question. I would suggest putting it in context and making it shorter. As an example, here's one possible implementation of the state pattern in python, please study it to get an idea. ``` class State(object): def __init__(self, name): self.name = name def __repr__(self)...
[ -0.0271201953291893, 0.01583658717572689, -0.1706262081861496, 0.13598281145095825, 0.1436406970024109, 0.02596847340464592, 0.5610378384590149, -0.09563358873128891, -0.3392776846885681, -0.660265326499939, -0.43047845363616943, 0.6724836826324463, -0.40187764167785645, 0.1509190052747726...
return self._state def set_state(self, target): transition = self.transitions.get((self.state, target)) if transition: action, condition = transition if condition: if condition(): if
[ -0.08294527977705002, -0.571040689945221, 0.01773662678897381, -0.3177788555622101, 0.22455322742462158, 0.3718273341655731, 0.4037042558193207, -0.32592806220054626, -0.12748609483242035, -0.685798168182373, -0.30058205127716064, 0.3866176903247833, -0.47578710317611694, 0.004750493913888...
action: action() self._state = target else: self._state = target else: self._state = target
[ -0.19600433111190796, -0.3551061153411865, -0.23402981460094452, -0.3523041307926178, -0.27614206075668335, 0.5657939910888672, 0.3886956572532654, -0.4720112383365631, -0.611990749835968, -0.4115349352359772, -0.1423180252313614, 0.297969788312912, -0.5337488055229187, -0.1491930484771728...
state = property(get_state, set_state) class Door(object): open = State('open') closed = State('closed') def __init__(self, blocked=False): self.blocked = blocked def close(self): print 'closing door' def do_open(self): print 'opening door' def not_blocked(self): ...
[ -0.22680577635765076, -0.15715119242668152, -0.009013239294290543, -0.11147228628396988, 0.21048003435134888, 0.044203732162714005, 0.6821083426475525, -0.4152412414550781, -0.29318463802337646, -0.7141732573509216, -0.6415586471557617, 0.2897295653820038, -0.260905385017395, 0.44551071524...
(self.open, self.closed):(self.close, self.not_blocked), (self.closed, self.open):(self.do_open, self.not_blocked), } if __name__ == '__main__': door = Door() automaton = Automaton(door, door.open) print 'door is', automaton.state automaton.state = door.closed print 'door is', ...
[ -0.47241395711898804, 0.4153379499912262, 0.022455304861068726, -0.32510969042778015, 0.3868168294429779, 0.4963488280773163, 0.4055310785770416, -0.23980966210365295, -0.20686912536621094, -0.6639595627784729, -0.6238383054733276, 0.5955483913421631, -0.39083272218704224, 0.39968606829643...