text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
Do you guys know of any algorithms that can be used to compute difference between images?
Take this webpage for example <http://tineye.com/> You give it a link or upload an image and it finds similiar images. I doubt that it compares the image in question against all of them (or maybe it does).
By compute I mean like... | [
0.7097103595733643,
0.20474521815776825,
-0.04974539205431938,
0.13349691033363342,
-0.4601019620895386,
0.014151052571833134,
0.16198724508285522,
0.03932715579867363,
-0.2791580855846405,
-0.43306538462638855,
0.3168806731700897,
0.47147586941719055,
0.08383280783891678,
0.15311770141124... | |
very simplest measures are going to be RMS-error based approaches, for example:
* [Root Mean Square Deviation](http://en.wikipedia.org/wiki/RMSD)
* [Peak Signal to Noise Ratio](http://en.wikipedia.org/wiki/PSNR)
These probably gel with your notions of distance measures, but their results are really only meaningful if... | [
0.18651682138442993,
-0.06528596580028534,
0.18115217983722687,
0.3422865867614746,
-0.09366560727357864,
-0.010790522210299969,
0.2567688822746277,
-0.5038558840751648,
-0.07606752961874008,
-0.8410434126853943,
0.16402973234653473,
0.5272316336631775,
0.13373224437236786,
-0.070022493600... | |
misleading).
Beyond these, there's a whole field of research devoted to image similarity. I'm no expert, but here are a few pointers:
* A lot of work has gone into approaches using [dimensionality reduction](http://en.wikipedia.org/wiki/Dimensionality_reduction) (PCA, SVD, eigenvalue analysis, etc) to pick out the pr... | [
0.35414379835128784,
0.1859390288591385,
-0.146311417222023,
0.12955313920974731,
-0.2239033430814743,
0.03714592009782791,
0.10620022565126419,
-0.1766173094511032,
-0.11186625063419342,
-0.7570325136184692,
0.32163864374160767,
0.3118872344493866,
0.0006261367816478014,
0.389600366353988... | |
cool paper on the [spatial domain structural similarity (SSIM)](http://citeseerx.ist.psu.edu/viewdoc/download;jsessionid=230F49B56EF7810EBD8B84BD3ACF7815?doi=10.1.1.5.54&rep=rep1&type=pdf) measure, which tries to mimic peoples' perceptions of image error instead of direct, mathematical notions of error. The same guys d... | [
0.36564502120018005,
-0.07453644275665283,
0.24056872725486755,
0.3487864136695862,
-0.07600206136703491,
-0.10690803825855255,
0.011322514154016972,
-0.13903559744358063,
-0.4242335259914398,
-0.38878491520881653,
0.022466138005256653,
0.3442581593990326,
0.1164526417851448,
0.00275900680... | |
analyze hundreds of image attributes such as colour, shape, texture, luminosity, complexity, objects, and regions.These attributes form a compact digital signature that describes the appearance of each image, and these signatures are calculated by and indexed by our software. When performing a visual search, these sign... | [
0.5774084329605103,
0.19741390645503998,
0.16736465692520142,
0.6095423698425293,
0.2785908877849579,
0.14937321841716766,
-0.17818361520767212,
-0.08795216679573059,
0.1101841926574707,
-0.6824981570243835,
0.25134560465812683,
0.5744195580482483,
0.06852882355451584,
0.000102910213172435... | |
methods for this stuff. It's not a solved problem, but hopefully these pointers will give you an idea of what's involved. | [
0.4941631257534027,
0.022565536201000214,
0.13888128101825714,
0.5331991314888,
0.10764763504266739,
-0.19733698666095734,
0.26598241925239563,
0.06847308576107025,
-0.23028498888015747,
-0.614262044429779,
0.40562599897384644,
0.45641952753067017,
0.09378542006015778,
-0.18370702862739563... | |
I have a table which has an `IDENTITY` field and a `VARBINARY(MAX)` field in it. Is there any way I could dump the content of each `VARBINARY(MAX)` field to the *filesystem* (eg. `c:\temp\images`)?
### Table schema:
```
PhotoId INTEGER NOT NULL IDENTITY
Image VARBINARY(MAX) NOT NULL
DateCreated SMALLDATETIME
```
##... | [
0.3109463155269623,
-0.006213041953742504,
0.6734553575515747,
-0.13668914139270782,
-0.02855074778199196,
-0.0025637056678533554,
-0.13342833518981934,
-0.35996249318122864,
-0.2820666432380676,
-0.589885413646698,
0.22085842490196228,
0.5846844911575317,
-0.13236220180988312,
0.281384259... | |
FROM tblThumbnail a
ORDER BY a.IdThumbnail
OPEN Cursor_Image
FETCH NEXT FROM Cursor_Image INTO @IdThumbnail
WHILE @@FETCH_STATUS = 0
BEGIN
-- Generate the file name based upon the ID and the MIMETYPE.
SELECT @FileName = LTRIM(STR(@IdThumbnail)) + '.png'
-- Framing DynamicSQL ... | [
0.07784562557935715,
-0.25435054302215576,
0.773064136505127,
0.06550969183444977,
0.010392824187874794,
0.1620943397283554,
0.01607642136514187,
-0.6878457069396973,
-0.3157148063182831,
-0.3594571053981781,
0.07834220677614212,
0.661352276802063,
-0.5076667070388794,
-0.05805262178182602... | |
FROM Appian.dbo.tblThumbnail
WHERE IdThumbnail = ' + LTRIM(STR(@IdThumbnail)) +
'" QUERYOUT c:\Temp\Images\' + LTRIM(@FileName) + | [
-0.09707947075366974,
-0.1575925201177597,
0.4424441456794739,
-0.2222784459590912,
0.08608266711235046,
0.23437145352363586,
0.3022688627243042,
-0.29046133160591125,
-0.16802966594696045,
-0.6014401316642761,
-0.2305256724357605,
0.4919338822364807,
-0.5452173352241516,
-0.00804010592401... | |
' -T -fC:\Temp\ImageFormatFile.txt'
print @FileName
print @sqlstmt
EXEC xp_cmdshell @sqlstmt
FETCH NEXT FROM Cursor_Image INTO @IdThumbnail
END
CLOSE Cursor_Image
DEALLOCATE Cursor_Image
```
Please note -> u need to have a format file, for the BCP command. This is the content of ... | [
0.1707703322172165,
0.25741156935691833,
1.0768557786941528,
-0.19823768734931946,
-0.14934353530406952,
-0.07939526438713074,
-0.09968931972980499,
-0.2714204788208008,
-0.18135645985603333,
-0.5167621374130249,
-0.18952831625938416,
0.49955758452415466,
-0.43093034625053406,
0.1160862594... | |
0 0 "" 1 OriginalImage ""
```
Final note about that format file .. there HAS TO BE A NEW LINE AFTER THE LAST LINE. otherwise u'll get an error.
Enjoy! | [
0.2556838095188141,
-0.17099925875663757,
0.5387704968452454,
0.13088352978229523,
0.17086996138095856,
-0.3865324556827545,
0.36725521087646484,
-0.045906469225883484,
-0.0461624339222908,
-0.4615344703197479,
-0.30031752586364746,
0.31697648763656616,
-0.2032032161951065,
0.1703320890665... | |
**Objective:** I would like to be able to list the available COM Ports on a system in Delphi.
**Homework:**
I have read [this](https://stackoverflow.com/questions/374200/finding-available-lpt-parallel-ports-and-addresses-in-delphi) SO thread on enumerating the LPT ports of a system using the registry. I have also foun... | [
0.031007947400212288,
0.013303613290190697,
0.2920495569705963,
0.05020371079444885,
0.023962154984474182,
0.1486869603395462,
-0.0013552402378991246,
0.04691287875175476,
-0.4602905213832855,
-0.7330729365348816,
-0.058990854769945145,
0.7530627250671387,
-0.2565675675868988,
-0.060580793... | |
is the most reliable way (across unknown Windows Versions) to list the COM ports on a Windows Machine?
[DEVICEMAP\SERIALCOMM](http://www.microsoft.com/technet/prodtechnol/windows2000serv/reskit/regentry/44.mspx?mfr=true) is good for all NT versions. You'll probably need to look under DYN\_DATA for Win9x.
Use [this met... | [
0.1969759166240692,
-0.11636582016944885,
0.5160937905311584,
0.16786816716194153,
0.21630796790122986,
-0.14549705386161804,
0.24063335359096527,
-0.029641607776284218,
-0.4566360414028168,
-0.5985710620880127,
0.02344493754208088,
0.8837247490882874,
0.046257615089416504,
0.1314093321561... | |
I've seen on a couple of sites that they will include a navigation section at the top of their page, with internal links to other parts of the page, so that users with screen readers can quickly jump to the content, menu, footer, etc. This "nav" element is moved off-screen with CSS so regular users don't see it.
**Wha... | [
0.13499335944652557,
-0.014181695878505707,
0.2857467532157898,
-0.05375617370009422,
-0.20362159609794617,
-0.09348191320896149,
-0.05620685592293739,
0.2746533155441284,
-0.4227724075317383,
-0.7876773476600647,
-0.10086967051029205,
0.2194753885269165,
-0.2571397125720978,
-0.0055580004... | |
<a href="#three">Jump to section three</a>
</div>
<!-- versus -->
<ul id="nav">
<li><a href="#one">Jump to section one</a></li>
<li><a href="#two">Jump to section two</a></li>
<li><a href="#three">Jump to section three</a></li>
</ul>
```
The first has the benefit of being much cleaner in its markup, but... | [
-0.2143615186214447,
-0.08553527295589447,
0.290706068277359,
-0.3688179850578308,
-0.7889779806137085,
0.3481604754924774,
0.14525364339351654,
-0.5055798888206482,
-0.380420982837677,
-0.5495187640190125,
-0.7098191976547241,
0.29792630672454834,
-0.4764391779899597,
-0.15164363384246826... | |
but hopefully more descriptive.
Which out of these is better, and is there an even better way?
You can download a plugin for Firefox called [Fangs](http://www.standards-schmandards.com/fangs) (in reference to the real screen reader Jaws). It will produce text of which Jaws would read. It's very handy. I'd go with a go... | [
0.4608977437019348,
0.22327740490436554,
0.3113335371017456,
0.003921525552868843,
-0.0527346096932888,
-0.15628400444984436,
0.007739757187664509,
0.1439128965139389,
-0.010010934434831142,
-0.652742862701416,
-0.20873261988162994,
0.5265855193138123,
-0.13614672422409058,
-0.145023360848... | |
this:
```
<div id="section-nav">
<p>Jump to</p>
<ul>
<li><a href="#section1">Section1</a></li>
</ul>
</div>
``` | [
-0.06697201728820801,
-0.30827775597572327,
0.3560609817504883,
-0.23530374467372894,
-0.3728698492050171,
-0.009207937866449356,
-0.17509646713733673,
-0.12057284265756607,
-0.5088891386985779,
-0.46226248145103455,
-0.4221920073032379,
0.06652426719665527,
-0.3478851616382599,
0.16165107... | |
I have a repeater control with some html controls being populated from some server side DataSource. The code for these controls inside the repeater looks something like this..
```
<img src='<%# DataBinder.Eval(Container.DataItem, "Path")%>' title='<%# DataBinder.Eval(Container.DataItem, "Name")%>' alt="">
```
I need... | [
0.055347293615341187,
-0.05925977602601051,
0.5705965161323547,
0.12882639467716217,
-0.02665580064058304,
-0.07628694921731949,
0.25093284249305725,
-0.3091403543949127,
-0.1011170893907547,
-0.6514968276023865,
0.26314201951026917,
0.3130519688129425,
-0.2145291268825531,
0.2238187193870... | |
can do this using javascript so doing a simple string trimming (or any other kind of formatting) doesn't have to be done on the server side?
```
b = lambda { puts "this is the block" }
callBlock &b
```
or
```
b.call
```
with arguments:
```
def call_block_name
yield "Dave"
yield "Mary"
end
b = lambda ... | [
0.007903534919023514,
0.049987565726041794,
0.3789864480495453,
-0.25438645482063293,
0.03669580817222595,
0.15132668614387512,
0.3430211842060089,
-0.31213656067848206,
-0.20591968297958374,
-0.5966607332229614,
-0.4063084125518799,
0.47161054611206055,
-0.23923349380493164,
-0.0306582581... | |
I have a class that is wrapped with swig, and registered with lua. I can create an instance of this class in a lua script, and it all works fine.
But say I have an instance of a class made in my c++ code with a call to new X, and I have la lua\_state L with a function in it that I want to call, which accepts one argum... | [
0.1454775482416153,
0.019976697862148285,
0.29746705293655396,
-0.20266377925872803,
0.17683713138103485,
0.17002354562282562,
-0.11462678015232086,
0.10432291775941849,
-0.15033018589019775,
-0.4476790726184845,
-0.07476361095905304,
0.6459567546844482,
-0.48147350549697876,
0.10825965553... | |
(lua_State *L);
}
int main()
{
GuiInst gui=new GuiInst;
lua_State *L=luaL_newstate();
luaopen_engine(L); //this is swigs module
int error=luaL_loadfile(L,"mainmenu.lua")||
lua_pcall(L, 0, 0, 0);
lua_getglobal(L,"Init");
//Somehow push gui onto lua stack...
lua_pcall(L, 1, 0, 0));
lu... | [
-0.17835983633995056,
0.03128383681178093,
0.8958433866500854,
-0.37759751081466675,
0.32118353247642517,
0.1267060786485672,
0.35832199454307556,
-0.24187202751636505,
-0.2012520730495453,
-0.6462560296058655,
-0.23163677752017975,
0.8405217528343201,
-0.41849520802497864,
0.0951233059167... | |
modulles and I had to change the default linkage specification in the swig file (using -DSWIGRUNTIME=).
I add the following to main.cpp
```
extern "C"
{
struct swig_module_info;
struct swig_type_info;
int luaopen_engine (lua_State *L);
swig_module_info *SWIG_Lua_GetModule(lua_State* L);
void SWIG_... | [
-0.20022135972976685,
0.0804106742143631,
0.8609985113143921,
-0.217054083943367,
0.5327193140983582,
0.02737751044332981,
0.29813307523727417,
-0.5175396203994751,
0.06962515413761139,
-0.5367990136146545,
-0.045203398913145065,
0.7913113832473755,
-0.3740551769733429,
0.11568982154130936... | |
file that's not supposed to be human readable (so it says at the top of the file) and is just MESSY! (but it does work!)
Surely theres a better way to accomplish what I'm trying to do.
PS from a high level pov what I want is to have lua not refcount the Gui components which are created by the Object Factory in GuiIns... | [
0.33675599098205566,
0.0712076872587204,
0.2551729083061218,
0.06962853670120239,
0.1513482630252838,
-0.3208393156528473,
0.3924419581890106,
0.06343792378902435,
-0.2938298285007477,
-0.6765753626823425,
-0.1297716349363327,
0.7316524982452393,
-0.03655477240681648,
-0.17183424532413483,... | |
by RBerteig
GuiInst's contructor is #defined to private when swig runs to prevent lua constructing instances of it, so that won't work for me. What I was trying to prevent was the following (in lua):
```
r=engine.GuiRegionVertical()
r:Add(engine.GuiButton())
```
which would call "g=new GuiButton" then register it w... | [
-0.3813926875591278,
-0.04993654415011406,
0.8612155318260193,
-0.3714872896671295,
0.041446685791015625,
0.0738672986626625,
0.34567850828170776,
0.0527627095580101,
-0.06966914981603622,
-0.5241536498069763,
-0.1256096363067627,
1.068875789642334,
-0.5930666923522949,
-0.0582020916044712... | |
not sure how this should be done with swig.
That would remove the need for the private constructors, the Gui Object Factory and the nasty externs.
Am I going about this Wrong?
Thanks.
There is a simple and direct answer, that may not be the most efficient answer. SWIG produces wrappers for manipulating objects from ... | [
0.08934549242258072,
-0.0589338056743145,
0.3569992184638977,
-0.2813837230205536,
-0.1576472818851471,
0.05497162416577339,
0.15405383706092834,
0.08849810063838959,
0.0358600839972496,
-0.677002489566803,
-0.10225482285022736,
0.5448092818260193,
-0.4999295473098755,
0.0962996706366539,
... | |
luaopen_engine(L); //this is swigs module
int error=luaL_loadfile(L,"mainmenu.lua")||
lua_pcall(L, 0, 0, 0);
luaL_dostring(L, "Init(engine.new_GuiInst())");
lua_close(L);
}
```
For a one-shot case like script startup, the penalty of running a string constant through luaL\_dostring() is not bad at al... | [
-0.2030661255121231,
-0.11331252753734589,
0.49584531784057617,
-0.2439446747303009,
0.04908561334013939,
0.0773710235953331,
0.1769576072692871,
0.02577362395823002,
-0.21387827396392822,
-0.4670217037200928,
-0.15971100330352783,
0.6517878174781799,
-0.3322467803955078,
-0.00838627759367... | |
decomposed to API calls that get the engine table global on the stack, extract from it the `new_GuiInst` member, call it, then call the global `Init`, but the little bit of efficiency comes at the cost of some clarity.
As for dealing with objects that shouldn't be constructed by accident in user code, as the clarified... | [
-0.22964908182621002,
0.05285840108990669,
0.24415652453899384,
-0.0648617073893547,
0.024278981611132622,
-0.2522181570529938,
-0.0017166032921522856,
-0.06738036870956421,
-0.22714576125144958,
-0.4057641625404358,
-0.4038833975791931,
0.7405466437339783,
-0.4527375400066376,
-0.08772730... | |
doesn't make them read-only unless extra effort is taken.
So, you could always retrieve the value of `engine.new_GuiInst` and park it in the registry (see [`luaL_ref()`](http://www.lua.org/manual/5.1/manual.html#luaL_ref) and the discussion in [section 3.5 of the Lua Reference Manual](http://www.lua.org/manual/5.1/man... | [
0.11987229436635971,
0.06881774961948395,
0.5745048522949219,
-0.20399196445941925,
0.11655037850141525,
0.08996550738811493,
-0.22630958259105682,
-0.15815196931362152,
-0.21118342876434326,
-0.5251060128211975,
0.05549522116780281,
0.5844762325286865,
-0.249026358127594,
0.23472976684570... | |
both names to `nil`. If have much less experience with SWIG wrapping C++ classes, and the result may differ...
You might want to check and review the whole content of the `engine` table returned by SWIG, and create a proxy object that contains only the methods you want available to your users. You can also change the ... | [
0.20914041996002197,
0.015952885150909424,
0.2120756357908249,
-0.15813863277435303,
-0.1484297513961792,
0.08247005194425583,
-0.16178125143051147,
0.09128819406032562,
-0.15522019565105438,
-0.5408579111099243,
-0.09389880299568176,
0.3257836699485779,
-0.2357299029827118,
0.314856380224... | |
Is there a way to apply a Class' style to only ONE level of td tags?
```
<style>.MyClass td {border: solid 1px red;}</style>
<table class="MyClass">
<tr>
<td>
THIS SHOULD HAVE RED BORDERS
</td>
<td>
THIS SHOULD HAVE RED BORDERS
<table><tr><td>THIS SHOULD NOT HAVE ANY</td></tr></table>
... | [
0.25026804208755493,
-0.268711119890213,
0.4959573745727539,
0.0182960107922554,
-0.07514148950576782,
0.07546897977590561,
0.257986456155777,
-0.5916358232498169,
-0.0969047024846077,
-0.5750279426574707,
-0.05058794468641281,
0.33237120509147644,
-0.4082079529762268,
0.03228822350502014,... | |
work in IE6. If you need to support that browser (which you probably do, alas), all you can do is select the inner element separately and un-set the style:
```
.MyClass td { border: solid 1px red; }
.MyClass td td { border: none; }
```
---
\*Note that the first example references a `tbody` element not found in your... | [
0.34294262528419495,
-0.13643969595432281,
0.35267847776412964,
-0.263975590467453,
-0.07852420955896378,
-0.3739085793495178,
0.6254263520240784,
-0.042665544897317886,
-0.1526949256658554,
-0.7903410196304321,
-0.27552953362464905,
0.6162634491920471,
-0.2953592836856842,
-0.253132998943... | |
> The destructor should only release unmanaged resources that your object holds on to, and it should not reference other objects. If you have only managed references you do not need to (and should not) implement a destructor. You want this only for handling unmanaged resources. **Because there is some cost to having a ... | [
0.46281373500823975,
0.1269855499267578,
0.30318447947502136,
0.25220683217048645,
-0.03703833371400833,
-0.08179724216461182,
0.5125444531440735,
-0.25469326972961426,
-0.3712455630302429,
-0.5451059937477112,
-0.18413840234279633,
0.8271533250808716,
-0.5502462387084961,
-0.0675794631242... | |
I know about the GC and the fact the destructor isn't called at reliable times, that all aside, is there anything else?
Any object that has a finalizer (I prefer that term over destructor, to emphasize the difference from C++ destructors) is added to the finalizer queue. This is a list of references to objects that has... | [
0.12720300257205963,
0.133888840675354,
0.5621854662895203,
-0.0836956575512886,
0.0218487698584795,
-0.2936595380306244,
-0.03624025359749794,
0.07909276336431503,
-0.23846356570720673,
-0.46431708335876465,
-0.44847196340560913,
0.648456335067749,
-0.3891555070877075,
0.3631357252597809,... | |
background thread goes through to call the finalizer method of each object in turn.
Once the finalizer of the object has been called, the object is no longer in the finalizer queue so it's just a regular managed object that the GC can remove.
This all means that if an object has a finalizer, it will survive at least ... | [
-0.044940438121557236,
-0.5462915897369385,
0.5652090907096863,
0.031397055834531784,
0.28553327918052673,
0.05128680542111397,
-0.028727995231747627,
0.4919232726097107,
-0.689361572265625,
-0.4380504786968231,
-0.2783361077308655,
0.14269746840000153,
-0.2840534746646881,
0.4431633651256... | |
The theoretical maximum of memory bandwidth for a Core 2 processor with DDR3 dual channel memory is impressive: According to the [Wikipedia article](http://en.wikipedia.org/wiki/Intel_Core_2) on the architecture, 10+ or 20+ gigabytes per second. However, stock memcpy() calls do not attain this. (3 GB/s is the highest I... | [
0.11360027641057968,
-0.0728592798113823,
0.3167099058628082,
-0.071559377014637,
-0.05148293450474739,
-0.0027506875339895487,
0.26055389642715454,
-0.13736239075660706,
-0.25704073905944824,
-0.5873850584030151,
-0.3689006567001343,
0.6263254880905151,
-0.12446988373994827,
-0.0167445056... | |
or Core i7 processors that can be utilized in a C program? I'm sure that I'm not the only person in need of one, and it would be a big waste of effort for everyone to micro-optimize their own memcpy().
If you specify /ARCH:SSE2 to MSVC it should provide you with a tuned memcpy (at least, mine does).
Failing that, use ... | [
0.3569159507751465,
-0.06464918702840805,
0.2363232523202896,
0.18058829009532928,
0.10049618035554886,
-0.016794918105006218,
0.14022155106067657,
-0.1740715354681015,
-0.1591959297657013,
-0.5670142769813538,
-0.04444379359483719,
0.7573500871658325,
0.02449001930654049,
0.04982440918684... | |
use the cache management intrinsics as well to get good performance.
Your limiting factor is probably cache misses and southbridge bandwidth, rather than CPU cycles. Given that there's always going to be lots of other traffic on the memory bus, I'm usually happy to get to about 90% of theoretical memory bandwidth thro... | [
0.034570805728435516,
0.46490979194641113,
0.10844153165817261,
0.12343344837427139,
0.15263605117797852,
0.020975064486265182,
0.36968162655830383,
0.17773941159248352,
-0.38089868426322937,
-0.8678387403488159,
-0.010533296503126621,
0.7613959312438965,
0.19645990431308746,
0.15429031848... | |
In Java, this code throws an exception when the HTTP result is 404 range:
```
URL url = new URL("http://stackoverflow.com/asdf404notfound");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.getInputStream(); // throws!
```
In my case, I happen to know that the content is 404, but I'd still lik... | [
-0.15301956236362457,
0.18501436710357666,
0.33806997537612915,
-0.17499391734600067,
-0.09111878275871277,
-0.1392044574022293,
0.3281324505805969,
-0.10984253138303757,
-0.29079440236091614,
-0.8802824020385742,
-0.2664116621017456,
0.4050125777721405,
-0.23625244200229645,
-0.1819205135... | |
= (HttpURLConnection)_urlConnection;
InputStream _is;
if (httpConn.getResponseCode() < HttpURLConnection.HTTP_BAD_REQUEST) {
_is = httpConn.getInputStream();
} else {
/* error from server */
_is = httpConn.getErrorStream();
}
``` | [
-0.2203461229801178,
-0.13284671306610107,
0.5791288614273071,
-0.3124457895755768,
0.12511484324932098,
-0.04271058365702629,
0.5808600783348083,
-0.13130101561546326,
-0.19875410199165344,
-0.6530405879020691,
-0.3552241623401642,
0.7028591632843018,
-0.42541763186454773,
0.2288743555545... | |
I have a c# Class that has lots of virtual methods, some of these methods are essentially abstract ( they are fully implemented in subclasses and the base class is empty).
To get it to compile i am throwing an InvalidOperationException in the base class with a comment on what should be done. This just feels dirty.
... | [
0.7189182639122009,
0.21814590692520142,
0.07184797525405884,
0.2286328226327896,
-0.001715934369713068,
-0.08883996307849884,
0.6011446118354797,
0.42567870020866394,
-0.060748141258955,
-0.4792864918708801,
-0.11982721090316772,
0.12569044530391693,
-0.05828515812754631,
-0.0934398397803... | |
public GetPersonById(Guid id) {
//Code to get person - same for all provinces
}
Public virtual DeletePerson(Guid id) {
//Common code
}
Public virtual UpdatePerson(Person p) {
throw new InvalidOperation("I wanna be abstract");
}
Public Class ABPersonComponent : PersonComponent
{
public override DeleteP... | [
-0.002037766855210066,
-0.1409989893436432,
0.5052504539489746,
0.4132649600505829,
-0.21432173252105713,
-0.08718091994524002,
0.4003527760505676,
0.05867869034409523,
-0.24434690177440643,
-0.5823616981506348,
-0.01694435626268387,
0.11549889296293259,
-0.4459031820297241,
0.050209064036... | |
Do you want to share common code for all your derived classes, then implement base functionality in the base class.
When having shared base code, please notice the Template pattern. Use a public method and chain it to a protected virtual method with the core/shared implementation. End the shared implementation method... | [
0.15662220120429993,
-0.09884797781705856,
-0.11477397382259369,
0.13284993171691895,
0.0008991491049528122,
-0.06607993692159653,
0.12113803625106812,
-0.12749631702899933,
-0.0761088877916336,
-0.5141830444335938,
0.0665893629193306,
0.39413341879844666,
-0.46127721667289734,
0.354055672... | |
//chain it to the core
DeletePersonCore(id);
}
}
public class DerivedClass : BaseClass
{
protected override void DeletePersonCore(Guid id)
{
//do some polymorphistic stuff
base.DeletePersonCore(id);
}
}
public class UsageClass
{
public void Delete()
{
DerivedCl... | [
0.034371208399534225,
-0.29572224617004395,
0.25528010725975037,
-0.010940754786133766,
0.18155451118946075,
-0.031627073884010315,
0.20131073892116547,
-0.25133946537971497,
-0.2633173167705536,
-0.24323037266731262,
-0.21323177218437195,
0.3978841006755829,
-0.29858750104904175,
0.357174... | |
In a WinForms .Net 2.0 application, I want to create a context menu with a ToolStripMenuItem that has both a label AND a textbox in the item itself. An example of what I am talking about can be found in Access - when viewing an Access table, the context menu has options for "Filter By Selection", "Filter Excluding Sele... | [
0.12920312583446503,
-0.3646586537361145,
0.057090483605861664,
-0.028210723772644997,
-0.05040823668241501,
-0.04341346025466919,
-0.07629534602165222,
-0.1655062437057495,
-0.030914612114429474,
-1.0389419794082642,
0.1424996554851532,
0.6533251404762268,
-0.391753613948822,
0.0351655483... | |
two *separate* ToolStripMenuItems - one for the text, then a child with just the text box. But this is awkward and not as nice looking as the implementation in Access.
Can anyone point me in the right direction on this? I'm having trouble searching, as all everything I find seems to relate to context menus on a text b... | [
0.23830613493919373,
-0.16775979101657867,
0.279471218585968,
0.3844256103038788,
0.03640376403927803,
-0.0785648301243782,
0.11413270980119705,
-0.1800072193145752,
-0.09035360813140869,
-0.5888677835464478,
0.034743066877126694,
0.38326671719551086,
0.018046073615550995,
-0.0274124741554... | |
specify which language you prefered)
```
Public Class ToolStripEntry
Inherits ToolStripControlHost
Public Sub New()
MyBase.New(New ControlPanel)
End Sub
Public ReadOnly Property ControlPanelControl() As ControlPanel
Get
Return CType(Me.Control, ControlPanel)
End G... | [
-0.11062447726726532,
-0.020442893728613853,
0.16413161158561707,
0.04923618212342262,
0.1387636661529541,
-0.07714485377073288,
0.16205430030822754,
-0.26419728994369507,
-0.03131174296140671,
-0.5126491785049438,
-0.33311450481414795,
0.7151868343353271,
-0.20895156264305115,
0.200577855... | |
just use the events
Friend WithEvents lbl As New Label //don think you can just do that in c#, but you get the idea
Public Sub New()
lbl.Anchor = AnchorStyles.Left Or AnchorStyles.Top Or AnchorStyles.Bottom
lbl.Text = "Test"
lbl.TextAlign = ContentAlignment.MiddleLeft
lbl.Si... | [
0.3068462908267975,
-0.37428826093673706,
0.6363176703453064,
0.07092451304197311,
0.08235910534858704,
-0.25592607259750366,
0.20576757192611694,
-0.27102378010749817,
-0.2727113962173462,
-0.5371211767196655,
0.0949883908033371,
0.6961184740066528,
0.15017978847026825,
-0.082692779600620... | |
lbl.Location = New Point(0, 0)
lbl.Parent = Me
txt.Anchor = AnchorStyles.Left Or AnchorStyles.Right Or AnchorStyles.Top
txt.Location = New Point(lbl.Right, 0)
txt.Width = Me.Width - txt.Left
txt.Parent = Me
End Sub
End Class
``` | [
0.05761517584323883,
-0.05118287727236748,
0.6777656674385071,
-0.3500015139579773,
0.2693873345851898,
0.1980111449956894,
-0.2667134404182434,
-0.03354558348655701,
-0.3342597484588623,
-0.41374388337135315,
-0.11888612806797028,
0.24323828518390656,
0.1742008626461029,
0.542667865753173... | |
I need books that truely explian sockets in windows in C++ ive been looking at tutorials but they dont tell what anything means they dont go into great detail so i need come books on Winsock in C++ for windows
This is by far the best, most up to date book on the subject: [Network Programming for Microsoft Windows](http... | [
0.2207188457250595,
0.06585444509983063,
0.1730259656906128,
0.14583493769168854,
-0.12829464673995972,
-0.08963734656572342,
0.12978675961494446,
-0.13664652407169342,
-0.08594466745853424,
-0.5569078922271729,
0.09633610397577286,
0.8490796089172363,
0.1013181060552597,
-0.06581825762987... | |
I wanted to set up remote debugging from Eclipse. Tomcat is running as a service on windows.
That bit is fine, a quick google pointed me towards the correct settings to add to wrapper.conf to enable this. There were entries already in wrapper.conf, so I copy/pasted the last entry and modified it:
```
wrapper.java.add... | [
0.3378943204879761,
0.22870540618896484,
0.5433059930801392,
0.04687206447124481,
-0.03550519421696663,
-0.1631365865468979,
0.2687142491340637,
-0.17396490275859833,
-0.20334981381893158,
-0.3280212879180908,
-0.05315977707505226,
0.5904709100723267,
-0.3986835777759552,
0.009480889886617... | |
this assessment?
If so, how/why is the application working as is? There are several parameters ostensibly being set like this (nested in qutoes), which I believe actually have no effect.
For instance min/max memory settings.
I found an example [here](http://cocoondev.org/books/daisy_docs_book--20070924-080121/pub... | [
0.36653900146484375,
-0.009351409040391445,
0.26455751061439514,
0.04008646309375763,
-0.13332484662532806,
0.01486858818680048,
0.17910723388195038,
-0.11311738193035126,
-0.23711822926998138,
-0.3032928705215454,
0.1532781422138214,
0.7284991145133972,
-0.1867542564868927,
0.165911555290... | |
putting two configuration items on the same line. (In my defense I copied it as one line from [the Tomcat FAQ](http://wiki.apache.org/tomcat/FAQ/Developing)
2 - Using quotes
The combination of these two was causing the issue.
```
wrapper.java.additional.9="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9135,s... | [
0.2637181878089905,
-0.08337529748678207,
0.4027699828147888,
-0.1541336625814438,
-0.19712819159030914,
0.07762806117534637,
0.05354911834001541,
-0.15266485512256622,
-0.3583739399909973,
-0.6145462393760681,
-0.0313778817653656,
0.4986649453639984,
-0.6838307976722717,
0.038450848311185... | |
wrapper.java.additional.9="-Xdebug"
wrapper.java.additional.9.stripquotes=TRUE
wrapper.java.additional.10="-Xrunjdwp:transport=dt_socket,server=y,address=9135,suspend=n"
wrapper.java.additional.10.stripquotes=TRUE
java "-Xdebug" "-Xrunjdwp:transport=dt_socket,server=y,address=9135,suspend=n" ...
```
The... | [
0.3970460295677185,
0.19238929450511932,
0.7271062135696411,
-0.040304720401763916,
-0.52677983045578,
0.11057022213935852,
0.20520606637001038,
0.021827789023518562,
-0.6803987622261047,
-0.5333205461502075,
-0.2612530291080475,
0.23906785249710083,
-0.2808656692504883,
-0.218284592032432... | |
I'm building a custom publishing site definition for MOSS 2007 but I seem to have a problem. The content types that I import don't have any of the page scheduling options available.
I've gone over my onet.xml next to the one which the Publishing Site uses (in the BLANKINTERNET folder) and I am putting in all the featu... | [
0.09271281957626343,
0.2116902768611908,
0.4620811641216278,
-0.1624165177345276,
0.036349762231111526,
-0.2744046151638031,
0.042551081627607346,
-0.016721805557608604,
-0.1859757900238037,
-0.5632897615432739,
0.2273905724287033,
0.3616355359554291,
-0.06361836940050125,
0.23770982027053... | |
issue.
The problem was the mix of
1 - Being lazy and putting two configuration items on the same line. (In my defense I copied it as one line from [the Tomcat FAQ](http://wiki.apache.org/tomcat/FAQ/Developing)
2 - Using quotes
The combination of these two was causing the issue.
```
wrapper.java.additional.9="-Xdebug ... | [
0.24602587521076202,
0.11041191220283508,
0.4557325541973114,
-0.13834582269191742,
-0.2000526636838913,
0.017262782901525497,
0.056186847388744354,
-0.13662448525428772,
-0.3674648106098175,
-0.3299357295036316,
-0.03809274360537529,
0.41303953528404236,
-0.6798474788665771,
-0.0444157309... | |
the intended use) as two seperate entries
```
wrapper.java.additional.9="-Xdebug"
wrapper.java.additional.9.stripquotes=TRUE
wrapper.java.additional.10="-Xrunjdwp:transport=dt_socket,server=y,address=9135,suspend=n"
wrapper.java.additional.10.stripquotes=TRUE
java "-Xdebug" "-Xrunjdwp:transport=dt_s... | [
0.3583126366138458,
-0.04204600304365158,
0.6637731790542603,
-0.011074957437813282,
-0.4570573568344116,
0.179140105843544,
0.08918191492557526,
0.01358881313353777,
-0.6470979452133179,
-0.5699732303619385,
-0.237301304936409,
0.25925594568252563,
-0.26169082522392273,
-0.017553070560097... | |
This question is pretty straight forward, I literally just want to stream video of a user's computer. Just like recording from a webcam, but with the source coming from the desktop (think "screencasting tool".) I specifically want to do this in pure Flash, no downloads or add-ons.
This would be an easy question for Go... | [
0.7519568204879761,
-0.07333721220493317,
0.3962630033493042,
0.4585452973842621,
-0.12193863838911057,
-0.41384774446487427,
0.13506299257278442,
0.21206219494342804,
-0.06485717743635178,
-0.6327202320098877,
-0.015713801607489586,
0.7078325152397156,
-0.03208336606621742,
-0.01134947128... | |
special helper application called the "ConnectNow Add-In" in order to use their screen sharing feature. The Add-In is actually an executable file that has the elevated privileges necessary to share / record your screen.
If you're looking for ways to add this kind of functionality to a Flash application, your best bet ... | [
0.2257278859615326,
-0.19103358685970306,
0.2531149685382843,
0.32582002878189087,
-0.023793324828147888,
-0.30052244663238525,
0.05676661431789398,
0.18706734478473663,
-0.16400614380836487,
-0.8801721334457397,
-0.15178775787353516,
0.7111288905143738,
-0.15247702598571777,
0.07330335676... | |
**UPDATE 2009-05-21**
I've been testing the #2 method of using a single network share. It is resulting in some issues with Windows Server 2003 under load:
<http://support.microsoft.com/kb/810886>
**end update**
I've received a proposal for an ASP.NET website that works as follows:
Hardware load-balancer -> 4 IIS6 ... | [
0.21388565003871918,
0.2061953991651535,
0.5327906608581543,
0.044489093124866486,
-0.25661835074424744,
-0.12247098237276077,
0.2864908277988434,
-0.13176105916500092,
-0.46542805433273315,
-0.6747701168060303,
-0.2649933695793152,
0.49780330061912537,
-0.13437877595424652,
0.221129640936... | |
servers. The webroots on the 4 IIS servers will be mapped to the single network share.
Which is the better solution?
Option 2 obviously is simpler for deployments since it requires copying files to only a single location. However, I wonder if there will be scalability issues since four web servers are all accessing a ... | [
0.2446228563785553,
-0.1219978854060173,
0.6562038064002991,
0.4318307638168335,
-0.030255315825343132,
-0.17264418303966522,
0.2497096061706543,
-0.334799200296402,
-0.5483450293540955,
-0.9373973608016968,
-0.14310064911842346,
0.2977975010871887,
-0.46797847747802734,
0.4711077809333801... | |
if more IIS servers are added?
To give perspective, this is for a web site that currently receives ~20 million hits per month. At recent peak, it was receiving about 200 hits per second.
Please let me know if you have particular experience with such a setup. Thanks for the input.
**UPDATE 2009-03-05**
To clarify my... | [
0.11182839423418045,
-0.16013939678668976,
0.4398804008960724,
0.15682166814804077,
-0.16320432722568512,
-0.2662178575992584,
0.32310473918914795,
-0.03633692115545273,
-0.4796719253063202,
-0.7406259179115295,
-0.25448498129844666,
0.28589752316474915,
-0.17433544993400574,
-0.0799664929... | |
The deployments are basically "on demand". Theoretically, this push could happen several times within a minute or more. So I'm not sure it would be practical to deploy one web server at time. Thoughts?
I'd share the load between the 4 servers. It's not that many.
You don't want that single point of contention either w... | [
0.4869135320186615,
-0.19042879343032837,
0.46794915199279785,
-0.0019489781698212028,
0.18826408684253693,
0.15077821910381317,
0.13595901429653168,
-0.11870923638343811,
-0.43829137086868286,
-0.6016806960105896,
-0.16928012669086456,
0.6397450566291809,
-0.11484021693468094,
-0.20357474... | |
the load balancer that the server is ready.
We used this strategy in a 200+ web server farm and it worked nicely for deploying without service interruption. | [
0.27715376019477844,
0.026421373710036278,
0.5137097239494324,
0.2132464349269867,
-0.03225184977054596,
-0.1452844887971878,
0.01543416827917099,
0.019634857773780823,
0.038773614913225174,
-0.6700795292854309,
-0.06197688728570938,
0.5297240614891052,
0.10409238934516907,
-0.065486885607... | |
Does anyone know if you can run NUnit on Mono? The reason I ask is because on [the download page](http://www.nunit.org/index.php?p=download) it says:
> For some releases, we provide a zipped package for use under Mono.
However, the only release that actually has a separate mono release (judging by its label that says... | [
0.6109523177146912,
0.21599604189395905,
0.025601595640182495,
0.028514204546809196,
-0.3835514485836029,
-0.2848345935344696,
0.4841972589492798,
-0.017589030787348747,
-0.2707675099372864,
-0.22692802548408508,
-0.06316778808832169,
0.4983978271484375,
-0.19297854602336884,
0.17986661195... | |
work? What exactly makes something Mono runnable?
Mono 2.4 will ship with NUnit 2.4.8, and has been in use by the Mono project for their tests for several months, so it should work pretty well.
Mono 2.4 preview: <http://mono.ximian.com/monobuild/preview/download-preview/> | [
0.6785078644752502,
-0.0008113494841381907,
0.06118183955550194,
0.05934471637010574,
-0.06382256001234055,
-0.31451427936553955,
0.36123713850975037,
-0.2917615473270416,
0.1158381775021553,
-0.06283069401979446,
-0.22451090812683105,
0.6258159875869751,
-0.3493605852127075,
-0.2850904762... | |
I'm looking for a primary source (or a really good explanation) to back up the claim that the use of `autorelease` is dangerous or overly expensive when writing software for the iPhone.
Several developers make this claim, and I have even heard that Apple does not recommend it, but I have not been able to turn up any c... | [
0.2329450249671936,
0.38212165236473083,
0.006447908468544483,
0.041168730705976486,
0.2616218626499176,
-0.2443711757659912,
0.34841951727867126,
0.14430475234985352,
-0.29344573616981506,
-0.2276420146226883,
-0.09200914204120636,
0.7773462533950806,
-0.5017960071563721,
-0.3316452205181... | |
that small penalty is enough to make Apple recommend against it.
What's the real story?
(cannot accept your own answer?)
Well, after all that, I did manage to find a reference from Apple Developer, added as a side-note near the bottom of the page:
> iPhone OS Note: Because on iPhone OS
> an application executes in ... | [
0.40372997522354126,
-0.04380353167653084,
0.06434004008769989,
0.2891431748867035,
-0.10811656713485718,
-0.12253346294164658,
0.4197559952735901,
0.051441438496112823,
-0.2848335802555084,
-0.2143944501876831,
-0.023696813732385635,
0.5707162618637085,
-0.26970338821411133,
-0.0820271000... | |
avoiding it altogether.
(and now for my comment)
It sounds like there is a certain amount of overhead in maintaining the pool. I read [this article](http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmAutoreleasePools.html) which would lead me to probably avoid autorelease as much as possi... | [
0.3816012442111969,
0.2528865337371826,
0.014577207155525684,
0.0808008462190628,
0.018668267875909805,
-0.14429055154323578,
0.23579703271389008,
0.11358300596475601,
-0.5457380414009094,
-0.2356056421995163,
0.2255752682685852,
0.7889201045036316,
-0.18520550429821014,
-0.079560525715351... | |
I have the following code:
```
Dim i As Integer = dtResult.Rows.Count
For i = 0 To dtResult.Rows.Count Step 1
strVerse = blHelper.Highlight(dtResult.Rows(i).ToString, s)
' syntax error here
dtResult.Rows(i) = strVerse
Next
```
I want to add a `strVerse` to the current row.
What am I doing wrong?
The ... | [
0.18734797835350037,
0.16481569409370422,
0.7841448187828064,
-0.2784723937511444,
-0.20919716358184814,
0.11687156558036804,
0.20828768610954285,
-0.32924458384513855,
-0.1169176995754242,
-0.7502845525741577,
0.10628087818622589,
0.5339943170547485,
-0.4581088423728943,
0.407080739736557... | |
column of a particular row you can access it by name or index. For instance you could write the following code to update the column "Foo" to be the value strVerse
```
dtResult.Rows(i)("Foo") = strVerse
``` | [
-0.051057904958724976,
0.14448843896389008,
0.814500093460083,
-0.20052531361579895,
-0.10459735244512558,
0.287341445684433,
-0.07652880251407623,
-0.11021479219198227,
-0.20747831463813782,
-0.6086508631706238,
0.20160065591335297,
0.34649842977523804,
-0.5951985120773315,
0.331674456596... | |
I have a function in which one of the function arguments is an integer. During function invocation I am passing an enumerated datatype to this function. After building using gcc, any access to the INTEGER variable inside the function causes a segmentation fault.
### Sample code:
```
void somefun (unsigned int nState)... | [
0.14554725587368011,
0.012705830857157707,
0.26622313261032104,
-0.17800572514533997,
0.12239114940166473,
-0.0823010802268982,
0.2801486551761627,
-0.2920501232147217,
0.06956183165311813,
-0.4751615822315216,
0.08859606832265854,
0.2661495506763458,
-0.3283769190311432,
0.453999310731887... | |
= -1,
STATE_NICE,
STATE_GREEDY
} E_STATE;
int main (int argc, char *argv [])
{
somefun (STATE_NICE);
}
```
From all your answers it seems that the code is logically correct, and I need to investigate the *real* reason for the crash. I will investigate it and post it soon. | [
0.3065461814403534,
0.24411241710186005,
0.10786399245262146,
-0.09489991515874863,
0.26145055890083313,
-0.11848393827676773,
0.4055948555469513,
0.12630388140678406,
-0.1035260409116745,
-0.5645740628242493,
-0.2223314493894577,
0.32860782742500305,
-0.20625361800193787,
0.40141963958740... | |
What would be the sql for the following,
I have a date of birth in an int field,
ie YYYYMMDD = 19600518
I would like to get the age.
None of the other answers are actually calculating age. They're calculating the number of year boundaries and not taking the birthday into account.
To calculate the age, you'll need t... | [
0.460395872592926,
0.14033225178718567,
0.40704041719436646,
-0.1372527927160263,
0.24210840463638306,
0.1957908570766449,
-0.03610594943165779,
-0.12321435660123825,
-0.1550155133008957,
-0.4820626676082611,
0.07627838850021362,
0.1979113519191742,
0.27229446172714233,
0.6478242874145508,... | |
With forms I've always used
```
<form method="post" action="<?php echo strip_tags($_SERVER['REQUEST_URI']); ?>">
```
To get my forms to submit to themselves.
I use `striptags()` in case someone links to:
```
http://www.mysite.com/page-with-form.php?bla="><script src="http://www.nasty.com/super-nasty.js"></script><... | [
0.7395789623260498,
0.08209013193845749,
0.8169689774513245,
-0.06765267252922058,
-0.19336672127246857,
-0.19257546961307526,
0.334179162979126,
-0.4113559424877167,
-0.2763497531414032,
-0.520081639289856,
-0.24342723190784454,
0.2616444230079651,
-0.2814212739467621,
-0.1325798928737640... | |
Does anyone have an explanation of how javascript could do this. Somehow this function is both true and false at the exact same time. This is just one pass, no looping or anything.
```
console.log(key);
if (this.watches.get(key)) {
console.log("found it");
} else {
console.log("whhhat?");
}
... | [
0.330287903547287,
-0.0017216664273291826,
0.32716187834739685,
0.07889532297849655,
0.3232495188713074,
-0.37817031145095825,
0.31095626950263977,
0.059133224189281464,
-0.2657148838043213,
-0.6044813990592957,
-0.09263196587562561,
0.5419119596481323,
-0.32499346137046814,
0.329452842473... | |
I have ever seen.
<http://snipt.org/Hkl>
I use mootools framework so the this.watches = $H({}); is a hashtable. I was using an Array and was experiencing the exact same issue, then switched it to $H({}) because I thought i was doing something wrong.
If this
```
Object search-key=Object $family=Object
```
is produc... | [
0.6953889727592468,
-0.0831717997789383,
0.29766958951950073,
-0.014755098149180412,
0.21206235885620117,
-0.23867309093475342,
0.16059638559818268,
0.1848417967557907,
-0.44963088631629944,
-0.7030534744262695,
0.12361545860767365,
0.2377469539642334,
-0.3954774737358093,
0.33372873067855... | |
most likely scenario is that `key` in the second time is the empty string
try `console.log("")`
it prints nothing
also try this:
```
>>> console.log(""); console.log(1); console.log(""); console.log(2)
```
copy the output and paste it in any text editor (i.e. paste it as plain text)
```
1
2
```
it *looks like* ... | [
0.004611775279045105,
-0.10904975235462189,
0.5668472051620483,
-0.007561514154076576,
0.15248848497867584,
-0.15745408833026886,
0.2336149513721466,
-0.06821490824222565,
-0.1698678433895111,
-0.7604737281799316,
-0.2923760712146759,
0.6220366358757019,
-0.3474658727645874,
-0.02092372998... | |
this**
Change `console.log(key)` to `console.log("key: " + key)` and you should see something like this:
```
key: search-key
found it
Object search-key=Object $family=Object
key:
whhhat?
Object search-key=Object $family=Object
``` | [
-0.12903602421283722,
0.05797223746776581,
0.6446677446365356,
-0.06527570635080338,
0.531324028968811,
-0.2782176733016968,
0.01886792667210102,
0.06557230651378632,
-0.2684176564216614,
-0.7034121155738831,
-0.19528208673000336,
0.5127618908882141,
-0.12671521306037903,
0.456113904714584... | |
I feel like I'm using Ruby the wrong way here: I want to generate all possible matches for the regular expression `/[0-9A-Za-z]{3}/`
I can't use `succ` because `"999".succ => "1000"` and `"zZz".succ => "aaAa"`.
I'm having trouble using ranges because I can't seem to union `(0..9), ('A'..'Z'), ('a'..'z')`
So I wrote:
... | [
-0.03542303666472435,
0.43451422452926636,
0.4101376235485077,
-0.2536172866821289,
-0.1930255889892578,
0.24689210951328278,
0.6808153390884399,
-0.46184098720550537,
0.1121792122721672,
-0.17277270555496216,
-0.21768413484096527,
0.7229471206665039,
-0.13062602281570435,
0.19343988597393... | |
}
}
end
alphaNumericX3.each{|x|p x}
```
My question is 2 fold:
Is there a less ugly way, and is there a way where `alphaNumericX3` could be defined from the parameters `(alphaNumeric, 3)`?
PS I'm aware that I could define a new class for range. But thats definitly not shorter. If you can make this next block shor... | [
-0.10294708609580994,
0.029433125630021095,
0.11730160564184189,
-0.20280204713344574,
-0.29422107338905334,
0.007919170893728733,
0.33084455132484436,
-0.6264725923538208,
-0.0006745901191607118,
-0.7191755175590515,
0.06804929673671722,
0.4870859384536743,
-0.34843748807907104,
0.0765962... | |
end
def succ
def inc(x,n)
return AlphaNum.new('0'*(@length+1)) if x<0
case n[x]
when '9'
n[x]='A'
when 'Z'
n[x]='a'
when 'z'
n[x]='0'
return inc(x-1,n)
else
n[x]=n[x].succ
end | [
-0.2308204621076584,
-0.6082984805107117,
0.4617775082588196,
-0.17594027519226074,
-0.007559985853731632,
0.07972168177366257,
0.4115210771560669,
-0.32223841547966003,
0.13687092065811157,
-0.071922168135643,
-0.3623780608177185,
0.4916177988052368,
-0.2784437835216522,
0.369804978370666... | |
return AlphaNum.new(n.to_s)
end
inc(@length-1,@a.clone)
end
end
# (AlphaNum.new('000')..AlphaNum.new('zzz')).each{|x|p x}
# === alphaNumericX3.each{|x|p x}
```
Use [`Array#product`](http://ruby-doc.org/core/Array.html#method-i-product):
```
alpha_numerics = ('0'..'9').to_a + ('a'..'z').to_a + ('A'..'Z').to... | [
-0.021404212340712547,
0.12875400483608246,
0.506488561630249,
-0.47253260016441345,
-0.0753626599907875,
0.26258793473243713,
0.18662594258785248,
-0.7197561264038086,
-0.1843031942844391,
-0.35728415846824646,
-0.3145950734615326,
0.2624967396259308,
-0.49849337339401245,
0.5064508318901... | |
Steps to reproduce:
1. Create Word 2007 Template Project (Visual Studio 2008 Professional SP1)
2. Place DateContentControl on document
3. Save, Publish, open .dotx
4. Modify DateContentControl, Save
5. Click No, Close Word
6. Open Saved document, Modify DateContentControl - no more prompts on subsequent saves...
7. Ch... | [
0.2477640062570572,
-0.10171256959438324,
0.48416611552238464,
0.029237175360322,
0.043395791202783585,
0.2444041520357132,
0.19278819859027863,
-0.3720792531967163,
0.08839749544858932,
-0.5479812026023865,
0.04591512680053711,
0.6834610104560852,
-0.3761812746524811,
0.06054430454969406,... | |
of the attached templated to `true`.
In VBA this would be:
```
ActiveDocument.AttachedTemplate.Saved = True
``` | [
0.2923518717288971,
-0.16305214166641235,
0.13189975917339325,
-0.21810370683670044,
0.11649475246667862,
-0.12861847877502441,
0.1561577469110489,
-0.2512210011482239,
0.08130620419979095,
-0.19141557812690735,
-0.27449238300323486,
0.6542146801948547,
-0.5085118412971497,
0.1750841289758... | |
Is there some way to delay defining the size of an array until a class method or constructor?
What I'm thinking of might look something like this, which (of course) doesn't work:
```
class Test
{
private:
int _array[][];
public:
Test::Test(int width, int height);
};
Test::Test(int width, int height)... | [
0.20818884670734406,
-0.018748506903648376,
-0.210383802652359,
0.06416922807693481,
-0.002807996002957225,
0.186935693025589,
0.18461371958255768,
-0.481238454580307,
-0.35192322731018066,
-0.5656686425209045,
-0.10470899939537048,
0.5176886320114136,
-0.23347610235214233,
0.1349287927150... | |
Test method you would need to first allocate the array of pointers, and then for each pointer allocate an array of integers:
```
_array = new *int [height];
for (int i = 0; i < height; i++)
{
_array [i] = new int[width];
}
```
And then when the object is released you will need to explicit delete the memory you ... | [
0.17244330048561096,
-0.10647366940975189,
-0.09030171483755112,
0.09857714176177979,
0.0506245382130146,
0.1418604552745819,
0.3964676558971405,
-0.5621944665908813,
0.3122488856315613,
-0.4190126061439514,
-0.024911340326070786,
0.2988203763961792,
-0.37114417552948,
0.10505178570747375,... | |
I tried to make character by character comparison under string type,
with the following code:
```
vector <int> getQuality(string seedTag, vector <string> &MuTag) {
vector <int> Quals;
for (unsigned i = 0; i<MuTag.size(); i++) {
Quals.push_back(-40);
cout << MuTag[i] << " " << seedTag[i... | [
-0.2243301272392273,
-0.3688839077949524,
0.434533029794693,
-0.4442366659641266,
-0.11320359259843826,
0.6615933179855347,
0.2233593612909317,
-0.4674871563911438,
-0.08324271440505981,
-0.6820930242538452,
0.09647881239652634,
0.3575425446033478,
-0.44018813967704773,
0.01651393994688987... | |
}
}
return Quals;
}
```
But why it gives such error:
```
Mycode.cc:33: error: no match for 'operator==' in '(+ MuTag)->std::vector<_Tp, _Alloc>::operator[] [with _Tp = std::string, _Alloc = std::allocator<std::string>](((long unsigned int)i)) == seedTag. std::basic_string<_CharT, _Traits, _Alloc>::opera... | [
-0.5909125208854675,
-0.07590806484222412,
0.22071294486522675,
-0.14953447878360748,
0.1473582237958908,
0.34063151478767395,
0.29319247603416443,
-0.3745381236076355,
-0.08200573921203613,
-0.8498386144638062,
0.07808183878660202,
0.3171806037425995,
-0.20132242143154144,
0.1323007643222... | |
I'm making a bookmarklet which will load jQuery if the object is not found. The loading will check on the version of jQuery. The code is like:
```
(function(){
var myBkl = {
loadScript: function(src) {
if(window.jQuery && window.jQuery.fn.jquery == '1.3.2'){
return;
... | [
0.2746391296386719,
-0.06259679794311523,
0.6190156936645508,
-0.12318593263626099,
0.042527779936790466,
-0.3455088436603546,
0.18550358712673187,
0.003879613010212779,
-0.14687354862689972,
-0.4493608772754669,
-0.017703160643577576,
0.4284224212169647,
-0.35235723853111267,
0.2172021120... | |
var s = document.createElement('script');
s.setAttribute('src', src);
s.setAttribute('type', 'text/javascript');
document.getElementsByTagName('head')[0].appendChild(s);
},
whenLoaded: function(callback){
if (typeof(window.jQuery) !== 'undefined' && windo... | [
-0.23635521531105042,
-0.3421139419078827,
0.8461453318595886,
-0.48001065850257874,
0.028185440227389336,
0.19866596162319183,
0.4231015741825104,
-0.3904222548007965,
0.08520462363958359,
-0.6237010359764099,
-0.6581516265869141,
0.47616201639175415,
-0.3696747422218323,
0.14175768196582... | |
}
else {
setTimeout((function() {myBkl.whenLoaded(callback); }), 100);
}
},
init: function($){
console.log($.fn.jquery);
}
}; | [
-0.10076439380645752,
-0.33996886014938354,
0.720779299736023,
-0.21548117697238922,
0.546073317527771,
0.1877424716949463,
0.17590993642807007,
-0.2096540778875351,
0.14172357320785522,
-0.4833011329174042,
-0.33396071195602417,
0.8009618520736694,
-0.2672901749610901,
0.14615236222743988... | |
myBkl.loadScript('http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js');
myBkl.whenLoaded(myBkl.init);
})();
```
I use this bookmarklet builder to create the bookmarklet <http://subsimple.com/bookmarklets/jsbuilder.htm>
Obviously if the page already has jQuery loaded. The loading of the 1.3.2 script wou... | [
-0.029183167964220047,
0.010052027180790901,
0.7619350552558899,
-0.10189008712768555,
-0.26144346594810486,
-0.3005129396915436,
0.4718472957611084,
-0.016419708728790283,
-0.08003141731023788,
-0.7850638031959534,
-0.10063891112804413,
0.49231892824172974,
-0.5026282072067261,
0.06559298... | |
or used.
Good Luck / kinda curious to learn if this works for you~ | [
0.38304439187049866,
-0.057563114911317825,
0.21063905954360962,
0.11614969372749329,
0.3580266535282135,
0.034396979957818985,
0.3407753109931946,
0.3890555799007416,
0.08058296144008636,
-0.5249189138412476,
-0.05233314633369446,
0.654453694820404,
0.3869311809539795,
-0.0107013024389743... | |
What is the standard macro used to write text to the output window in Win32 (outside MFC)?
I am looking for something which the pre-processor conditionally excludes from the release build.
We are on the verge of handcrafting our own.
Maybe you're thinking of ATLTRACE? Not quite "the standard macro", but pretty close, ... | [
0.19183465838432312,
-0.14775922894477844,
0.13791508972644806,
-0.048988208174705505,
-0.06506460905075073,
0.03403486683964729,
0.07312104851007462,
0.5572836399078369,
0.12307269126176834,
-0.42366302013397217,
0.11348385363817215,
0.9663138389587402,
-0.18141621351242065,
-0.3038488626... | |
For testing purposes, I want to install two different instances of firefox on ubuntu - so that they don't share cookies.
(I want to simultaneously login with both instances as different users to our website).
How do I do that?
I do it with Firefox & Opera, but I prefer Firefox (because of firebug).
Check out the [prof... | [
0.4482143223285675,
0.3038712441921234,
0.24898889660835266,
-0.07940604537725449,
0.06798680871725082,
-0.2519965171813965,
0.19935959577560425,
0.12986841797828674,
0.0033471977803856134,
-0.9555839896202087,
-0.06371896713972092,
0.7352928519248962,
-0.4513776898384094,
0.22173929214477... | |
I'm using a TWebbrowser component in my Delphi app, whose content I load programmatically:
```
(aWebBrowser.Document as IPersistStreamInit).
Load(TStreamAdapter.Create(aMemoryStream))
```
On every Load the component produces an annoying click sound. Can this be disabled?
TIA
Take a ... | [
0.30446016788482666,
-0.007884897291660309,
0.17445911467075348,
0.19815723598003387,
0.24055436253547668,
0.08422718197107315,
0.1889350414276123,
-0.25996288657188416,
-0.062061209231615067,
-0.5848124623298645,
0.1098586842417717,
0.7818363308906555,
-0.14358001947402954,
0.269797682762... | |
When you know that your software (not a driver, not part of the os, just an application) will run mostly in a virtualized environment are there strategies to optimize your code and/or compiler settings? Or any guides for what you should and shouldn't do?
This is not about a 0.0x% performance gain but maybe, just maybe... | [
0.3845498561859131,
-0.0025024106726050377,
-0.18365085124969482,
0.4088137745857239,
0.18138422071933746,
-0.08461524546146393,
0.29851871728897095,
0.10163656622171402,
-0.31966835260391235,
-0.7834439277648926,
-0.16615495085716248,
0.7454706430435181,
-0.3851665258407593,
-0.0335157886... | |
things for applications, if there are any.
In my case it will be C++ Code and probably VMWare but I want to keep the question as language/product-agnostic as possible. I wonder if there even are such strategies or if this would be a complete waste of time - after all the concept of virtualization is that you don't ha... | [
0.41516807675361633,
-0.07029842585325241,
0.18450947105884552,
0.5691637992858887,
0.09832543134689331,
-0.08512167632579803,
-0.057053714990615845,
0.24017924070358276,
-0.49548932909965515,
-0.5222097039222717,
-0.0902806967496872,
0.4933731257915497,
-0.23735520243644714,
-0.0022065434... | |
512 MB, its very typical that the privileged domain did NOT look at how much memory the paravirtualized kernel was actually promising to processes (i.e. Committed\_AS). Actually, with Xen, unless this value is placed on Xenbus, the privileged host has no idea what such a balloon will do. I believe this also coincides w... | [
-0.0331558883190155,
-0.13506409525871277,
0.12341614812612534,
0.41579729318618774,
0.2205958515405655,
-0.06468454003334045,
0.06414806842803955,
0.1617119461297989,
-0.6086651682853699,
-0.40871110558509827,
-0.19132480025291443,
0.5030562281608582,
-0.2795014977455139,
0.01553198508918... | |
posix\_madvise() to tell the PV kernel just how much you do or do not need buffering is always a good idea.
Beyond that, there's very little that you can do .. since you're talking only to the paravirtualized kernel, which is designed to make processes oblivious to virtualization in the first place.
I don't use KVM m... | [
0.3276684582233429,
-0.3277808129787445,
0.15818677842617035,
0.02748425118625164,
-0.14373259246349335,
-0.13396798074245453,
0.05360709875822067,
0.22092759609222412,
-0.272273451089859,
-0.29721799492836,
-0.05880392715334892,
0.7280662655830383,
-0.4474598169326782,
-0.2219494730234146... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.