text
stringlengths
0
30.5k
title
stringclasses
1 value
embeddings
listlengths
768
768
avoiding the condition that gives rise to the Rave Endless loop problem.
[ 0.7980824708938599, -0.16703741252422333, -0.042641956359148026, 0.35847440361976624, 0.1424117386341095, -0.37753427028656006, 0.4083488881587982, 0.07070032507181168, -0.2946394681930542, -0.22849200665950775, -0.08597707003355026, 0.35646283626556396, -0.6216055750846863, 0.016407297924...
I'm using a Java socket, connected to a server. If I send a HEADER http request, how can I measure the response time from the server? Must I use a provided java timer, or is there an easier way? I'm looking for a short answer, I don't want to use other protocols etc. Obviously do I neither want to have a solution that ties my application to a specific OS. Please people, IN-CODE solutions only. I would say it depends on what exact interval you are trying measure, the amount of time from the last byte of the request that you send
[ 0.2858823239803314, 0.025085223838686943, 0.18541161715984344, 0.08121374249458313, -0.2289421707391739, 0.004698007367551327, 0.44175291061401367, -0.12899217009544373, -0.16498592495918274, -0.8491884469985962, 0.14336088299751282, 0.40761446952819824, -0.3009192645549774, 0.022486835718...
until the first byte of the response that you receive? Or until the entire response is received? Or are you trying to measure the server-side time only? If you're trying to measure the server side processing time only, you're going to have a difficult time factoring out the amount of time spent in network transit for your request to arrive and the response to return. Otherwise, since you're managing the request yourself through a Socket, you can measure the elapsed time between any two moments by checking the System timer and computing the difference. For example: ``` public void sendHttpRequest(byte[] requestData, Socket connection)
[ 0.1628033071756363, -0.5124568939208984, 0.3525301516056061, -0.0007280785357579589, -0.14110347628593445, 0.03872097283601761, 0.28690579533576965, 0.0017944140126928687, -0.40036627650260925, -0.5912080407142639, -0.08952972292900085, 0.3085654079914093, -0.14517419040203094, 0.229777544...
{ long startTime = System.nanoTime(); writeYourRequestData(connection.getOutputStream(), requestData); byte[] responseData = readYourResponseData(connection.getInputStream()); long elapsedTime = System.nanoTime() - startTime; System.out.println("Total elapsed http request/response time in nanoseconds: " + elapsedTime); } ``` This code would measure the time from when you begin writing out your request to when you finish receiving the response, and print the result (assuming you have your specific read/write methods implemented).
[ -0.1178523600101471, -0.5074245929718018, 0.7578402161598206, -0.23051610589027405, 0.18891526758670807, 0.07254770398139954, 0.23505789041519165, -0.49220210313796997, -0.19711342453956604, -0.6746107339859009, -0.26418381929397583, 0.46376127004623413, -0.05230141803622246, 0.18003189563...
I've created an Access 2007 form that displays, for example, Products from a Product table. One of the fields in the Product table is a CategoryID that corresponds to this product's parent category. In the form, the CategoryID needs to be represented as a combo box that is bound to the Category table. The idea here is pretty straightforward: selecting a new Category should update the CategoryID in the Product table. The problem I'm running into is that selecting a new Category updates the CategoryName of the Category table instead of updating the CategoryID in the Product table. The reason for this
[ 0.018753869459033012, 0.1027267575263977, 0.3924483060836792, 0.05201101303100586, -0.0666847825050354, -0.06894957274198532, -0.24078194797039032, -0.09918395429849625, -0.1460038721561432, -0.5746898055076599, 0.07803457975387573, 0.5556610226631165, -0.20964939892292023, 0.4269683361053...
is that it seems that the combo box must be bound only to the CategoryName of the Category table. What happens is if the current product has a CategoryID of 12 which is the CategoryName "Chairs" in the Category table then selecting a new value, let's say "Tables" (CategoryID 13) in the combo box updates the CategoryID of 12 with the new CategoryName "Tables" instead of updating the Product table CategoryID to 13. How can I bind the Category table to a combox box so that the datatextfield (which I wish existed in Access) is the CategoryName and the datavaluefield is the
[ -0.06091077998280525, -0.032266516238451004, 0.5979058146476746, 0.009255316108465195, 0.023372037336230278, -0.15277142822742462, -0.13673008978366852, -0.5438991189002991, -0.23437944054603577, -0.5302945971488953, -0.1864846795797348, 0.5245510935783386, -0.2281348556280136, 0.209554329...
CategoryID and only the CategoryID of the Product will be updated when the selected combo box item is changed? **Edit:** See the accepted answer below. I also needed to change the column count to 2 and everything started to work perfectly. You need to use both values in the query for the combo box. e.g. SELECT CategoryId, CategoryName FROM CategoryTable... Bind the combo box to the fist column, CategoryId. Set the column widths for the combo box to 0in (no second value need, so there is no limit). This will hide the first column which contains your selected value; all that shows it
[ -0.13419607281684875, -0.2051069736480713, 0.6410689353942871, -0.008592121303081512, -0.34232231974601746, 0.12842650711536407, 0.12722143530845642, -0.619390606880188, -0.04825146123766899, -0.6633530855178833, 0.07504143565893173, 0.6107290983200073, -0.2030055671930313, 0.0735202133655...
the description value, which is all you want to see. So now when you select a different option in the combobox, the value returned by the combo box will be the bound value, CategoryId, not CategoryName. Ah, yes Alison, sorry, I forgot about setting the combobox columncount = 2.
[ -0.17840802669525146, -0.4213448464870453, 0.2534434497356415, 0.12182065099477768, -0.17337274551391602, 0.19272340834140778, 0.3234962821006775, 0.29891976714134216, -0.14554989337921143, -0.7188641428947449, -0.042366836220026016, 0.6088459491729736, -0.2698567509651184, 0.2408281713724...
Most of our Eclipse projects have multiple source folders, for example: * src/main/java * src/test/java When you right-click on a class and choose New JUnit Test, the default source folder for the new test is "src/main/java" (presumably the first source folder listed in the project properties). Is there any way to change the default source folder for new JUnit tests, so that when I do the above action, the new test will be created in say the "src/test/java" folder by default? I use [moreUnit](http://moreunit.sourceforge.net/), an Eclipse plugin to assist writing unit tests. Among other features, it lets you configure the default source folder of tests.
[ 0.815360426902771, 0.02033737488090992, -0.2819477915763855, 0.07798708975315094, -0.15769550204277039, -0.14003624022006989, 0.09769371151924133, -0.07195110619068146, 0.05678385868668556, -0.7953912019729614, 0.21178404986858368, 0.41527214646339417, -0.023506131023168564, -0.13345351815...
How can I split long commands over multiple lines in a batch file? You can break up long lines with the caret `^` as long as you remember that the caret and the newline following it are completely removed. So, if there should be a space where you're breaking the line, include a space. *([More on that below.](https://stackoverflow.com/a/21000752/157247))* Example: ``` copy file1.txt file2.txt ``` would be written as: ``` copy file1.txt^ file2.txt ```
[ 0.5421651601791382, -0.15453146398067474, 0.3642345368862152, -0.2343069612979889, 0.15804633498191833, 0.06483520567417145, 0.1399584263563156, -0.1605241447687149, -0.3405059278011322, -0.4789298176765442, -0.2622823715209961, 0.5007405281066895, -0.29087120294570923, 0.09253273159265518...
What is the best way to refactor the attached code to accommodate multiple email addresses? The attached HTML/jQuery is complete and works for the first email address. I can setup the other two by copy/pasting and changing the code. But I would like to just refactor the existing code to handle multiple email address fields. ``` <html> <head> <script src="includes/jquery/jquery-1.2.6.min.js" type="text/javascript"></script> <script language="javascript"> $(document).ready(function() { var validateUsername = $('#Email_Address_Status_Icon_1');
[ 0.05624474957585335, 0.13770607113838196, 0.7325599193572998, -0.10589855909347534, 0.091939277946949, -0.09758917987346649, -0.15145684778690338, -0.5895521640777588, 0.000913127267267555, -0.8112363815307617, -0.11261443793773651, 0.5718985199928284, -0.1368972808122635, -0.0613119676709...
$('#Email_Address_1').keyup(function() { var t = this; if (this.value != this.lastValue) { if (this.timer) clearTimeout(this.timer); validateUsername.removeClass('error').html('Validating Email');
[ -0.2147989273071289, -0.3001750409603119, 0.4877799451351166, -0.5823857188224792, 0.1836937516927719, -0.06840057671070099, 0.7001433372497559, -0.3200070559978485, 0.10353098064661026, -0.5649538636207581, -0.3724362850189209, 0.5280148386955261, -0.590248167514801, 0.13864433765411377, ...
this.timer = setTimeout(function() { if (IsEmail(t.value)) { validateUsername.html('Valid Email'); } else {
[ 0.10584960132837296, -0.22187401354312897, 0.6597962975502014, -0.276273250579834, 0.2386382669210434, -0.2374078780412674, 0.6777629852294922, -0.48695385456085205, 0.007397644221782684, -0.6119794845581055, -0.18877044320106506, 0.4652106761932373, -0.3760264217853546, 0.0237693320959806...
validateUsername.html('Not a valid Email'); }; }, 200); this.lastValue = this.value;
[ -0.23212756216526031, -0.060957565903663635, 0.8216397166252136, -0.31186366081237793, 0.3909696042537689, -0.14086128771305084, 0.6730802059173584, -0.20909704267978668, 0.14258547127246857, -0.540812075138092, -0.4085531234741211, 0.2744966745376587, -0.34039628505706787, 0.0934487357735...
} }); }); function IsEmail(email) { var regex = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; if (regex.test(email)) return true; else return false; } </script> </head> <body> <div>
[ -0.02899009734392166, -0.06329544633626938, 0.5514472723007202, -0.14563316106796265, 0.3270232379436493, 0.10631320625543594, 0.6067386269569397, -0.48075419664382935, 0.2773081362247467, -0.6688032746315002, -0.34858888387680054, 0.6517996788024902, -0.3614130914211273, -0.00486462377011...
<label for="Email_Address_1">Friend #1</label></div> <input type="text" ID="Email_Address_1"> <span id="Email_Address_Status_Icon_1"></span> </div> <div> <label for="Email_Address_2">Friend #2</label></div> <input type="text" id="Email_Address_2"> <span id="Email_Address_Status_Icon_2"></span> </div> <div> <label for="Email_Address_3">Friend #3</label></div> <input type="text" id="Email_Address_3"> <span id="Email_Address_Status_Icon_3"></span> </div> </form> </body> </html> ``` Instead of using IDs
[ -0.028611522167921066, 0.04985497146844864, 0.5155596137046814, 0.00172801548615098, -0.34819284081459045, -0.055711809545755386, 0.06097951903939247, -0.7917793989181519, -0.1281479001045227, -0.6330851316452026, -0.13244128227233887, 0.4327563941478729, -0.13789956271648407, -0.053899265...
for your email fields, you can give them each a class: ``` <div> <label for="Email_Address_1">Friend #1</label></div> <input type="text" class="email"> <span></span> </div> <div> <label for="Email_Address_2">Friend #2</label></div> <input type="text" class="email"> <span></span> </div> <div> <label for="Email_Address_3">Friend #3</label></div> <input type="text" class="email"> <span></span> </div> ``` Then, instead of selecting $("#Email\_Address\_Status\_Icon\_1"), you can select $("input.email"), which would give you a jQuery wrapped set of all input elements of class email. Finally, instead of referring to the status icon explicitly with an id, you could simply say: ``` $(this).next("span").removeClass('error').html('Validating Email'); ``` 'this' would be
[ -0.03571204096078873, -0.1825842708349228, 0.44259732961654663, -0.10726664215326309, -0.20419976115226746, 0.09648443013429642, 0.01427334826439619, -0.37748071551322937, -0.09664656221866608, -0.6724773049354553, -0.14452464878559113, 0.35376521944999695, -0.34558141231536865, -0.1609837...
the email field, so 'this.next()' would give you its next sibling. We apply the "span" selector on top of that just to be sure we're getting what we intend to. $(this).next() would work the same way. This way, you are referring to the status icon in a relative manner. Hope this helps!
[ 0.2033344954252243, -0.3377947509288788, 0.7756202816963196, 0.1426170915365219, -0.030180959030985832, 0.039208751171827316, 0.09586863964796066, 0.2964600920677185, -0.35741111636161804, -0.7869746088981628, 0.05623352527618408, 0.723124086856842, 0.08372244983911514, -0.0155709926038980...
In most C or C++ environments, there is a "debug" mode and a "release" mode compilation. Looking at the difference between the two, you find that the debug mode adds the debug symbols (often the -g option on lots of compilers) but it also disables most optimizations. In "release" mode, you usually have all sorts of optimizations turned on. Why the difference? Without any optimization on, the flow through your code is linear. If you are on line 5 and single step, you step to line 6. With optimization on, you can get instruction re-ordering, loop unrolling and
[ 0.16904518008232117, -0.04519038274884224, 0.11379865556955338, -0.026179837062954903, -0.047458238899707794, -0.06221861019730568, 0.23550912737846375, -0.25865650177001953, -0.31799060106277466, -0.28762543201446533, -0.5353498458862305, 0.6529660820960999, -0.7069084048271179, -0.126258...
all sorts of optimizations. For example: ``` void foo() { 1: int i; 2: for(i = 0; i < 2; ) 3: i++; 4: return; ``` In this example, without optimization, you could single step through the code and hit lines 1, 2, 3, 2, 3, 2, 4 With optimization on, you might get an execution path that looks like: 2, 3, 3, 4 or even just 4! (The function does nothing after all...) Bottom line, debugging code with optimization enabled can be a royal pain! Especially if you have large functions. Note that turning on optimization changes the code! In certain environment (safety
[ 0.0458795502781868, 0.10359121859073639, 0.2244642972946167, 0.007938023656606674, -0.005919132847338915, 0.22368167340755463, 0.3869149684906006, -0.16817840933799744, -0.4461592435836792, -0.43874144554138184, -0.1150367259979248, 0.715175986289978, -0.5720441341400146, 0.034303337335586...
critical systems), this is unacceptable and the code being debugged has to be the code shipped. Gotta debug with optimization on in that case. While the optimized and non-optimized code should be "functionally" equivalent, under certain circumstances, the behavior will change. Here is a simplistic example: ```` int* ptr = 0xdeadbeef; // some address to memory-mapped I/O device *ptr = 0; // setup hardware device while(*ptr == 1) { // loop until hardware device is done // do
[ 0.21944163739681244, -0.11547776311635971, 0.36189740896224976, 0.09659144282341003, 0.5122671127319336, -0.03929872810840607, 0.3127596080303192, -0.2650613784790039, -0.25286173820495605, -0.3329218029975891, -0.36494335532188416, 0.7876911163330078, -0.4331924021244049, 0.20038329064846...
something } ```` With optimization off, this is straightforward, and you kinda know what to expect. However, if you turn optimization on, a couple of things might happen: * The compiler might optimize the while block away (we init to 0, it'll never be 1) * Instead of accessing memory, pointer access might be moved to a register->No I/O Update * memory access might be cached (not necessarily compiler optimization related) In all these cases, the behavior would be drastically different and most likely wrong.
[ 0.009625175967812538, -0.155160591006279, 0.19910404086112976, 0.1485176533460617, 0.3260558545589447, -0.025837520137429237, 0.1484227478504181, 0.1648007184267044, -0.037480589002370834, -0.7733884453773499, -0.05321990326046944, 0.7724973559379578, -0.4060751497745514, 0.072175197303295...
I've recently started using Eclipse Ganymede CDT for C development and I couldn't like it more. I'm aware the learning curve could be sort of pronounced, therefore and with your help, my goal is to flatten it as much as possible. I'm looking for the best hacks, hints, tips, tricks, and best practices to really unleash the full power of the IDE. **Accurate Indexing** With CDT you should be sure to enable the "Full Indexing" option rather than the "Fast Indexing" default. It's not perceptibly slower on modern hardware and it does a much better job. In that vein, you should be
[ 0.32465365529060364, -0.11050719022750854, 0.2643169164657593, 0.4181821644306183, -0.12474985420703888, -0.29786956310272217, -0.13683351874351501, 0.33714309334754944, 0.08845460414886475, -0.8049330711364746, -0.011592418886721134, 0.9413224458694458, 0.08681777864694595, -0.19177331030...
sure to enable semantic highlighting. This isn't as important in C/C++ as it is in a language like Scala, but it's still extremely useful. **Streamlined Editing** Get used to using `Ctrl`+`O` and `Ctrl`+`Alt`+`H`. The former pops up an incrementally searchable outline view, while the latter opens the "Call Hierarchy" view and searches on the currently selected function. This is incredibly useful for tracing execution. `Ctrl`+`Shift`+`T` (Open Type) isn't exactly an "editing" combo per se, but it is equally important in my workflow. The C++ Open Type dialog not only allows incremental filtering by type, but also selecting of definition (`.h`) or declaration (`.cpp`)
[ -0.22494903206825256, -0.12946422398090363, 0.2862273156642914, 0.047410059720277786, -0.2087399810552597, -0.13767391443252563, 0.040919627994298935, -0.0685105249285698, -0.1612817943096161, -0.8980162739753723, -0.17975710332393646, 0.6286986470222473, -0.21479004621505737, -0.332264453...
and even filtering by element type (`typedef`, `struct`, `class`, etc). **Task Oriented Programming** Mylyn: never leave home without it. I just can't say enough about this tool. Every time I'm forced to do without it I find myself having to re-learn how to deal with all of the code noise. Very, very handy to have. **Stripped Down Views** The default Eclipse workspace layout is extremely inefficient both in space and in usability. Everyone has their favorite layout, take some time and find yours. I like to minimize (not necessarily close) everything except for Outline and keep the C/C++ Project Explorer docked in the sidebar
[ 0.27087345719337463, -0.10878397524356842, 0.16901199519634247, 0.08190350979566574, -0.30716100335121155, -0.10175098478794098, 0.09308640658855438, 0.13846176862716675, -0.1524481624364853, -0.9406390190124512, 0.0931415930390358, 0.5490617752075195, 0.1150985136628151, -0.10177081823348...
configured to precisely hide the Outline when expanded. In this way I can always keep the editor visible while simultaneously reducing the space used by views irrelevant to the current task.
[ 0.2549916207790375, -0.20460990071296692, 0.4162735641002655, -0.14681977033615112, 0.03136163204908371, 0.0032365729566663504, 0.02777327224612236, -0.07491584867238998, -0.1179426833987236, -0.9982149004936218, 0.11261039972305298, 0.7487545013427734, -0.15349535644054413, -0.07920353859...
I'm using the After Effects CS3 Javascript API to dynamically create and change text layers in a composition. Or at least I'm trying to because I can't seem to find the right property to change to alter the actual text of the TextLayer object. Hmm, must read docs harder next time. ``` var theComposition = app.project.item(1); var theTextLayer = theComposition.layers[1]; theTextLayer.property("Source Text").setValue("This text is from code"); ```
[ 0.426967054605484, 0.08642178028821945, 0.5456928610801697, -0.2915429174900055, -0.11718413978815079, -0.0298145841807127, 0.3338353633880615, -0.5652872920036316, -0.1183757558465004, -0.8791349530220032, -0.3293084502220154, 0.44284307956695557, -0.5044117569923401, 0.017064467072486877...
I am curious if anyone have used UnderC, Cint, Cling, Ch, or any other C++ interpreter and could share their experience. There is **[cling](http://cern.ch/cling) Cern's project** of C++ interpreter based on [clang](http://clang.llvm.org/) - it's *new approach* based on 20 years of experience in *ROOT cint* and it's quite stable and recommended by Cern guys. Here is nice [Google Talk: Introducing cling, a C++ Interpreter Based on clang/LLVM](http://www.youtube.com/watch?v=f9Xfh8pv3Fs).
[ 0.17546826601028442, 0.19040735065937042, 0.39565610885620117, -0.07024238258600235, -0.08509985357522964, -0.19040818512439728, -0.011991599574685097, 0.3068281412124634, -0.14304165542125702, -0.6406304240226746, -0.19031862914562225, 0.6706162095069885, -0.04269309714436531, 0.169878453...
At home we have a proxy server. At work we don't. Firefox irritates in this regard: whenever I launch it, it defaults to the proxy server. If I do Tools>Options>Settings and select "No proxy", no problem. However, if I shutdown Firefox and restart it, I have to do the Tools>Options>Settings thing all over again because the "No proxy" setting doesn't "stick". How do I make it stick? Alternatively, can someone suggest a bit of javascript that I can assign to a button on my toolbar which will toggle between the two states? Use [FoxyProxy](http://foxyproxy.mozdev.org/), much more flexible to configure
[ 0.4347550570964813, 0.2870015501976013, 0.19822226464748383, 0.0820283442735672, 0.1785067468881607, -0.08531317859888077, 0.10002250224351883, 0.0773523598909378, 0.05988030135631561, -0.6632293462753296, -0.2838062644004822, 0.35836735367774963, -0.2504151463508606, -0.018794741481542587...
I am working with an open-source UNIX tool that is implemented in C++, and I need to change some code to get it to do what I want. I would like to make the smallest possible change in hopes of getting my patch accepted upstream. Solutions that are implementable in standard C++ and do not create more external dependencies are preferred. Here is my problem. I have a C++ class -- let's call it "A" -- that currently uses fprintf() to print its heavily formatted data structures to a file pointer. In its print function, it also recursively calls the identically
[ 0.5015488862991333, 0.1900884211063385, 0.30087363719940186, -0.20702233910560608, -0.15595386922359467, -0.19108760356903076, -0.02377903088927269, -0.21040219068527222, -0.04047529771924019, -0.6835936903953552, 0.0209721177816391, 0.5134269595146179, -0.468648225069046, -0.0232497919350...
defined print functions of several member classes ("B" is an example). There is another class C that has a member std::string "foo" that needs to be set to the print() results of an instance of A. Think of it as a to\_str() member function for A. In pseudocode: ``` class A { public: ... void print(FILE* f); B b; ... }; ... void A::print(FILE *f) { std::string s = "stuff"; fprintf(f, "some %s", s); b.print(f); } class C { ... std::string foo; bool set_foo(std::str); ... } ... A a = new A(); C c = new C(); ... // wish i knew how
[ 0.4805114269256592, -0.09284190833568573, 0.317661851644516, -0.24400854110717773, 0.15008218586444855, -0.11206410080194473, 0.2048814296722412, -0.34961703419685364, -0.16145116090774536, -0.4640294909477234, -0.32511308789253235, 0.4067081809043884, -0.6132491230964661, 0.11145015805959...
to write A's to_str() c.set_foo(a.to_str()); ``` I should mention that C is fairly stable, but A and B (and the rest of A's dependents) are in a state of flux, so the less code changes necessary the better. The current print(FILE\* F) interface also needs to be preserved. I have considered several approaches to implementing A::to\_str(), each with advantages and disadvantages: 1. Change the calls to fprintf() to sprintf() * I wouldn't have to rewrite any format strings * print() could be reimplemented as: fprint(f, this.to\_str()); * But I would need to manually allocate char[]s, merge a lot of c strings , and finally convert the character
[ 0.22105038166046143, 0.023161904886364937, 0.1551976203918457, -0.36264437437057495, 0.06447487324476242, 0.053014952689409256, 0.2986488938331604, -0.3704065680503845, 0.02701300010085106, -0.555594265460968, -0.13079173862934113, 0.7303448915481567, -0.45335784554481506, -0.2104382663965...
array to a std::string 2. Try to catch the results of a.print() in a string stream * I would have to convert all of the format strings to << output format. There are hundreds of fprintf()s to convert :-{ * print() would have to be rewritten because there is no standard way that I know of to create an output stream from a UNIX file handle (though [this guy says it may be possible](http://synflood.at/blog/index.php?/archives/456-One-word-of-warning-about-stdio_filebuf.html)). 3. Use Boost's string [format library](http://www.boost.org/doc/libs/1_36_0/libs/format/doc/format.html) * More external dependencies. Yuck. * Format's syntax is different enough from printf() to be annoying:printf(format\_str, args) -> cout << boost::format(format\_str) % arg1 % arg2 %
[ 0.4067363142967224, -0.10189787298440933, 0.4946131408214569, -0.3561917841434479, -0.4069370627403259, -0.10083694010972977, 0.25843197107315063, -0.4595777094364166, -0.342027872800827, -0.42157962918281555, -0.03297624737024307, 0.592486560344696, -0.6055117845535278, -0.031844615936279...
etc 4. Use Qt's [QString::asprintf()](https://doc.qt.io/qt-5/qstring.html#asprintf%3E) * A different external dependency. So, have I exhausted all possible options? If so, which do you think is my best bet? If not, what have I overlooked? Thanks. I am using #3: the boost string format library - but I have to admit that I've never had any problem with the differences in format specifications. Works like a charm for me - and the external dependencies could be worse (a very stable library) Edited: adding an example how to use boost::format instead of printf: ``` sprintf(buffer, "This is a string with some %s and %d numbers", "strings", 42); ``` would be something like this with
[ 0.14541929960250854, 0.015848761424422264, 0.5158953666687012, -0.2849287986755371, -0.10229892283678055, -0.18482062220573425, 0.31345275044441223, -0.28083956241607666, 0.22643667459487915, -0.36490345001220703, 0.06806433945894241, 0.6838613748550415, -0.2887135148048401, -0.43718472123...
the boost::format library: ``` string = boost::str(boost::format("This is a string with some %s and %d numbers") %"strings" %42); ``` Hope this helps clarify the usage of boost::format I've used boost::format as a sprintf / printf replacement in 4 or 5 applications (writing formatted strings to files, or custom output to logfiles) and never had problems with format differences. There may be some (more or less obscure) format specifiers which are differently - but I never had a problem. In contrast I had some format specifications I couldn't really do with streams (as much as I remember)
[ -0.0006390390917658806, 0.034836672246456146, 0.4855893552303314, -0.051624931395053864, -0.3053683638572693, -0.1638469398021698, 0.19816511869430542, -0.09638607501983643, -0.034961674362421036, -0.4325724244117737, -0.331024706363678, 0.8212364912033081, -0.10320856422185898, -0.3979770...
I'm working on VS 2005 and something has gone wrong on my machine. Suddenly, out of the blue, I can no longer build deployment files. The build message is: ``` ERROR: An error occurred generating a bootstrapper: Invalid syntax. ERROR: General failure building bootstrapper ERROR: Unrecoverable build error ``` A quick Google search brings up the last 2 lines, but nobody in cyberspace has ever reported the first message before. (Hooray! I'm first at SOMETHING on the 'net!) Other machines in my office are able to do the build. My machine has been able to do the build before. I have no idea what changed that upset the delicate
[ 0.3076390027999878, 0.3036898374557495, 0.36381909251213074, -0.2900294363498688, -0.1322985738515854, -0.05544639378786087, 0.6775414943695068, 0.014797122217714787, -0.2563464939594269, -0.8365053534507751, 0.06998781859874725, 0.4716867506504059, -0.05892886593937874, 0.2225998044013977...
balance of things on my box. I have also tried all the traditional rituals i.e. closing Visual Studio, blowing away all the bin and obj folders, rebooting, etc. to no avail. For simplicity's sake, I created a little "Hello World" app with a deployment file. Herewith the build output: ``` ------ Build started: Project: HelloWorld, Configuration: Debug Any CPU ------ HelloWorld -> C:\Vault\Multi Client\Tests\HelloWorld\HelloWorld\bin\Debug\HelloWorld.exe ------ Starting pre-build validation for project 'HelloWorldSetup' ------ ------ Pre-build validation for project 'HelloWorldSetup' completed ------ ------ Build started: Project: HelloWorldSetup, Configuration: Debug ------ Building file 'C:\Vault\Multi Client\Tests\HelloWorld\HelloWorldSetup\Debug\HelloWorldSetup.msi'... ERROR: An error occurred generating a bootstrapper: Invalid syntax. ERROR: General failure building bootstrapper ERROR: Unrecoverable build error ========== Build: 1 succeeded
[ 0.10263405740261078, 0.03368213400244713, 0.379425585269928, 0.03864041715860367, 0.210262268781662, 0.45846524834632874, 0.23895595967769623, -0.1192888543009758, -0.3037416934967041, -0.46319252252578735, -0.21245266497135162, 0.767573356628418, -0.3302083909511566, 0.018903948366642, ...
or up-to-date, 1 failed, 0 skipped ========== ``` I am using: * MS Visual Studio 2005 Version 8.0.50727.762 (SP .050727-7600) * .NET Framework Version 2.0.50727 * OS: Windows XP Pro Again, I have no idea what changed. All I know is that one day everything was working fine; the next day I suddenly can't do any deployment builds at all (though all other projects still compile fine). I posted [this on MSDN](http://social.msdn.microsoft.com/forums/en-US/vssetup/thread/240c82e9-1696-4618-846c-aaae21427a52/) about a month ago, and they don't seem to know what's going on, either. Anyone have any idea what this is about? --- @Brad Wilson: Thanks, but if you read my original post, you'll see that I already
[ 0.5583190321922302, 0.23336733877658844, 0.2303583323955536, -0.15937621891498566, -0.08214856684207916, -0.21173204481601715, 0.8983551859855652, 0.12903611361980438, -0.41773539781570435, -0.4174245595932007, -0.11792979389429092, 0.8454129099845886, -0.38632968068122864, -0.053280401974...
did start an entire solution from scratch, and that didn't help. --- @deemer: I went through all the pain of uninstalling and reinstalling, even though I didn't have your recommended reading while waiting... and - Misery! - still the same error reappears. It seems that my computer has somehow been branded as unsuitable for doing deployment builds ever again. Does anyone have any idea where this "secret switch" might be? **SOLUTION!** Thanks to Michael Bleifer of Microsoft support - I installed .NET 2.0 SP1, and the problem was solved!
[ 0.392467737197876, 0.15241533517837524, -0.10848572850227356, 0.059250324964523315, 0.22431494295597076, -0.07115139067173004, 0.7490929365158081, 0.02032618783414364, -0.35194694995880127, -0.584912121295929, -0.2669094502925873, 0.46716564893722534, -0.06219585984945297, -0.1192795932292...
We need a good CMS that supports data clustering (managing and storing data on different servers). By "good" , I mean : reliable , minimum bugs , the faster the better. (Oh , and it should make coffee :) ) Yes … kitchen sink + community + support: Plone. Development heading very much in the right direction. Plone is in some ways a different creature from many other systems. Depending on the environment, ultra-high performance may require some attention but in the community there's great expertise to steer any attention that may be required. <http://plone.org/support> | Chat Room is a great venue for
[ 0.2512253522872925, 0.11921485513448715, 0.42396554350852966, 0.21334853768348694, 0.24944336712360382, -0.024981647729873657, 0.05106938257813454, 0.01210057269781828, -0.35826388001441956, -0.7605693340301514, -0.11133364588022232, 0.34762755036354065, 0.13070453703403473, -0.19297751784...
diverse and honest advice on this subject. We regularly steer people away from Plone -- when some other system will better suit their needs.
[ 0.47281843423843384, 0.20591327548027039, -0.3424499034881592, 0.013646446168422699, -0.010472827591001987, -0.0053000682964921, 0.3361510932445526, 0.34397345781326294, 0.08680474013090134, -0.5959599614143372, 0.02830587700009346, 0.48817431926727295, 0.41172266006469727, -0.007941002026...
What is the reason browsers do not correctly recognize: ``` <script src="foobar.js" /> <!-- self-closing script element --> ``` Only this is recognized: ``` <script src="foobar.js"></script> ``` Does this break the concept of XHTML support? Note: This statement is correct at least for all IE (6-8 beta 2). The non-normative appendix ‘HTML Compatibility Guidelines’ of the XHTML 1 specification says: [С.3. Element Minimization and Empty Element Content](http://www.w3.org/TR/xhtml1/#C_3) > Given an empty instance of an element whose content model is not `EMPTY` (for example, an empty title or paragraph) do not use the minimized form (e.g. use `<p> </p>` and not `<p />`). [XHTML DTD](http://www.w3.org/TR/xhtml1/dtds.html#a_dtd_XHTML-1.0-Strict) specifies script elements as: ``` <!-- script statements, which may include
[ -0.07027304917573929, 0.30647000670433044, 0.4464629590511322, -0.23630878329277039, -0.14990799129009247, -0.22652049362659454, 0.19524234533309937, -0.3094847798347473, -0.008702471852302551, -0.34489771723747253, -0.4851227402687073, 0.36389437317848206, -0.33982113003730774, -0.0982829...
CDATA sections --> <!ELEMENT script (#PCDATA)> ```
[ 0.04629529267549515, -0.07596097886562347, -0.20964795351028442, 0.16685143113136292, 0.08937137573957443, -0.37509164214134216, -0.24758437275886536, 0.15841075778007507, -0.0798480436205864, -0.501179575920105, -0.2972833812236786, 0.15535913407802582, -0.4386195242404938, -0.09936627000...
We're having problem with a huge number of legacy stored procedures at work. Do you guys recommend any tool the can help better understand those procedures? Some kind of reverse engineering that indentifies inter-procedure dependencies and/or procedure vs. tables dependencies. Can be a free or commercial tool. Thanks! Redgate has a rather expensive product called [SQL Dependency Tracker](http://www.red-gate.com/products/SQL_Dependency_Tracker/) that seems to fulfill the requirements.
[ 0.2467271387577057, -0.0669441893696785, 0.07741430401802063, 0.2588265538215637, 0.15043678879737854, -0.2976067066192627, 0.1756071150302887, 0.1823146939277649, -0.29041561484336853, -0.45034366846084595, 0.30126723647117615, 0.6879264116287231, -0.14225398004055023, -0.0290553290396928...
I'm new to Ruby, so I'm having some trouble understanding this weird exception problem I'm having. I'm using the ruby-aaws gem to access Amazon ECS: <http://www.caliban.org/ruby/ruby-aws/>. This defines a class Amazon::AWS:Error: ``` module Amazon module AWS # All dynamically generated exceptions occur within this namespace. # module Error # An exception generator class. # class AWSError attr_reader :exception def initialize(xml)
[ 0.24087266623973846, 0.1952333301305771, -0.07437269389629364, 0.13614626228809357, -0.37779170274734497, -0.014929884113371372, 0.5829370021820068, -0.14437884092330933, -0.09872015565633774, -0.4080888330936432, 0.20627963542938232, 0.4384482800960541, -0.2631090581417084, 0.165641114115...
err_class = xml.elements['Code'].text.sub( /^AWS.*\./, '' ) err_msg = xml.elements['Message'].text unless Amazon::AWS::Error.const_defined?( err_class ) Amazon::AWS::Error.const_set( err_class, Class.new( StandardError ) ) end ex_class = Amazon::AWS::Error.const_get( err_class )
[ 0.03202884644269943, -0.17214162647724152, 0.3306502401828766, 0.025634733960032463, 0.035899568349123, 0.18420939147472382, 0.7424426674842834, -0.45251771807670593, -0.1449877917766571, -0.6182121634483337, -0.43916982412338257, 0.5317469239234924, -0.34674695134162903, -0.09913502633571...
@exception = ex_class.new( err_msg ) end end end end end ``` This means that if you get an errorcode like `AWS.InvalidParameterValue`, this will produce (in its exception variable) a new class `Amazon::AWS::Error::InvalidParameterValue` which is a subclass of `StandardError`. Now here's where it gets weird. I have some code that looks like this: ``` begin do_aws_stuff rescue Amazon::AWS::Error => error puts "Got an AWS error" end ``` Now, if `do_aws_stuff` throws a `NameError`, my rescue block gets triggered. It seems that Amazon::AWS::Error isn't the superclass of the
[ 0.2934202253818512, 0.11961386352777481, 0.04252856969833374, 0.17273518443107605, -0.1372397243976593, -0.4363827705383301, 0.7319969534873962, -0.012414665892720222, -0.1324263960123062, -0.5709410309791565, 0.04406822845339775, 0.29546234011650085, -0.2967361509799957, 0.362122297286987...
generated error - I guess since it's a module everything is a subclass of it? Certainly if I do: ``` irb(main):007:0> NameError.new.kind_of?(Amazon::AWS::Error) => true ``` It says `true`, which I find confusing, especially given this: ``` irb(main):009:0> NameError.new.kind_of?(Amazon::AWS) => false ``` What's going on, and how am I supposed to separate out AWS errors from other type of errors? Should I do something like: ``` begin do_aws_stuff rescue => error if error.class.to_s =~ /^Amazon::AWS::Error/ puts "Got an AWS error" else raise error end end ``` That seems exceptionally janky. The errors thrown aren't class AWSError either - they're raised like this: ``` error = Amazon::AWS::Error::AWSError.new( xml ) raise error.exception ``` So
[ -0.000669499218929559, -0.005954023450613022, 0.17505814135074615, 0.25532224774360657, -0.25636300444602966, -0.2619659900665283, 0.46039697527885437, -0.006014669314026833, -0.11148054152727127, -0.4514344334602356, 0.05988798663020134, 0.5878007411956787, -0.23656077682971954, 0.2942966...
the exceptions I'm looking to `rescue` from are the generated exception types that only inherit from StandardError. To clarify, I have two questions: 1. Why is NameError, a Ruby built in exception, a `kind_of?(Amazon::AWS::Error)`, which is a module? **Answer:** I had said `include Amazon::AWS::Error` at the top of my file, thinking it was kind of like a Java import or C++ include. What this actually did was add everything defined in `Amazon::AWS::Error` (present and future) to the implicit Kernel class, which is an ancestor of every class. This means **anything** would pass `kind_of?(Amazon::AWS::Error)`. 2. How can I best distinguish the dynamically-created exceptions
[ 0.14868278801441193, 0.17528122663497925, -0.21470461785793304, 0.14435604214668274, -0.17548075318336487, -0.15735413134098053, 0.41574177145957947, -0.13238440454006195, -0.19861054420471191, -0.4827059805393219, 0.0382964089512825, 0.36473292112350464, -0.4598451554775238, 0.25364443659...
in `Amazon::AWS::Error` from random other exceptions from elsewhere? Ok, I'll try to help here : First a module is not a class, it allows you to mix behaviour in a class. second see the following example : ``` module A module B module Error def foobar puts "foo" end end end end class StandardError include A::B::Error end StandardError.new.kind_of?(A::B::Error) StandardError.new.kind_of?(A::B) StandardError.included_modules #=> [A::B::Error,Kernel] ``` kind\_of? tells you that yes, Error does possess All of A::B::Error behaviour (which is normal since it includes A::B::Error) however it
[ 0.3881126642227173, -0.02262653410434723, 0.0775035098195076, -0.09542130678892136, -0.11346033960580826, -0.32339605689048767, 0.5055102109909058, -0.620586633682251, -0.1396850198507309, -0.39077121019363403, -0.022807767614722252, 0.6695681810379028, -0.667712926864624, 0.06945190578699...
does not include all the behaviour from A::B and therefore is not of the A::B kind. (duck typing) Now there is a very good chance that ruby-aws reopens one of the superclass of NameError and includes Amazon::AWS:Error in there. (monkey patching) You can find out programatically where the module is included in the hierarchy with the following : ``` class Class def has_module?(module_ref) if self.included_modules.include?(module_ref) and not self.superclass.included_modules.include?(module_ref) puts self.name+" has
[ 0.46433523297309875, 0.11700837314128876, -0.17408739030361176, -0.2949599027633667, -0.1399492770433426, -0.267229288816452, 0.8222190737724304, -0.04542022943496704, -0.6067734360694885, -0.45755675435066223, -0.0983094647526741, 0.2846328020095825, -0.45618605613708496, 0.16987998783588...
module "+ module_ref.name else self.superclass.nil? ? false : self.superclass.has_module?(module_ref) end end end StandardError.has_module?(A::B::Error) NameError.has_module?(A::B::Error) ``` Regarding your second question I can't see anything better than ``` begin #do AWS error prone stuff rescue Exception => e if Amazon::AWS::Error.constants.include?(e.class.name) #awsError else whatever end end ``` (edit -- above code doesn't work as is : name includes module prefix which is not the case of the constants arrays. You should definitely contact
[ 0.4338747262954712, -0.06938563287258148, 0.4983017146587372, 0.023030798882246017, -0.0007501188083551824, -0.3176620304584503, 0.552672266960144, -0.40319955348968506, -0.14661484956741333, -0.6502231955528259, -0.12199073284864426, 0.721538245677948, -0.3474189341068268, 0.1904334574937...
the lib maintainer the AWSError class looks more like a factory class to me :/ ) I don't have ruby-aws here and the caliban site is blocked by the company's firewall so I can't test much further. Regarding the include : that might be the thing doing the monkey patching on the StandardError hierarchy. I am not sure anymore but most likely doing it at the root of a file outside every context is including the module on Object or on the Object metaclass. (this is what would happen in IRB, where the default context is Object, not sure about in
[ 0.45669034123420715, 0.1596880555152893, -0.07551044970750809, -0.23061054944992065, -0.3197363317012787, -0.2697731852531433, 0.561188280582428, 0.0949147567152977, -0.1521548181772232, -0.36816906929016113, 0.008260250091552734, 0.7400678992271423, -0.5409308671951294, 0.1124876961112022...
a file) from the [pickaxe on modules](http://www.rubycentral.com/pickaxe/tut_modules.html) : `A couple of points about the include statement before we go on. First, it has nothing to do with files. C programmers use a preprocessor directive called #include to insert the contents of one file into another during compilation. The Ruby include statement simply makes a reference to a named module. If that module is in a separate file, you must use require to drag that file in before using include.` (edit -- I can't seem to be able to comment using this browser :/ yay for locked in platforms)
[ 0.8464237451553345, 0.09550154209136963, -0.25877371430397034, -0.28908807039260864, 0.02296082302927971, -0.30244186520576477, 0.15718597173690796, -0.45560893416404724, -0.1993979513645172, -0.1977950632572174, -0.26326847076416016, 0.4228924512863159, -0.5688473582267761, 0.150678038597...
I've been looking for a way to convert an mp3 to aac programmatically or via the command line with no luck. Ideally, I'd have a snippet of code that I could call from my rails app that converts an mp3 to an aac. I installed ffmpeg and libfaac and was able to create an aac file with the following command: `ffmpeg -i test.mp3 -acodec libfaac -ab 163840 dest.aac` When i change the output file's name to dest.m4a, it doesn't play in iTunes. Thanks! [FFmpeg](http://en.wikipedia.org/wiki/Ffmpeg) provides AAC encoding facilities if you've compiled them in. If you are using Windows you can grab full binaries
[ 0.3028091490268707, 0.1746935248374939, 0.05978350341320038, 0.0844283178448677, -0.3605789542198181, 0.10071860253810883, 0.47874999046325684, -0.10154003649950027, -0.27487167716026306, -0.6172752976417542, -0.10613211244344711, 0.885882556438446, -0.49035465717315674, -0.078972168266773...
from [here](http://arrozcru.no-ip.org/ffmpeg_builds/) ``` ffmpeg -i source.mp3 -acodec libfaac -ab 128k dest.aac ``` I'm not sure how you would call this from ruby. Also, be sure to set the bitrate appropriately.
[ 0.24674434959888458, 0.2555200457572937, 0.12567704916000366, -0.07354681193828583, -0.36128953099250793, -0.1398879438638687, 0.43967676162719727, -0.2337884157896042, -0.09251800179481506, -0.6747933626174927, -0.14658960700035095, 0.7647464871406555, -0.17981721460819244, -0.00111133221...
As we all know numbers can be written either in numerics, or called by their names. While there are a lot of examples to be found that convert 123 into one hundred twenty three, I could not find good examples of how to convert it the other way around. Some of the caveats: 1. cardinal/nominal or ordinal: "one" and "first" 2. common spelling mistakes: "forty"/"fourty" 3. hundreds/thousands: 2100 -> "twenty one hundred" and also "two thousand and one hundred" 4. separators: "eleven hundred fifty two", but also "elevenhundred fiftytwo" or "eleven-hundred fifty-two" and whatnot 5. colloquialisms: "thirty-something" 6. fractions: 'one third', 'two fifths' 7. common names: 'a dozen',
[ 0.26244911551475525, 0.2649906575679779, 0.15602847933769226, 0.018898747861385345, -0.4758922755718231, 0.40990114212036133, 0.11259865015745163, -0.1281394213438034, -0.16096319258213043, -0.6568070650100708, 0.19835925102233887, 0.4028494954109192, 0.22190311551094055, -0.10615422576665...
'half' And there are probably more caveats possible that are not yet listed. Suppose the algorithm needs to be very robust, and even understand spelling mistakes. What fields/papers/studies/algorithms should I read to learn how to write all this? Where is the information? > PS: My final parser should actually understand 3 different languages, English, Russian and Hebrew. And maybe at a later stage more languages will be added. Hebrew also has male/female numbers, like "one man" and "one woman" have a different "one" — "ehad" and "ahat". Russian also has some of its own complexities. Google does a great job at this. For example: <http://www.google.com/search?q=two+thousand+and+one+hundred+plus+five+dozen+and+four+fifths+in+decimal> (the reverse is
[ 0.06364410370588303, 0.15385718643665314, 0.07135296612977982, -0.276885449886322, -0.45016223192214966, 0.5334851145744324, 0.27989211678504944, -0.12050426751375198, 0.20742599666118622, -0.42525309324264526, -0.3022899925708771, 0.18029052019119263, -0.06141392141580582, 0.1325393766164...
also possible <http://www.google.com/search?q=999999999999+in+english>) I was playing around with a PEG parser to do what you wanted (and may post that as a separate answer later) when I noticed that there's a very simple algorithm that does a remarkably good job with common forms of numbers in English, Spanish, and German, at the very least. Working with English for example, you need a dictionary that maps words to values in the obvious way: ``` "one" -> 1, "two" -> 2, ... "twenty" -> 20, "dozen" -> 12, "score" -> 20, ... "hundred" -> 100, "thousand" -> 1000, "million" -> 1000000 ``` ...and so forth The algorithm is just: ``` total = 0 prior
[ -0.08958738297224045, 0.049978017807006836, 0.20773786306381226, 0.41995978355407715, -0.05600817874073982, 0.380705326795578, 0.063971608877182, -0.2143021523952484, -0.426988810300827, -0.5026781558990479, 0.1866329163312912, 0.37914806604385376, 0.22337830066680908, 0.0734916627407074, ...
= null for each word w v <- value(w) or next if no value defined prior <- case when prior is null: v when prior > v: prior+v else prior*v else if w in {thousand,million,billion,trillion...}
[ 0.15286785364151, -0.2223300188779831, 0.23043018579483032, -0.14661750197410583, -0.23652033507823944, 0.5034351348876953, 0.6946777701377869, -0.31045687198638916, -0.002034989884123206, -0.4758451581001282, -0.2556442618370056, 0.22562961280345917, 0.07387329638004303, 0.629069924354553...
total <- total + prior prior <- null total = total + prior unless prior is null ``` For example, this progresses as follows: ``` total prior v unconsumed string 0 _ four score and seven 4 score
[ -0.21546508371829987, -0.005181771703064442, 0.36750301718711853, -0.16543230414390564, -0.33869460225105286, 0.2637743353843689, 0.4485313296318054, -0.6151617169380188, -0.5245496034622192, 0.21482625603675842, -0.0750252828001976, 0.6465816497802734, 0.01054356712847948, 0.3460491597652...
and seven 0 4 20 and seven 0 80 _ seven 0
[ -0.06352227181196213, 0.2980711758136749, 0.3446640074253082, -0.28393781185150146, -0.2204100489616394, 0.6293922066688538, 0.17511509358882904, 0.19451609253883362, -0.5498006343841553, -0.5767269730567932, 0.36271047592163086, 0.5421600341796875, -0.1265028566122055, 0.20257750153541565...
80 7 0 87 87 total prior v unconsumed string 0 _ two million four hundred twelve thousand eight hundred seven
[ -0.031883832067251205, 0.339762419462204, 0.38979044556617737, -0.10425160080194473, -0.05931685492396355, 0.45871701836586, 0.17654691636562347, 0.16374026238918304, -0.18646612763404846, -0.07142817229032516, 0.1576991230249405, 0.8178043365478516, 0.050864968448877335, 0.527590453624725...
2 million four hundred twelve thousand eight hundred seven 0 2 1000000 four hundred twelve thousand eight hundred seven 2000000 _ 4 hundred twelve thousand eight hundred
[ -0.020123695954680443, 0.35883039236068726, 0.21228280663490295, 0.11633338779211044, -0.2695285677909851, 0.6348711252212524, 0.22035571932792664, 0.4425630569458008, -0.29061856865882874, -0.5179440975189209, 0.34273695945739746, 0.6770747303962708, 0.16888201236724854, 0.639216899871826...
seven 2000000 4 100 twelve thousand eight hundred seven 2000000 400 12 thousand eight hundred seven 2000000 412 1000 eight hundred seven 2000000 412000
[ -0.07822845131158829, 0.26718437671661377, -0.080003522336483, 0.3356499671936035, -0.37150710821151733, 0.7045244574546814, 0.4117971360683441, 0.44360485672950745, -0.4227357804775238, -0.47801604866981506, 0.2136732041835785, 0.5554614663124084, 0.2770620286464691, 0.5868479609489441, ...
1000 eight hundred seven 2412000 _ 8 hundred seven 2412000 8 100 seven 2412000 800
[ -0.3612985610961914, 0.2777305543422699, 0.44198077917099, 0.10545958578586578, -0.1467740386724472, 0.6758198738098145, 0.3949264883995056, 0.4807935953140259, -0.4808371663093567, -0.5594638586044312, 0.46312960982322693, 0.7376267910003662, 0.1345701366662979, 0.2593008279800415, 0.15...
7 2412000 807 2412807 ``` And so on. I'm not saying it's perfect, but for a quick and dirty it does quite well. --- Addressing your specific list on edit: 1. cardinal/nominal or ordinal: "one" and "first" -- **just put them in the dictionary** 2. english/british: "fourty"/"forty" -- **ditto** 3. hundreds/thousands: 2100 -> "twenty one hundred" and also "two thousand and one hundred" -- **works as is** 4. separators: "eleven hundred fifty two", but also "elevenhundred fiftytwo" or "eleven-hundred fifty-two" and whatnot -- **just define "next word" to be the longest prefix that matches a defined word, or up to the next non-word if none do,
[ 0.1879269927740097, 0.3601784110069275, 0.5973476767539978, -0.0835285633802414, -0.19727298617362976, 0.2991754710674286, 0.1764380931854248, 0.0032423697412014008, -0.12790824472904205, -0.7132960557937622, 0.02508101612329483, 0.5759893655776978, 0.3091883361339569, -0.14979635179042816...
for a start** 5. colloqialisms: "thirty-something" -- **works** 6. fragments: 'one third', 'two fifths' -- **uh, not yet...** 7. common names: 'a dozen', 'half' -- **works; you can even do things like "a half dozen"** Number 6 is the only one I don't have a ready answer for, and that's because of the ambiguity between ordinals and fractions (in English at least) added to the fact that my last cup of coffee was *many* hours ago.
[ 0.2672507166862488, 0.272765576839447, 0.39317992329597473, -0.03993420675396919, -0.42535820603370667, 0.2850185036659241, 0.10070418566465378, -0.19924138486385345, -0.38578370213508606, -0.3147738575935364, -0.07606112211942673, 0.13816691935062408, 0.4656656086444855, 0.154457211494445...
I want to highlight C/C++/Java/C# etc source codes in my website. How can I do this? Is it a CPU intensive job to highlight the source code? You can either do this server-side or client-side. It's not very processor intensive, but if you do it client side (using Javascript) there will be a noticeable lag. Most client side solutions revolve around Google Code's syntax highlighting engine. This seems to be the most popular one: [SyntaxHighlighter](http://alexgorbatchev.com/SyntaxHighlighter/) Server-side solutions tend to be more flexible, especially in the way of defining new languages and configuring how they are highlighted (e.g. colors used). I use GeSHi, which is
[ 0.2192390412092209, 0.1366201937198639, 0.19623702764511108, -0.19094645977020264, -0.40440505743026733, 0.004901411943137646, 0.07442910224199295, 0.1953231245279312, -0.08613909780979156, -0.8496654033660889, -0.19410477578639984, 0.3949843943119049, -0.3227047622203827, -0.1145852357149...
a PHP solution with a moderately nice plugin for Wordpress. There are also a few libraries built for Java, and even some that are based upon VIM (usually requiring a Perl module to be installed from CPAN). In short: you have quite a few options, what are your criteria? It's hard to make a solid recommendation without knowing your requirements.
[ 0.2410576194524765, -0.01871608756482601, 0.12212289869785309, 0.304022878408432, -0.032941728830337524, -0.2490423023700714, 0.1506696492433548, -0.1024976596236229, -0.22127458453178406, -0.4284801185131073, 0.15409699082374573, 0.29632076621055603, -0.1810207962989807, -0.28106155991554...
In Java, you often see a META-INF folder containing some meta files. What is the purpose of this folder and what can I put there? Generally speaking, you should not put anything into META-INF yourself. Instead, you should rely upon whatever you use to package up your JAR. This is one of the areas where I think Ant really excels: specifying JAR file manifest attributes. It's very easy to say something like: ``` <jar ...> <manifest> <attribute name="Main-Class" value="MyApplication"/> </manifest> </jar> ``` At least, I think that's easy... :-) The point is that META-INF
[ 0.058030106127262115, 0.09793011844158173, -0.23729409277439117, -0.2815130650997162, -0.5392208695411682, -0.07296671718358994, 0.29492807388305664, -0.09458199143409729, -0.18902303278446198, -1.0034208297729492, 0.3049456477165222, 0.26351198554039, -0.7365503311157227, -0.1453779339790...
should be considered an internal Java *meta* directory. Don't mess with it! Any files you want to include with your JAR should be placed in some other sub-directory or at the root of the JAR itself.
[ 0.5660118460655212, 0.35025256872177124, -0.2616193890571594, 0.105839803814888, -0.08583161234855652, -0.27612289786338806, 0.5139166712760925, 0.12165313959121704, -0.1495075672864914, -0.4275028109550476, 0.07658661901950836, 0.3560420870780945, -0.36512434482574463, 0.20003733038902283...
I have a structure in C#: ``` public struct UserInfo { public string str1 { get; set; } public string str2 { get; set; } } ``` The only rule is that `UserInfo(str1="AA", str2="BB").Equals(UserInfo(str1="BB", str2="AA"))` How to override the GetHashCode function for this structure? [MSDN](http://msdn.microsoft.com/en-us/library/system.object.gethashcode.aspx): A hash function must have the following properties: > * If two objects compare as equal, the `GetHashCode` method for each object must return the same value. However, if two objects do not compare
[ -0.07479748129844666, 0.4493948817253113, 0.6022024154663086, -0.2526935338973999, 0.016294047236442566, -0.12447305023670197, 0.21846945583820343, -0.41303569078445435, 0.1127016544342041, -0.7007232904434204, 0.03261251375079155, 0.25152722001075745, -0.44807812571525574, 0.2909287214279...
as equal, the `GetHashCode` methods for the two object do not have to return different values. > * The `GetHashCode` method for an object must consistently return the same hash code as long as there is no modification to the object state that determines the return value of the object's `Equals` method. Note that this is true only for the current execution of an application, and that a different hash code can be returned if the application is run again. > * For the best performance, a hash function must generate a random distribution for all input. Taking it into account correct way
[ -0.18492494523525238, 0.0812305361032486, 0.3712159991264343, 0.05063333362340927, -0.1732484996318817, -0.05881527438759804, 0.31212660670280457, -0.36845529079437256, -0.18393410742282867, -0.5408165454864502, 0.04407608509063721, 0.44010064005851746, -0.35261204838752747, 0.146540820598...
is: ``` return str1.GetHashCode() ^ str2.GetHashCode() ``` `^` can be substituted with other commutative operation
[ -0.2423933893442154, 0.11196932196617126, 0.2705213129520416, -0.4038420021533966, -0.16458012163639069, 0.01129261963069439, 0.12175560742616653, -0.38002726435661316, 0.12424822151660919, -0.017103098332881927, -0.6308764815330505, 0.4620645046234131, -0.6118782758712769, -0.303986668586...
Experienced with Rails / ActiveRecord 2.1.1 * You create a first version with (for example) ruby script\generate scaffold product title:string description:text image\_url:string * This create (for example) a migration file called 20080910122415\_create\_products.rb * You apply the migration with rake db:migrate * Now, you add a field to the product table with ruby script\generate migration add\_price\_to\_product price:decimal * This create a migration file called 20080910125745\_add\_price\_to\_product.rb * If you try to run rake db:migrate, it will actually revert the first migration, not apply the next one! So your product table will get destroyed! * But if you ran rake alone, it would have told you that one migration was
[ -0.00465372484177351, -0.0009837899124249816, 0.31103751063346863, -0.1585671752691269, 0.020272189751267433, -0.25313088297843933, 0.36310848593711853, -0.5278670191764832, -0.021292444318532944, -0.5153319239616394, 0.22081135213375092, 0.8056468963623047, -0.3043666183948517, 0.03878031...
pending Pls note that applying rake db:migrate (once the table has been destroyed) will apply all migrations in order. The only workaround I found is to specify the version of the new migration as in: ``` rake db:migrate version=20080910125745 ``` So I'm wondering: is this an expected new behavior? You should be able to use ``` rake db:migrate:up ``` to force it to go forward, but then you risk missing interleaved migrations from other people on your team if you run ``` rake db:migrate ``` twice, it will reapply all your migrations. I encounter the same behavior on windows with SQLite, it might be a bug specific to such an environment. **Edit** --
[ -0.06411462277173996, 0.2492866814136505, 0.5988696813583374, -0.017447713762521744, 0.0066858502104878426, -0.05808161571621895, 0.06557778269052505, -0.28419438004493713, -0.4242957830429077, -0.7480049133300781, -0.06153634190559387, 0.5831748843193054, -0.22960920631885529, 0.275157958...
I found why. In the railstie database.rake task you have the following code : ``` desc "Migrate the database through scripts in db/migrate. Target specific version with VERSION=x. Turn off output with VERBOSE=false." task :migrate => :environment do ActiveRecord::Migration.verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true ActiveRecord::Migrator.migrate("db/migrate/", ENV["VERSION"] ? ENV["VERSION"].to_i : nil) Rake::Task["db:schema:dump"].invoke if ActiveRecord::Base.schema_format == :ruby end ``` Then in my environment variables I have ``` echo %Version% #=> V3.5.0f ``` in Ruby ``` ENV["VERSION"] # => V3.5.0f ENV["VERSION"].to_i #=>0 not nil ! ``` thus the rake task calls ``` ActiveRecord::Migrator.migrate("db/migrate/", 0) ``` and in ActiveRecord::Migrator we have : ``` class Migrator#:nodoc: class << self def migrate(migrations_path, target_version =
[ -0.1790183186531067, 0.08696993440389633, 0.38650593161582947, 0.03246426209807396, -0.06815110146999359, 0.028995586559176445, 0.350456565618515, -0.44739001989364624, -0.03361257165670395, -0.7791631817817688, 0.03214908391237259, 0.691051721572876, -0.12170781940221786, 0.14712429046630...
nil) case when target_version.nil? then up(migrations_path, target_version) when current_version > target_version then down(migrations_path, target_version) else up(migrations_path, target_version) end
[ -0.2388184368610382, -0.14261287450790405, 0.6192585825920105, -0.059908099472522736, 0.31529226899147034, 0.1946416199207306, -0.169600248336792, -0.12731143832206726, -0.4001294672489166, -0.9101407527923584, -0.21067935228347778, 0.3378937840461731, -0.21667349338531494, 0.6772742867469...
end ``` Yes, `rake db:migrate VERSION=0` is the long version for `rake db:migrate:down` **Edit** - I would go update the lighthouse bug but I the super company proxy forbids that I connect there In the meantime you may try to unset Version before you call migrate ...
[ 0.4140136241912842, 0.2813026010990143, 0.7846954464912415, -0.15170635282993317, -0.021074166521430016, -0.39040637016296387, 0.24507415294647217, -0.016034452244639397, 0.09596763551235199, -0.6569327116012573, 0.026478413492441177, 0.7305198311805725, -0.10279802232980728, 0.27117329835...
Are System.IO.Compression.GZipStream or System.IO.Compression.Deflate compatible with zlib compression? From [MSDN](http://msdn.microsoft.com/en-us/library/system.io.compression.gzipstream.aspx) about System.IO.Compression.GZipStream: > This class represents the gzip data format, which uses an industry standard algorithm for lossless file compression and decompression. From the [zlib FAQ](http://www.gzip.org/zlib/zlib_faq.html): > The gz\* functions in zlib on the other hand use the gzip format. So zlib and GZipStream should be interoperable, but only if you use the zlib functions for handling the gzip-format. System.IO.Compression.Deflate and zlib are reportedly not interoperable. If you need to handle zip files (you probably don't, but someone else might need this) you need to use [SharpZipLib](http://www.icsharpcode.net/OpenSource/SharpZipLib/Default.aspx) or another third-party library.
[ 0.060284122824668884, -0.053911350667476654, 0.29230794310569763, 0.029450979083776474, -0.03816738724708557, -0.013583892956376076, -0.10022605210542679, -0.24967682361602783, -0.14772699773311615, -0.9590910077095032, -0.42617619037628174, 0.42393186688423157, -0.6041169762611389, 0.1776...
I'm trying out ASP.NET MVC routing and have of course stumbled across a problem. I have a section, /Admin/Pages/, and this is also accessible through /Pages/, which it shouldn't. What could I be missing? The routing code in global.asax: ``` public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "Pages", // Route name "Admin/Pages/{action}/{id}", // URL with parameters
[ -0.09318788349628448, 0.00830878410488367, 0.4434310793876648, 0.0049498374573886395, -0.048406463116407394, -0.09233733266592026, 0.37600401043891907, 0.05883823707699776, -0.4372899830341339, -0.967400312423706, 0.07116804271936417, 0.2625652253627777, -0.3657383918762207, 0.124258719384...
// Parameter defaults new { controller = "Pages", action = "Index", id = "" } ); routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters // Parameter defaults
[ -0.28460824489593506, -0.38808295130729675, 0.8535178899765015, 0.13121789693832397, 0.02771291323006153, 0.007561624050140381, -0.025277510285377502, -0.08037572354078293, -0.41555461287498474, -1.1794551610946655, -0.36087101697921753, 0.17824386060237885, -0.39221835136413574, 0.2892043...
new { controller = "Home", action = "Index", id = "" } ); } ``` Thanks! I'd suggest adding an explicit route for /Pages/ at the beginning. The problem is that it's being handled by the Default route and deriving: controller = "Pages" action = "Index" id = "" which are exactly the same as the parameters for your Admin route.
[ -0.09046366065740585, -0.08248811215162277, 0.9512918591499329, 0.11139994114637375, 0.016745397821068764, -0.37520599365234375, -0.0465138778090477, -0.1514563113451004, -0.3624684810638428, -1.0191001892089844, -0.27048805356025696, 0.49833959341049194, -0.18473583459854126, 0.1887991726...
I have apache 2.2 and tomcat 5.5 running on a Windows XP machine. Which tomcat/apache connector is the easiest to set up and is well documented? `[mod_proxy_ajp](http://httpd.apache.org/docs/2.2/mod/mod_proxy.html)` would be the easiest to use if you are using Apache 2.2. It is part of the Apache distribution so you don't need to install any additional software. In your `httpd.conf` you need to make sure that `mod_proxy` and `mod_proxy_ajp` are loaded: ``` LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_ajp_module modules/mod_proxy_ajp.so ``` Then you can use the [ProxyPass](http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypass) and [ProxyPassReverse](http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypassreverse) directives as follows: ``` ProxyPass /portal ajp://localhost:8009/portal ProxyPassReverse /portal ajp://localhost:8009/portal ``` You should consult the Apache 2.2 documentation for a full catalog of the directives available.
[ 0.22689446806907654, 0.09620662778615952, 0.6940390467643738, -0.08587595820426941, -0.27568015456199646, -0.44983944296836853, 0.27437442541122437, -0.22568410634994507, 0.025464624166488647, -1.0127980709075928, -0.13271267712116241, 0.7188108563423157, -0.1317153126001358, 0.17826989293...
Is there a distributed version control system (git, bazaar, mercurial, darcs etc.) that can handle files larger than available RAM? I need to be able to commit large binary files (i.e. datasets, source video/images, archives), but I don't need to be able to diff them, just be able to commit and then update when the file changes. I last looked at this about a year ago, and none of the obvious candidates allowed this, since they're all designed to diff in memory for speed. That left me with a VCS for managing code and something else ("asset management" software or just rsync
[ 0.39527422189712524, 0.13635241985321045, 0.23365072906017303, 0.19321458041667938, 0.10525144636631012, -0.13896343111991882, 0.0006536407745443285, 0.03284553438425064, -0.6283566951751709, -0.6104862093925476, -0.09448786079883575, 0.6071944236755371, -0.15391585230827332, 0.36995062232...
and scripts) for large files, which is pretty ugly when the directory structures of the two overlap. It's been 3 years since I asked this question, but, as of version 2.0 Mercurial includes the [largefiles extension](https://www.mercurial-scm.org/wiki/LargefilesExtension), which accomplishes what I was originally looking for: > The largefiles extension allows for tracking large, incompressible binary files in Mercurial without requiring excessive bandwidth for clones and pulls. Files added as largefiles are not tracked directly by Mercurial; rather, their revisions are identified by a checksum, and Mercurial tracks these checksums. This way, when you clone a repository or pull in changesets, the large files
[ 0.07155311852693558, -0.16470526158809662, 0.6079224944114685, -0.0627499520778656, 0.35886842012405396, -0.09480902552604675, -0.08077578991651535, 0.252771258354187, -0.6794028282165527, -0.7038413882255554, -0.41996464133262634, 0.573360025882721, -0.35541900992393494, 0.012934166938066...
in older revisions of the repository are not needed, and only the ones needed to update to the current version are downloaded. This saves both disk space and bandwidth.
[ 0.019839582964777946, 0.1042974665760994, 0.32416635751724243, 0.3752272427082062, 0.3213467299938202, -0.4710823595523834, 0.11486231535673141, -0.08361028134822845, -0.28529220819473267, -0.5991126894950867, -0.49150386452674866, 0.4924750030040741, 0.12520703673362732, 0.249966412782669...
I'm doing simple string input parsing and I am in need of a string tokenizer. I am new to C# but have programmed Java, and it seems natural that C# should have a string tokenizer. Does it? Where is it? How do I use it? You could use [String.Split method](http://msdn.microsoft.com/en-us/library/system.string.split.aspx "String.Split method msdn reference"). ``` class ExampleClass { public ExampleClass() { string exampleString = "there is a cat"; // Split string on spaces. This will separate all the words in a string
[ 0.17692801356315613, -0.05238551273941994, 0.04116058722138405, -0.18838490545749664, 0.0006534475833177567, 0.08209092170000076, 0.18198555707931519, -0.13019663095474243, -0.4300367534160614, -0.7650496959686279, 0.10438475012779236, 0.3829767107963562, -0.4691920280456543, 0.12137896567...
string[] words = exampleString.Split(' '); foreach (string word in words) { Console.WriteLine(word); // there // is // a // cat
[ -0.10892964154481888, -0.043886449187994, 0.1827847957611084, -0.4018652141094208, 0.2663727402687073, 0.27877506613731384, 0.31232666969299316, -0.24075250327587128, -0.10473494231700897, -0.4896807074546814, -0.5350310802459717, 0.2556131184101105, -0.42459961771965027, 0.229808732867240...
} } } ``` For more information see [Sam Allen's article about splitting strings in c#](http://www.dotnetperls.com/split "C# Split String Examples by Sam Allen") (Performance, Regex)
[ 0.4045308530330658, -0.39262518286705017, -0.6052964925765991, -0.006433745846152306, 0.11160274595022202, -0.141874298453331, -0.0665474534034729, -0.25918254256248474, -0.6599075794219971, -0.1340359002351761, -0.09277121722698212, 0.6425533294677734, -0.6839907169342041, 0.0698936432600...
There are multiple Ruby implementations in the works right now. Which are you looking forward to and why? Do you actively use a non-MRI implementation in production? Some of the options include: * [Ruby MRI (original 1.8 branch)](http://en.wikipedia.org/wiki/Ruby_MRI) * [YARV (official 1.9)](http://www.atdot.net/yarv/) * [JRuby](http://jruby.codehaus.org/) * [Rubinius](http://rubini.us/) * [IronRuby](http://ironruby.rubyforge.org/) - [Ironruby.net](http://ironruby.net/) * [MagLev](http://ruby.gemstone.com/) (Thanks [Julian](https://stackoverflow.com/users/11526/julian)) [Github link](https://maglev.github.io/) * [MacRuby](http://www.macruby.org/) (Thanks [Damien Pollet](https://stackoverflow.com/users/63112/damien-pollet)) [Maglev](http://ruby.gemstone.com/). It will have the speed benefit of all the optimization that has gone into a major Smalltalk VM over many, many year. Plus it will automatically persist all your data pretty much automatically so there is no more need to monkey around with Object-Relational mapping layers and
[ 0.13412100076675415, 0.12496957182884216, 0.4871059060096741, 0.005581814330071211, -0.29637837409973145, -0.029215630143880844, 0.5553982853889465, -0.1456674337387085, -0.1755230575799942, -0.4274286925792694, -0.27859702706336975, 0.40430641174316406, -0.07833276689052582, 0.11429864168...
so on.
[ 0.4511003792285919, 0.1097317710518837, -0.14086036384105682, -0.03675926476716995, -0.13137687742710114, -0.2568313479423523, -0.4948967695236206, 0.8872885704040527, -0.15601631999015808, -0.5478460788726807, -0.11236068606376648, 0.2583245038986206, 0.3273221254348755, 0.232146367430686...
I want to port data from one server's database to another server's database. The databases are both on a different mssql 2005 server. Replication is probably not an option since the destination database is generated from scratch on a [time interval] basis. Preferebly I would do something like ``` insert * from db1/table1 into db2/table2 where rule1 = true ``` It's obvious that connection credentials would go in somehwere in this script. I think what you want to do is create a linked server as per [this webarchive snapshot of msdn article from 2015](http://web.archive.org/web/20150628090613/https://msdn.microsoft.com/en-us/library/aa213778(SQL.80).aspx) or [this article from learn.microsoft.com](https://learn.microsoft.com/en-us/sql/relational-databases/linked-servers/create-linked-servers-sql-server-database-engine?view=sql-server-ver15). You would then select using a 4 part object name eg: ``` Select *
[ 0.14233994483947754, -0.011162263341248035, 0.30655717849731445, 0.10844891518354416, -0.1183551773428917, -0.17005258798599243, 0.08029334247112274, -0.1298019140958786, -0.39746370911598206, -0.6187929511070251, 0.05815255641937256, 0.4029428958892822, -0.09161838889122009, 0.64495772123...
From ServerName.DbName.SchemaName.TableName ```
[ -0.06879224628210068, 0.36953204870224, 0.2222452461719513, -0.22801528871059418, -0.34077954292297363, -0.2054658979177475, 0.1735590100288391, -0.04214697703719139, -0.033058058470487595, -0.7405791878700256, -0.35629820823669434, 0.12713418900966644, -0.20321935415267944, 0.560834527015...
So, I have willfully kept myself a Java n00b until recently, and my first real exposure brought about a minor shock: Java does not have C# style properties! Ok, I can live with that. However, I can also swear that I have seen property getter/setter code in Java in one codebase, but I cannot remember where. How was that achieved? Is there a language extension for that? Is it related to NetBeans or something? There is a "standard" pattern for getters and setters in Java, called [Bean properties](http://docs.oracle.com/javase/tutorial/javabeans/writing/properties.html). Basically any method starting with `get`, taking no arguments and returning a value, is
[ 0.3009953498840332, 0.21040359139442444, 0.02313109301030636, -0.1061892956495285, -0.28858062624931335, -0.39651644229888916, 0.17597217857837677, -0.13860507309436798, -0.4983298182487488, -0.46619486808776855, -0.041404400020837784, 0.6437845230102539, -0.09727507084608078, 0.1054775491...
a property getter for a property named as the rest of the method name (with a lowercased start letter). Likewise `set` creates a setter of a void method with a single argument. For example: ``` // Getter for "awesomeString" public String getAwesomeString() { return awesomeString; } // Setter for "awesomeString" public void setAwesomeString( String awesomeString ) { this.awesomeString = awesomeString; } ``` Most Java IDEs will generate these methods for you if you ask them (in Eclipse it's as simple as moving the cursor to a field and hitting `Ctrl`-`1`, then selecting the option from the list). For what it's worth, for readability you can actually use `is` and
[ 0.24746578931808472, -0.16999901831150055, 0.15841735899448395, 0.21300818026065826, -0.16929727792739868, -0.3358865976333618, 0.21522030234336853, -0.274985671043396, -0.03578433021903038, -0.3951072096824646, -0.37188640236854553, 0.7840150594711304, -0.2574061453342438, 0.0652126222848...
`has` in place of `get` for boolean-type properties too, as in: ``` public boolean isAwesome(); public boolean hasAwesomeStuff(); ```
[ -0.09402897208929062, 0.10092291980981827, 0.08658386021852493, -0.11096372455358505, -0.11132293939590454, -0.2678878605365753, 0.09768350422382355, -0.04369731247425079, -0.014065347611904144, -0.39995914697647095, -0.5417490601539612, 0.3918960988521576, -0.14558659493923187, 0.00829783...
In order to know how many times a pattern exists in current buffer, I do: ``` :%s/pattern-here/pattern-here/g ``` It gives the number of occurrences of the pattern, but is obviously cumbersome and also has the side-effect of setting the 'changed' status. Is there a more elegant way to count? To avoid the substitution, leave the second pattern empty, and add the “n” flag: ``` :%s/pattern-here//gn ``` This is described as [an official tip](http://vimdoc.sourceforge.net/htmldoc/tips.html#count-items).
[ 0.4190521836280823, -0.20133638381958008, 0.8240014910697937, 0.0843581110239029, -0.011555645614862442, -0.10111697763204575, -0.01779433898627758, -0.2865888476371765, -0.4117726683616638, -0.5964556336402893, -0.0520273819565773, 0.08421910554170609, -0.3035282790660858, 0.0504040904343...
I have heard there is a way to cheat single inheritance and implement multiple inheritance in Java. Does anyone know how to implement this(with out using interface)? Just out of curiosity ;-) Sure you can, but it's tricky and you should really consider if that's the way you want to go. The idea is to use scope-based inheritance coupled with type-based one. Which is type-talk for saying that for internal purposes, inner classes "inherit" methods and fields of the outer class. It's a bit like mixins, where the outer class is mixed-in to the inner class, but not as safe, as
[ 0.4218870997428894, -0.2174385040998459, -0.33143559098243713, 0.13796091079711914, -0.3017260730266571, -0.3117437958717346, 0.17426465451717377, -0.2152334600687027, -0.11629301309585571, -0.400365948677063, 0.27859365940093994, 0.6449894905090332, -0.6623668074607849, 0.0237505640834569...