text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
The library original NoMod() is declared as a const.
My NoMod() differs from Base in the fact that it needs to modify its own member variable.
Thus, for my own NoMod() to compile and get called when Draw() is called, I had to
1) Implement Derive::NoMod() as a const
2) make my int y mutable.
Is this the best I ca... | [
0.08663035929203033,
-0.27500784397125244,
0.12784363329410553,
0.2252114713191986,
0.046420298516750336,
-0.10704879462718964,
0.08557029068470001,
-0.15975335240364075,
0.2231263965368271,
-0.2586667835712433,
-0.04815416783094406,
0.6219871640205383,
-0.3742324411869049,
0.1397523432970... | |
of the object.
Typically attributes are rarely declared as mutable.
I have coined the protologism 'contribute' it denote
data members that are simply 'working memory/storage'
and that are somewhat divorced from the state of the object.
Contributes have no contextual relevance to the user of the object,
they exist in ... | [
0.13028796017169952,
-0.06518173217773438,
-0.11598589271306992,
0.37077680230140686,
-0.13223284482955933,
-0.16482661664485931,
0.13138701021671295,
0.20571774244308472,
-0.3742261528968811,
-0.5896051526069641,
-0.33607369661331177,
0.43608927726745605,
-0.13894134759902954,
0.507372617... | |
not represent the data in the list.
Even if the list is sorted and the
pointer is set to the new first item in the list,
the user of the list object could care less how the
list is maintained. Only that the list data has
been modified or not and that the the list is sorted or not is
relevant to the user's perspective... | [
0.39048829674720764,
-0.0030490970239043236,
0.08188020437955856,
0.13727670907974243,
-0.2195015847682953,
0.1349368691444397,
0.22616980969905853,
-0.14964184165000916,
-0.36630499362945557,
-0.5136816501617432,
0.0521935299038887,
0.3981100022792816,
-0.5686745643615723,
0.3327012956142... | |
used simply to efficiently remember the state
without having to scan the list.
As another example, if you have a const method that searches the list.
Suppose you know that typically the search will return the
most recently previously searched for item,
you would keep a pointer in your class to such a item so your met... | [
0.14217987656593323,
-0.17088592052459717,
-0.022518528625369072,
0.3149581253528595,
-0.1390737146139145,
-0.019384535029530525,
-0.025731313973665237,
-0.09325093030929565,
-0.3116633892059326,
-0.675919234752655,
0.15562398731708527,
0.2239035665988922,
-0.09614713490009308,
0.323831051... | |
speed up the search. Even though the
search updates the pointer contribute, the method is effectively
const because none of the items' data in the container are modified.
So, data members that are attributes are usually not declared mutable,
and data members that contribute to the functioning of an object will usually... | [
-0.0010190748143941164,
-0.10131310671567917,
0.39323586225509644,
0.39944055676460266,
0.12105698138475418,
-0.19942621886730194,
0.24903611838817596,
-0.2543257474899292,
-0.28961801528930664,
-0.7245292663574219,
-0.26635047793388367,
0.6163416504859924,
-0.18706688284873962,
0.35080459... | |
What is the cleanest way to parse binary data in clojure?
I need to be able to read/write equally cleanly to a file or a socket.
something like:
```
(read-data source-of-data)
=> { :index 42 , :block-size 4 , data-size: 31415, :data (1 2 3 4 ...)}
```
and the reverse for putting data back.
It would be really... | [
0.0703742653131485,
0.10808218270540237,
0.22828242182731628,
0.1707291305065155,
-0.21133741736412048,
-0.17019933462142944,
0.11925115436315536,
-0.1126568466424942,
-0.2016151398420334,
-0.6108133792877197,
-0.07991918176412582,
0.33936455845832825,
-0.19110725820064545,
-0.015466377139... | |
:uint32
:msg-type (enum :byte {:a \A, :b \B})
:status (string :ascii :length 11)])
(def buffer (byte-array 16))
(.read (input-stream "filename.bin") buffer)
(decode example-codec buffer)
(encode example-codec {:id 42, :msg-type :a, :status "A-OKAY"})
```
The `bit-map` function allows bit level formats, but... | [
-0.37708520889282227,
-0.030950350686907768,
0.44190824031829834,
-0.0246212687343359,
0.23204898834228516,
-0.0286556426435709,
0.13709071278572083,
-0.2672562599182129,
-0.15899807214736938,
-0.63065105676651,
-0.4578079283237457,
0.3836502134799957,
-0.2182762622833252,
-0.0900947302579... | |
I use emacs to do some coding, and text editing. When I create a new coding project, I simply create a new folder, and add source code into it.
The problem is, with multi-folders, it is hard to change back to the
top, and run the makefile.
Is there any good method to do project management like eclipse or
other IDE... | [
0.588373601436615,
0.20811501145362854,
-0.35878628492355347,
0.02038060687482357,
0.27312901616096497,
0.011337148025631905,
0.010341180488467216,
0.10006509721279144,
-0.10572755336761475,
-0.4339131712913513,
0.16767296195030212,
0.6238463521003723,
-0.1419348120689392,
0.05065625905990... | |
I'd quite like to write some Google App Engine apps, but I'm a c# developer by trade, and as such I like static typing and Linq (or at least extensions + lambdas + predicates, if not query syntax). Is there a language I can use on the JVM that offers these features?
<http://kotlin.jetbrains.org/>
Easy to learn, powerf... | [
0.2052120566368103,
0.22392062842845917,
0.09650437533855438,
0.23449046909809113,
0.089792899787426,
-0.18086686730384827,
0.01744820736348629,
0.4207952320575714,
-0.08550535887479782,
-0.3117508590221405,
0.04060973972082138,
0.6172083020210266,
-0.25875401496887207,
-0.4206904172897339... | |
I have created an Item Template using the "Export Template" wizard. I opened up the XML file and made a couple of minor changes, then rezipped the package. Then I checked the item template into source control so that everyone on the team can access it if they want.
But for the life of me I can't get the template to sh... | [
0.6895543336868286,
0.1365700215101242,
0.24870611727237701,
-0.22053216397762299,
-0.1525925099849701,
-0.012318745255470276,
0.1569407880306244,
-0.17112983763217926,
-0.30541959404945374,
-0.8467207551002502,
-0.09902744740247726,
0.5130787491798401,
-0.17967920005321503,
0.157630071043... | |
Developer/ etc)
But nothing shows up. Has anyone else managed to distribute Item Templates to their team mates before?
In order to have a VS item template appear, you need to make sure that you run "devenv.exe /installvstemplates" after you have copied the .zip file containing your .vstemplate and template code file i... | [
0.4938778877258301,
-0.3701368272304535,
0.37948480248451233,
0.17345714569091797,
-0.07085327804088593,
-0.16514532268047333,
0.4818778932094574,
-0.321095734834671,
-0.0891258642077446,
-0.9028387665748596,
-0.15170441567897797,
0.6307867169380188,
-0.2092277556657791,
-0.033679746091365... | |
your colleagues just need to install the package and they are up and running!
Hope this helps. | [
0.6717323660850525,
0.17660553753376007,
0.1623384952545166,
0.044222861528396606,
0.20676016807556152,
-0.3375813364982605,
0.6250072717666626,
0.34225985407829285,
-0.04161468520760536,
-0.45111602544784546,
0.027878951281309128,
0.3923933804035187,
0.2446443736553192,
-0.250392407178878... | |
Having a console application, a server accepting several connections from clients, is it possible to have a listener or an event on a closing application? I want, in this event, tell all connected clients to gently disconnect before the application really closes itself.
Any solution? Thank you!
You want to use a shutd... | [
0.17322269082069397,
0.3300859332084656,
0.5654098391532898,
-0.2148585468530655,
0.28991076350212097,
-0.2863151431083679,
0.14351581037044525,
0.041438136249780655,
-0.3889993131160736,
-0.7273910641670227,
-0.2902213931083679,
0.6614891290664673,
-0.17593960464000702,
0.3051882982254028... | |
I'm attempting to provide a script-only solution for reading the contents of a file on a client machine through a browser.
I have a solution that works with Firefox and Internet Explorer. It's not pretty, but I'm only trying things at the moment:
```
function getFileContents() {
var fileForUpload = document.forms... | [
0.19881242513656616,
-0.1414230763912201,
0.6194766759872437,
-0.12642896175384521,
0.10198196768760681,
-0.045470885932445526,
0.5229485630989075,
-0.08403011411428452,
0.06439955532550812,
-1.0981006622314453,
-0.1549626737833023,
0.6401653289794922,
-0.3518894910812378,
0.14488761126995... | |
the IE method
var fileContents = ieReadFile(fileName);
document.forms[0].fileContents.innerHTML = fileContents;
}
}
function ieReadFile(filename)
{
try
{
var fso = new ActiveXObject("Scripting.FileSystemObject");
var fh = fso.OpenTextFile(filename, 1);
var... | [
-0.12515945732593536,
-0.28875333070755005,
0.6466319561004639,
-0.2601793110370636,
0.1423504501581192,
0.05360684543848038,
0.2954409122467041,
-0.1989172399044037,
0.11385885626077652,
-0.836188554763794,
-0.5767707824707031,
0.674335241317749,
-0.6223737597465515,
-0.2207508236169815,
... | |
contents;
}
catch (Exception)
{
return "Cannot open file :(";
}
}
```
I can call `getFileContents()` and it will write the contents into the `fileContents` text area.
**Is there a way to do this in other browsers?**
I'm most concerned with Safari and Chrome at the moment, but I'm open to sug... | [
0.3294776678085327,
0.13861896097660065,
0.3372304141521454,
-0.02193359099328518,
0.07248374074697495,
-0.351509153842926,
0.3145647943019867,
0.26459816098213196,
-0.3199111819267273,
-0.7073864936828613,
-0.4187602996826172,
0.5971776843070984,
-0.2932744324207306,
0.05894596129655838,
... | |
can send this information back as a verification.
**Edited to add information about the File API**
Since I originally wrote this answer, the [File API](http://dev.w3.org/2006/webapi/FileAPI/) has been proposed as a standard and [implemented in most browsers](http://caniuse.com/#feat=fileapi) (as of IE 10, which added ... | [
0.41561275720596313,
-0.04903588443994522,
0.47812268137931824,
0.0543505884706974,
0.12687169015407562,
-0.109593965113163,
0.315725177526474,
-0.1755087524652481,
-0.10011900216341019,
-0.7621235847473145,
-0.18551276624202728,
0.5185121893882751,
-0.10874690860509872,
-0.164910733699798... | |
online. You would use it as follows:
```
var file = document.getElementById("fileForUpload").files[0];
if (file) {
var reader = new FileReader();
reader.readAsText(file, "UTF-8");
reader.onload = function (evt) {
document.getElementById("fileContents").innerHTML = evt.target.result;
}
reade... | [
-0.01643112674355507,
-0.12764345109462738,
0.5580059885978699,
-0.0752415731549263,
-0.1671501100063324,
-0.31038355827331543,
0.02375727705657482,
-0.007505313027650118,
-0.2163023203611374,
-1.0546280145645142,
-0.30810123682022095,
0.631454348564148,
-0.3499278128147125,
0.038834095001... | |
According to the [commit message](http://trac.webkit.org/changeset/34702) for the File and FileList support, these are inspired by [Mozilla's File object](https://developer.mozilla.org/en/nsIDOMFile), but they appear to support only a subset of the features.
If you would like to change this, you could always [send a p... | [
0.6852160692214966,
0.07446973770856857,
0.1726776361465454,
0.12112720310688019,
-0.06940285116434097,
-0.2549722194671631,
0.0673670843243599,
-0.03728841617703438,
-0.5497156381607056,
-0.7606801986694336,
-0.2850870192050934,
0.5105857253074646,
-0.11952116340398788,
-0.036511555314064... | |
submitting either a patch or a proposal for inclusion to HTML 5 does mean some work defending the idea, but the fact that Firefox already implements it gives you something to start with. | [
0.5524464845657349,
0.08887738734483719,
0.10294858366250992,
0.013115490786731243,
-0.12988267838954926,
-0.5998560786247253,
0.22319850325584412,
-0.11893539130687714,
-0.2809315621852875,
-0.5872354507446289,
-0.26619666814804077,
0.29788392782211304,
-0.3506618142127991,
-0.35141548514... | |
I've been batting this problem around in my head for a few days now and haven't come to any satisfactory conclusions so I figured I would ask the SO crew for their opinion. For a game that I'm working on I'm using a Component Object Model as described [here](http://cowboyprogramming.com/2007/01/05/evolve-your-heirachy/... | [
0.24082070589065552,
-0.01298834104090929,
0.47130894660949707,
0.06880766898393631,
0.195957750082016,
-0.07073116302490234,
-0.026812687516212463,
-0.34657806158065796,
-0.2685432732105255,
-0.44809943437576294,
0.17550264298915863,
0.7476384043693542,
0.0454711951315403,
0.1198938563466... | |
type or any type derived from it.
In considering this I've first implemented a simple RTTI scheme that stores the base class type through the derived type in that order. This means that the RTTI for, say, a sprite would be: component::renderable::sprite. This allows me to compare types easily to see if type A is deriv... | [
0.2886892557144165,
-0.1320323944091797,
0.568488359451294,
0.09522265195846558,
-0.5027027726173401,
0.12218408286571503,
0.21299345791339874,
-0.3775647282600403,
-0.08722257614135742,
-0.42769020795822144,
0.17746219038963318,
0.5736811757087708,
-0.37594467401504517,
0.1150128841400146... | |
that comes to mind is a tree using the types as nodes, like so:
```
component
/ \
timer renderable
/ / \
shotTimer sprite particle
```
At each node I would store a list of all components of that type. That way requesting the "component::renderable" node will g... | [
0.1482546329498291,
0.05018885061144829,
0.49553728103637695,
-0.05404442176222801,
-0.3649601340293884,
0.41922539472579956,
0.09598258137702942,
-0.014288019388914108,
-0.06635337322950363,
-0.49197232723236084,
0.14914478361606598,
0.38383859395980835,
-0.4145238399505615,
0.25724825263... | |
to all renderable components regardless of derived type. The rub is that I want to be able to access those components with an iterator, so that I could do something like this:
```
for_each(renderable.begin(), renderable.end(), renderFunc);
```
and have that iterate over the entire tree from renderable down. I have t... | [
-0.02346503920853138,
0.20525163412094116,
0.29479604959487915,
-0.3248886466026306,
-0.19115735590457916,
0.1646754890680313,
0.2905138432979584,
-0.0889316201210022,
-0.17906615138053894,
-0.7611123323440552,
-0.16031739115715027,
0.5704088807106018,
-0.14099739491939545,
0.1869979202747... | |
needlessly? Is there some obvious simplification I'm missing, or pre-existing structure I should be using? Or is this just inheritly a complex problem and I'm probably doing just fine already?
Thanks for any input you have!
You should think about how often you need to do the following:
* traverse the tree
* add/remo... | [
0.23006348311901093,
-0.0129494434222579,
0.056647177785634995,
0.317552775144577,
-0.1955251395702362,
-0.028055204078555107,
0.5677767992019653,
-0.08165045827627182,
-0.4629792273044586,
-0.6351590156555176,
0.3767411708831787,
0.5090089440345764,
-0.1424444615840912,
0.2084779292345047... | |
from. Something like this:
```
map<string,set<componenet *>> myTypeList
```
Then for an object that is of type component::renderable::sprite
```
myTypeList["component"].insert(&object);
myTypeList["renderable"].insert(&object);
myTypeList["sprite"].insert(&object);
```
By registering each obejct in multiple list... | [
-0.16517487168312073,
-0.10623713582754135,
0.7974053621292114,
-0.1551491767168045,
-0.29743823409080505,
0.13941466808319092,
0.21165592968463898,
-0.7242323160171509,
0.12382622063159943,
-0.5931339263916016,
-0.4469798803329468,
0.5577095150947571,
-0.4736798405647278,
-0.0706538707017... | |
operator ()(string typename) {
for_each(myTypeList[typename].begin();myTypeList[typename].end(), func);
}
}
for_each(myTypeList["renderable"].begin(),myTypeList["renderable"].end(), doForList(myFunc))
``` | [
-0.21373504400253296,
-0.10400035977363586,
0.5252127051353455,
-0.46599894762039185,
0.5196933746337891,
0.25925326347351074,
0.27274999022483826,
-0.21521343290805817,
0.07053478807210922,
-0.5733088850975037,
-0.5261961817741394,
0.7666014432907104,
-0.4230448007583618,
-0.1453292667865... | |
I found a few tools on the web which generate XML Schema for a given XML data instance. Something like - [link text](http://www.xmlforasp.net/CodeBank/System_Xml_Schema/BuildSchema/BuildXMLSchema.aspx)
I'm also thinking of developing one, but I'm kind of confused with the evaluation of the generated schema.
How can ... | [
0.4703061878681183,
0.3737422525882721,
0.3271194100379944,
0.3121030330657959,
-0.19611573219299316,
-0.15920259058475494,
0.2733403742313385,
-0.19375275075435638,
-0.11001341044902802,
-0.4394175112247467,
0.15029026567935944,
0.5151231288909912,
0.20256389677524567,
0.03751653432846069... | |
automatically generated schema (I use [Examplotron](http://examplotron.org/)) can never be perfectly accurate because the generation tool does not have enough information.
For instance, if there is an element `<foobar>` in the XML document, how could the generation tool know if it is mandatory or not? If more than on... | [
0.09897926449775696,
0.09689275175333023,
0.43028900027275085,
0.07631459087133408,
-0.14243212342262268,
-0.22671818733215332,
-0.09435093402862549,
-0.34260886907577515,
0.025293879210948944,
-0.47977086901664734,
-0.3000432252883911,
0.6780837774276733,
-0.45732972025871277,
-0.35702133... | |
(a bit edited):
```
start =
element data {
element foo { xsd:integer },
element bar { text },
element baz { empty }
}
```
Note the `xsd:integer` in the element `<foo>`. Nice inference but, is it accurate? May be `<foo>` was supposed to be of a more general type like `xsd:any`... | [
-0.13182947039604187,
0.15277695655822754,
0.2715764343738556,
-0.04401649534702301,
-0.09517000615596771,
-0.10609268397092819,
0.14352452754974365,
-0.17733381688594818,
-0.1024826169013977,
-0.17918561398983002,
-0.21947239339351654,
0.3878287971019745,
-0.33441439270973206,
0.059639323... | |
I have a table view with an alphabetical index and am using the side alphabet to get through the list quickly. For those not familiar, that uses this:
```
- (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index {
```
My problem is that my application has... | [
0.18887461721897125,
0.2928693890571594,
0.20846784114837646,
-0.3241752088069916,
-0.037552643567323685,
0.22176922857761383,
0.353249728679657,
0.24144315719604492,
-0.28697919845581055,
-0.9685232639312744,
0.16287130117416382,
0.4243781566619873,
-0.06712131947278976,
0.334871292114257... | |
I've been able to come is being able to modify the background color and the font of the index.
There is some code in the iPhone Developers cookbook by Erica Sadun which shows how to access the UITableViewIndex view (an undocumented class). You can find the reference to it on page 175 of the book if you have it. Which ... | [
0.3282857835292816,
-0.21104124188423157,
0.5697901844978333,
0.05734287574887276,
-0.007974348030984402,
0.28959089517593384,
0.2805563807487488,
0.1687285304069519,
-0.11570151895284653,
-0.3881186544895172,
0.08929815888404846,
0.3048127591609955,
0.22116462886333466,
0.157157301902771,... | |
from the cookbook with minor modifications:
```
- (UITableViewCell *)tableView:(UITableView *)tv cellForRowAtIndexPath:(NSIndexPath *)indexPath {
for(UIView *view in [tv subviews])
{
if([[[view class] description] isEqualToString:@"UITableViewIndex"])
{
[view setBackgroundColor:[UIColor whiteCo... | [
0.328205943107605,
-0.1617773473262787,
0.7602461576461792,
-0.1738997846841812,
-0.13671311736106873,
-0.042623162269592285,
0.23771855235099792,
-0.5543767809867859,
-0.14643260836601257,
-0.863473653793335,
-0.20509757101535797,
0.5323241949081421,
-0.14305390417575836,
0.19071979820728... | |
titles.
It's not perfect but hopefully it helps a little.
Paul | [
0.35492971539497375,
0.28661325573921204,
0.3048059344291687,
0.41040104627609253,
0.2647990584373474,
-0.22323669493198395,
0.051628753542900085,
-0.14090758562088013,
-0.33798596262931824,
-0.6959580779075623,
-0.00044708087807521224,
0.3793662488460541,
0.24680151045322418,
0.4760824441... | |
I am trying to make a Java implementation of the Park-Miller-Carta PRNG random number generator.
Below is the implementation of the Random function in ActionScript 3 [from here](http://www.gskinner.com/blog/archives/2008/01/source_code_see.html).
```
return (_currentSeed = (_currentSeed * 16807) % 2147483647) / 0x7FF... | [
-0.33259597420692444,
-0.09062859416007996,
0.2735017240047455,
-0.3182831108570099,
0.018098901957273483,
-0.07140688598155975,
0.4451977610588074,
0.004349257797002792,
-0.25616738200187683,
-0.6512158513069153,
0.0267479345202446,
0.27444952726364136,
-0.15063761174678802,
-0.0829134359... | |
getting this to work in Java:
```
int seed = 20; //for example.
public double random() {
seed = (seed * 16807) % 2147483647;
return seed / 0x7FFFFFFF + 0.000000000233;
}
```
This always returns `2.33E-10`. Any ideas what I am doing wrong in Java? (the AS3 code returns `0.0001565276181885122`, then `0.630755... | [
-0.19676223397254944,
0.12088816612958908,
-0.02482164278626442,
-0.38043469190597534,
0.1866336464881897,
0.08926791697740555,
0.32008668780326843,
-0.4110526144504547,
-0.10686738044023514,
-0.2603074014186859,
0.18160218000411987,
0.3818420469760895,
-0.21300442516803741,
0.166108205914... | |
result, at least one of the arguments must be a float, which can be achieved like this:
```
return (double)seed / 0x7FFFFFFF + 0.000000000233;
``` | [
-0.030019432306289673,
0.22415317595005035,
0.11169375479221344,
-0.10896889865398407,
0.3319514989852905,
-0.041974786669015884,
0.01142311841249466,
-0.29544395208358765,
0.1348995864391327,
-0.1258501559495926,
0.07713767886161804,
0.4038863778114319,
-0.12509877979755402,
0.13004432618... | |
What is the preferred method of checking for sanity in objective-c and cocoa?
Near the top of a method, `NSParameterAssert` that necessary objects are not `nil`, indexes are in range, etc. Sometimes you can get these for free; for example, an indexed accessor backed by an array can let the underlying array do the asser... | [
0.1373538076877594,
0.17199653387069702,
-0.06381799280643463,
0.47047004103660583,
-0.09542084485292435,
-0.22279538214206696,
0.25905895233154297,
0.06272367388010025,
-0.26139503717422485,
-0.202418714761734,
-0.05977519601583481,
0.6773509383201599,
-0.09665742516517639,
-0.05462205037... | |
Referring to Brian Goetz's article [Are all stateful Web applications broken?](http://www.ibm.com/developerworks/library/j-jtp09238.html) for IBM developerWorks, I want to refer to this piece of code
```
HttpSession session = request.getSession(true);
ShoppingCart cart = (ShoppingCart)session.getAttribute("shoppingCar... | [
0.06815651059150696,
0.11069440096616745,
0.40353870391845703,
0.13471931219100952,
-0.014828088693320751,
-0.1301954686641693,
0.4216392934322357,
-0.1705656349658966,
-0.3483279049396515,
-0.39869803190231323,
-0.29777026176452637,
0.3926423192024231,
-0.6732795238494873,
0.1770498752593... | |
will return the same `HttpSession` instance. Thus, if a client (mobile/web browsers) makes two or make calls to the same Servlet (that executes the snippet above), you will never get a situation in which different threads see different values for `cart`.
Assuming I am convinced that it is **NOT** thread safe, how woul... | [
0.11929576843976974,
-0.19751989841461182,
0.7407160401344299,
0.11720055341720581,
-0.01383544784039259,
-0.028918137773871422,
0.3914346992969513,
-0.256497859954834,
-0.2519279718399048,
-0.6849762797355652,
-0.4169871211051941,
0.692409873008728,
-0.5724127292633057,
0.0431796237826347... | |
AtomicReference<ShoppingCart>(cart));
}
doSomethingWith(cart);
```
Merci!
Your code is still not Thread-safe:
```
ShoppingCart cart = cartRef.get();
if (cart == null) {
cart = new ShoppingCart(...);
session.setAttribute("shoppingCart",
new AtomicReference<ShoppingCart>(cart));
}
```
This is becaus... | [
-0.14203011989593506,
-0.11888730525970459,
0.5813620090484619,
0.3297477066516876,
0.11366216093301773,
-0.24541988968849182,
0.32081130146980286,
-0.280538946390152,
-0.1839475780725479,
-0.36406007409095764,
-0.055868927389383316,
0.8294817209243774,
-0.449985533952713,
0.20552985370159... | |
from the article you referenced:
```
while (true) {
ShoppingCart cart = cartRef.get();
if (cart != null) {
break;
}
cart = new ShoppingCart(...);
if (cartRef.compareAndSet(null, cart))
break;
}
```
With the above code, if two Threads using the same `HttpSession` enter the `while`... | [
0.3868194818496704,
-0.25560155510902405,
0.14010073244571686,
0.23914003372192383,
-0.07915768772363663,
-0.03312702476978302,
0.2792273461818695,
0.05344441160559654,
-0.4855145812034607,
-0.40553969144821167,
-0.2139754295349121,
0.4235557019710541,
-0.5285877585411072,
0.36303582787513... | |
the article, namely how do you get the `AtomicReference` into the session in the first place, there's an easy and *probably* (but not guaranteed) thread-safe way to do this. Namely, implement a session listener and put the empty `AtomicReference` objects into the session in its `sessionCreated` method:
```
public clas... | [
0.1618301123380661,
-0.03820424899458885,
0.5151697993278503,
0.11607816070318222,
0.13580384850502014,
-0.40101540088653564,
0.42464935779571533,
-0.2271415740251541,
-0.17451515793800354,
-0.5503381490707397,
-0.3919016122817993,
0.9230977892875671,
-0.3332342505455017,
0.110039271414279... | |
so this is an appropriate place to do any initialization that is needed for a session. Unfortunately, the Servlet spec does not require that there is a *happens-Before* relationship between calling `sessionCreated()` in your listener and calling your `service()` method. So this is apparently not guaranteed to be thread... | [
0.3433970808982849,
0.15064486861228943,
0.24766874313354492,
0.18413852155208588,
0.23023957014083862,
-0.5058581829071045,
0.3844522535800934,
-0.31215915083885193,
-0.4503101110458374,
-0.4588456451892853,
-0.2575475871562958,
0.517304003238678,
-0.26965466141700745,
0.10149020701646805... | |
to initialize the session. You could do something like this:
```
HttpSession session = request.getSession(true);
AtomicReference<ShoppingCart> cartRef;
// Ensure that the session is initialized
synchronized (lock) {
cartRef = (<AtomicReference<ShoppingCart>)session.getAttribute("shoppingCart");
if (cartRef == ... | [
0.25580430030822754,
-0.24978125095367432,
0.6580877304077148,
0.295652836561203,
0.030834324657917023,
-0.2530336081981659,
0.32590585947036743,
-0.2934967279434204,
-0.1484397053718567,
-0.4471387565135956,
-0.370212584733963,
0.7481754422187805,
-0.31996864080429077,
0.06462429463863373... | |
`AtomicReference` all together -- just put the cart itself into the session), or you can update the `AtomicReference` with code shown earlier above. Which is better depends on how much initialization you need to do, how long it will take to perform this initialization, on whether doing *everything* in the synchronized ... | [
0.22152599692344666,
0.03965713828802109,
0.033515073359012604,
0.24991920590400696,
-0.07384271919727325,
-0.2087995857000351,
0.3791036605834961,
-0.3584737777709961,
-0.03570656478404999,
-0.5027227997779846,
0.005323941819369793,
0.9304667115211487,
-0.4734956622123718,
-0.191346198320... | |
applications, then I would potentially move some more expensive initializations out of synchronized blocks by using tricks like the `AtomicReference` trick.
See also: [Is HttpSession thread safe, are set/get Attribute thread safe operations?](https://stackoverflow.com/questions/616601/) | [
0.14820411801338196,
-0.009418703615665436,
0.11262109875679016,
0.15156279504299164,
0.20959261059761047,
-0.36958765983581543,
0.19722409546375275,
-0.29285529255867004,
-0.4629814922809601,
-0.28025752305984497,
-0.11035668104887009,
0.7357197999954224,
-0.3811705708503723,
-0.145764350... | |
How do I convert the XML in an XDocument to a MemoryStream, without saving anything to disk?
Have a look at the [XDocument.WriteTo](http://msdn.microsoft.com/en-us/library/system.xml.linq.xdocument.writeto.aspx) method; e.g.:
```
using (MemoryStream ms = new MemoryStream())
{
XmlWriterSettings xws = new XmlWriterS... | [
0.17071044445037842,
0.04930175468325615,
0.7647813558578491,
0.10266247391700745,
0.4536341726779938,
0.03459841385483742,
-0.024936864152550697,
-0.34900400042533875,
0.05463862419128418,
-0.7428081035614014,
-0.10642189532518387,
0.5749257802963257,
-0.06629645079374313,
0.1801910400390... | |
new XElement("GrandChild", "some content")
)
);
doc.WriteTo(xw);
}
}
``` | [
0.3551197350025177,
0.07925247400999069,
0.5141562223434448,
-0.22202849388122559,
0.47763198614120483,
-0.2173006683588028,
0.22333402931690216,
0.02282119356095791,
0.358745813369751,
-0.645747184753418,
-0.6276070475578308,
0.4686851501464844,
-0.46081194281578064,
0.622512936592102,
... | |
I have a .Net object (in C#) which has properties named event1, event2 and so on.
I have to do some if-else on each of these. is there way i can loop over these. If these were controls i could have used the controls collection, but these are properties of an object.
Any help?
Assuming you know how many properties yo... | [
0.07277142256498337,
-0.27568501234054565,
0.24786566197872162,
0.02565537951886654,
0.05106794089078903,
-0.1939610093832016,
0.025647060945630074,
-0.29889291524887085,
-0.2764633893966675,
-0.5445775389671326,
0.056807585060596466,
0.7184517979621887,
-0.14039649069309235,
0.16822421550... | |
eventIndex);
if (eventPropertyInfo.GetValue(this, null) == yourValue)
{
//Do Something here
}
}
``` | [
-0.05209667235612869,
-0.4581427276134491,
0.3863206207752228,
-0.13835155963897705,
0.3297622799873352,
-0.3086959421634674,
0.4055924713611603,
-0.017836609855294228,
-0.03202527016401291,
-0.5997353792190552,
-0.24742549657821655,
0.8953721523284912,
-0.22892045974731445,
0.148084238171... | |
I have been given the following request.
Please give 7% of the current contacts registered to each of the sales associates to the new sales associate ('Peter').
What I decided to do was to get the total records for each sales associate and calculate 7% of the records.
For example
David has 200
200/7% = 14
```
SELE... | [
0.234938845038414,
0.4696109890937805,
0.8921089172363281,
-0.24762552976608276,
0.44024139642715454,
0.22539493441581726,
0.06358247250318527,
-0.26961398124694824,
-0.30992546677589417,
-0.5195211172103882,
-0.19417479634284973,
0.606689453125,
-0.2308831363916397,
0.16085638105869293,
... | |
going wrong?
Any help, much appreciated.
PK\_Of\_tb\_Contact - primary key in your tb\_Contact table
```
UPDATE tb_Contact
SET ContactAssociate = 'Peter'
where PK_Of_tb_Contact
IN
(
SELECT TOP 14 PK_Of_tb_Contact
FROM tb_Contact
WHERE tb_Contact.ContactAssociate = 'David'
ORDER BY NEWID()
)
``` | [
-0.1115804985165596,
0.1711910367012024,
0.22877538204193115,
0.016688566654920578,
0.8321369290351868,
-0.021518874913454056,
0.44193965196609497,
-0.07855917513370514,
-0.31243085861206055,
-0.6660575866699219,
-0.30406439304351807,
0.4563198983669281,
-0.4779852628707886,
0.065257139503... | |
sound like a terrible idea? Yeah I thought so too. Needless to say im told I have to do it.
Situation:
Old MFC-based C++ gui application that reads and processes a whole lot of data sources into an internal datastructure, before displaying it to the user.
Problem:
I need that datastructure in .NET, in XML will do.
S... | [
0.411825567483902,
-0.10513618588447571,
0.47782671451568604,
0.19384700059890747,
0.048249341547489166,
-0.1771138459444046,
0.21791668236255646,
-0.11330923438072205,
-0.2338395118713379,
-0.7742127180099487,
-0.1914484202861786,
0.6857824921607971,
-0.5904557704925537,
0.065075151622295... | |
this insanity? Is it possible to compile a dll library from a GUI MFC app without changing it? Is it a horrible idea? What are my alternatives? Im pretty lost tbh.
I would be working on extracting the specific business logic code in the MFC app and sticking that stuff in a DLL, rather than trying to wrap up the whole a... | [
0.3943093717098236,
0.40902361273765564,
0.21457117795944214,
0.2065255492925644,
-0.3237217962741852,
0.0497494600713253,
0.3639887869358063,
-0.31275510787963867,
-0.2873903810977936,
-0.15728630125522614,
0.2877097427845001,
0.6631084084510803,
-0.48118603229522705,
0.5156393647193909,
... | |
produce a DLL), than the effort to isolate the business logic code and put that in a new DLL project.
To wrap the GUI up as a DLL you will need a pretty good understanding of the dependencies of the business logic code and how it is used by the GUI, so you may as well just cut that stuff out. | [
0.14088402688503265,
-0.0331101268529892,
0.19801966845989227,
0.3376808166503906,
-0.23041574656963348,
-0.3095632493495941,
-0.06833047419786453,
0.051711902022361755,
-0.18245206773281097,
-0.5950213074684143,
-0.3231498599052429,
0.694749116897583,
-0.3313458263874054,
-0.0386120565235... | |
Is there any way to check if a variable (class member or standalone) with specified name is defined? Example:
```
if "myVar" in myObject.__dict__ : # not an easy way
print myObject.myVar
else
print "not defined"
```
A compact way:
```
print myObject.myVar if hasattr(myObject, 'myVar') else 'not defined'
```
ht... | [
-0.15679144859313965,
0.0932072177529335,
0.15803568065166473,
-0.18980690836906433,
-0.24962860345840454,
-0.23949559032917023,
0.05665718391537666,
-0.08761762827634811,
-0.08241046220064163,
-0.5306062698364258,
-0.2567079961299896,
0.5748291611671448,
-0.2544700801372528,
0.00431163702... | |
In C++, I believe, a better way of dealing with reallocation is to use a STL vectors, as it guarantees the contiguous storage locations.
I have couple question to understand the difference:
1. Is there any scenario in which I need to prefer [realloc](http://en.cppreference.com/w/cpp/memory/c/realloc) over vector ?
2... | [
-0.14781105518341064,
-0.12225724011659622,
0.36210957169532776,
0.04887057840824127,
-0.11812908947467804,
-0.08099497109651566,
-0.2674216330051422,
0.11687546223402023,
-0.47120001912117004,
-0.644948422908783,
0.04951547831296921,
0.7997598648071289,
-0.37234124541282654,
-0.0454660728... | |
equivalent to realloc()?](http://www.stroustrup.com/bs_faq2.html#renew)
> However, realloc() is only guaranteed to work on arrays allocated by malloc() (and similar functions) containing objects without user-defined copy constructors. Also, please remember that contrary to naive expectations, realloc() occasionally do... | [
-0.10317721217870712,
-0.122701495885849,
0.44933632016181946,
0.17801488935947418,
0.13922058045864105,
-0.22952783107757568,
-0.21008971333503723,
0.15546737611293793,
-0.1589304655790329,
-0.25777384638786316,
-0.20571266114711761,
0.9816606044769287,
-0.4146144986152649,
-0.07579942792... | |
I am looking at some solutions for building a site with a mix of free and paid/premium content (no, it's not porn).
I gather that Drupal has the Premium plugin which supports this. I'm also looking at Expression Engine, which seems to have some built in support for this, although Paypal is the only payment option.
I... | [
0.531560480594635,
0.1568351536989212,
0.28449657559394836,
0.0919812023639679,
-0.08127821981906891,
-0.02022959105670452,
0.061714090406894684,
0.11686976999044418,
-0.16161148250102997,
-0.8497312664985657,
-0.11270716041326523,
0.825334906578064,
-0.0499623566865921,
0.1046434938907623... | |
EE or Worpress + aMember. Am I missing any other good options? Anyone have experience with any of these packages?
Expression Engine is amazing, and there is tons of support on their forums. I'm sure someone has found a way to use more than just paypal with it, just ask on the forums there and see what they say. But I'd... | [
0.5046438574790955,
-0.2695220708847046,
0.026846202090382576,
0.22049100697040558,
-0.2515273988246918,
0.06591664999723434,
0.15432721376419067,
0.3923049569129944,
0.0709422305226326,
-0.6737729907035828,
0.2351929098367691,
0.9206994771957397,
-0.08176755160093307,
-0.14010462164878845... | |
What's the easiest way to convert XML from UTF16 to a UTF8 encoded file?
This may not be the most optimal, but it works. Simply load the xml and push it back out to a file. the xml heading is lost though, so this has to be re-added.
```
$files = get-ChildItem "*.xml"
foreach ( $file in $files )
{
[System.Xml.XmlDo... | [
0.08789286762475967,
-0.11381949484348297,
0.5742810964584351,
-0.008514756336808205,
0.18015775084495544,
0.15810339152812958,
-0.004886594135314226,
-0.4440247118473053,
-0.0464262031018734,
-0.8831465840339661,
-0.31405654549598694,
0.5260022282600403,
-0.2544676959514618,
0.01259294711... | |
= $file.Name + ".new"
Set-Content -Encoding UTF8 $newFile $xml;
}
``` | [
0.16257818043231964,
0.12659765779972076,
0.46952804923057556,
-0.2840768098831177,
0.15644192695617676,
-0.08659014850854874,
0.16730214655399323,
-0.14950156211853027,
0.0015691423323005438,
-0.5009241104125977,
-0.6016969680786133,
0.47167566418647766,
-0.4831131100654602,
0.25750616192... | |
How to keep the source code well documented/commented? Is there a tool to generate a skeleton for comments on the Unix platform for C++?
In general, how many lines of comments is recommended for a file with around 100 lines of code?
Generally, it's best to let the code itself explain **what** it does, whereas the comm... | [
0.7043826580047607,
0.28376227617263794,
0.06986512243747711,
0.324532687664032,
-0.3895057439804077,
-0.08651258051395416,
0.2077871859073639,
0.14209908246994019,
-0.17703427374362946,
-0.6117681860923767,
0.05730333924293518,
0.36926907300949097,
-0.09235148131847382,
-0.237884148955345... | |
does, explain it in a comment.
If you're code is too complicated to explain itself, then that may be a reason to refactor.
This way, when you change the implementation you don't need to change the comments as well, as your comments do not duplicate the code. Since the reasons for the design seldom change it's safe to... | [
0.5886349081993103,
0.1992911994457245,
-0.07183724641799927,
0.2531534731388092,
-0.20834505558013916,
0.007249487563967705,
0.005541318561881781,
-0.20089204609394073,
-0.057154811918735504,
-0.6482031345367432,
0.12118219584226608,
0.4840793311595917,
-0.2458321899175644,
0.107767954468... | |
I am developing a firefox extension and I need to include the Google Search API. But I am encountering an error in the google.load('search','1') line. Can anyone tell what the problem is
Thanks.
If you've gathered all the JavaScript files and are packaging them with your Firefox extension locally, and google's load fu... | [
0.37454816699028015,
0.2618582248687744,
0.2783830761909485,
-0.07309313118457794,
-0.013482336886227131,
-0.3458576500415802,
0.17028896510601044,
-0.31291133165359497,
-0.05948337912559509,
-0.6704492568969727,
-0.20542633533477783,
0.8052833676338196,
-0.7069065570831299,
-0.09057708829... | |
I have this markup in an MVC app.
```
<div id="ingredientlistdiv">
<% Recipe recipe = (Recipe)Model; %>
<% Html.RenderPartial("IngredientsListControl", recipe.Ingredients); %>
</div>
<div id="ingrediententrydiv" align="left">
<% using (Ajax.BeginForm("Add Ingredient", "Recipes/UpdateStep2", new AjaxOption... | [
0.2332356721162796,
0.05684981867671013,
0.7649284601211548,
-0.33758237957954407,
0.01455820631235838,
0.25003546476364136,
0.21106362342834473,
-0.6616642475128174,
0.32829010486602783,
-0.95205157995224,
-0.08349580317735672,
0.24120715260505676,
0.08260581642389297,
0.0868769958615303,... | |
for="Measure">Measure:</label><br />
<%= Html.TextBox("Measure")%>
<%= Html.ValidationMessage("Measure", "*")%>
</p>
<p>
<label for="IngredientName">Ingredient Name:</label><br />
<%= Html.TextBox("IngredientName")%>
<%= Html.ValidationMessage("IngredientName", "*")%>
... | [
0.11050355434417725,
-0.25952455401420593,
0.8834872841835022,
-0.16290950775146484,
-0.13357020914554596,
-0.16319109499454498,
0.0914473757147789,
-0.8267813324928284,
-0.0005508948233909905,
-0.730376124382019,
0.195453479886055,
0.03292175009846687,
-0.07106237858533859,
0.194167122244... | |
action
```
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult UpdateStep2(FormCollection form)
{
var factory = SessionFactoryCreator.Create();
using (var session = factory.OpenSession())
{
Recipe recipe = GetRecipe(session, Convert.ToInt32(form["Recip... | [
0.13902810215950012,
-0.28976765275001526,
0.4820236563682556,
-0.37463682889938354,
0.1417389214038849,
0.24276845157146454,
0.5819005370140076,
-0.6477711200714111,
-0.19087301194667816,
-0.5083723068237305,
-0.4882853329181671,
0.52083420753479,
-0.3294404447078705,
-0.12090226262807846... | |
= new Ingredient();
ingredient.UpdateFromForm(form);
ingredient.Validate(ViewData);
if (ViewData.ModelState.Count == 0)
{
recipe.Ingredients.Add(ingredient); | [
0.3223520815372467,
-0.19965076446533203,
0.7957831025123596,
-0.32808154821395874,
0.46432241797447205,
-0.07690411061048508,
0.17323927581310272,
-0.675844132900238,
0.0925532802939415,
-0.6387448906898499,
-0.37938058376312256,
0.41983506083488464,
-0.22485652565956116,
0.24764056503772... | |
session.Save(recipe);
return PartialView("IngredientsListControl", recipe.Ingredients);
}
return Content("Error");
}
}
```
Am I doing the right thing on this line?
```
return PartialView("IngredientsListControl", recipe.Ingredients);
```
Is t... | [
0.18770694732666016,
0.09192022681236267,
0.44569215178489685,
-0.22363807260990143,
0.22040221095085144,
0.03088296577334404,
0.5423237085342407,
-0.03638245165348053,
0.21822161972522736,
-0.7743558287620544,
-0.33183810114860535,
0.7413146495819092,
0.0556257925927639,
0.056678518652915... | |
control into the div so it does
not load new page.???
Malcolm
When you use this:
```
<a href="javascript:document.forms[0].submit()">
```
...you should be aware that it's not the same as
```
<input type="submit" />
```
It doesn't raise the onsubmit event, and MVC's AJAX eventhandler is not called.
To confirm t... | [
-0.11812050640583038,
-0.2721133828163147,
0.5978943109512329,
0.22946766018867493,
-0.1165550947189331,
-0.29230666160583496,
0.21149541437625885,
-0.23550665378570557,
-0.004237560089677572,
-0.5502080917358398,
-0.198446586728096,
0.522343635559082,
-0.5478618144989014,
0.00747263757511... | |
Any one know how to convert string value into html format in php?
For Example:
```
$string = "Hello World!!
How are you?"
```
If I echo $string, it will display like this:
```
Hello World!!How are you?
```
Instead of:
```
Hello World!!
How are you?
```
Any way php can conver the $string into html fo... | [
0.3281176686286926,
0.33363646268844604,
0.4568116068840027,
-0.22048646211624146,
-0.38266095519065857,
-0.0955299511551857,
0.5141120553016663,
0.25212302803993225,
-0.5957388281822205,
-0.5695244669914246,
-0.3499617874622345,
0.5280409455299377,
0.10343670099973679,
-0.0322545357048511... | |
physical line break sequence (`\n`, `\r` or `\r\n`):
```
\n → <br />\n
\r → <br />\r
\r\n → <br />\r\n
``` | [
-0.23217225074768066,
-0.10544881969690323,
0.45047685503959656,
0.07715264707803726,
-0.02786957658827305,
0.34717991948127747,
-0.03957999870181084,
-0.05755556747317314,
-0.14402592182159424,
-0.4334023594856262,
-0.5959466099739075,
0.38153284788131714,
-0.004723734222352505,
0.2439303... | |
I make a checkout of some branch or tag from subversion repository and then build the project with maven.
Now, I'd like to get store *current* revision number and URL to some file. How can I do that? That is, I'd like to get revision number and URL of whatever branch/tag I have made checkout of.
I know about [buildn... | [
0.449308305978775,
0.09069500118494034,
0.21740873157978058,
-0.024275073781609535,
0.07377547025680542,
-0.12696541845798492,
0.3006044924259186,
0.13642200827598572,
-0.20979157090187073,
-0.39315107464790344,
-0.09329434484243393,
0.315374493598938,
-0.045212339609861374,
0.233573943376... | |
maven-jar plugin (or maven-war).
here a full example:
```
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<phase>validate</phase> | [
-0.25849759578704834,
0.16886138916015625,
0.14211668074131012,
-0.3805653750896454,
-0.21908649802207947,
0.22408494353294373,
0.23224800825119019,
-0.23064148426055908,
-0.19888626039028168,
-0.6461687684059143,
-0.08609753102064133,
0.41574808955192566,
-0.4659315347671509,
0.2798779904... | |
<goals>
<goal>create</goal>
</goals>
</execution>
</executions> | [
0.23188747465610504,
-0.280300110578537,
-0.3937292993068695,
0.3597257733345032,
-0.2575204074382782,
0.22663059830665588,
0.32135534286499023,
-0.31880852580070496,
-0.6206979751586914,
-0.471391886472702,
0.1100088432431221,
-0.32711663842201233,
-0.5090190768241882,
0.11768611520528793... | |
<configuration>
<timestampFormat>{0,date,dd-MM-yyyy HH:mm:ss}</timestampFormat>
<doCheck>false</doCheck>
<doUpdate>false</doUpdate>
<providerImplementations>
<svn>javasvn</svn> | [
-0.2147054821252823,
-0.2158624529838562,
0.4078073501586914,
-0.17149044573307037,
0.03699937462806702,
-0.015502246096730232,
0.14644522964954376,
-0.3478509485721588,
-0.4793708026409149,
-0.7516070008277893,
-0.2553463876247406,
0.26704147458076477,
0.036219798028469086,
0.258996754884... | |
</providerImplementations>
</configuration>
<dependencies>
<dependency>
<groupId>com.google.code.maven-scm-provider-svnjava</groupId>
<artifactId>maven-scm-provider-svnjava</artifactId> | [
-0.5326884388923645,
0.012784798629581928,
0.5561907887458801,
-0.279926061630249,
0.05090365931391716,
0.3295210003852844,
0.18420395255088806,
-0.10496747493743896,
-0.27670928835868835,
-0.7180423736572266,
-0.4125292897224426,
0.3121439218521118,
-0.2700636386871338,
0.2063649147748947... | |
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>org.tmatesoft.svnkit</groupId>
<artifactId>svnkit</artifactId>
<version>1.8.5</version> | [
-0.33388784527778625,
-0.21111960709095,
0.722126305103302,
-0.23135025799274445,
-0.342216432094574,
-0.10974854230880737,
0.18041519820690155,
-0.2725074291229248,
-0.1907273381948471,
-0.7716127634048462,
-0.2511371672153473,
0.3357997238636017,
-0.46600228548049927,
-0.1027153357863426... | |
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.5</version>
<configuration> | [
-0.3720867931842804,
0.2692602872848511,
0.2148616909980774,
-0.26895180344581604,
-0.2740863859653473,
-0.04909535124897957,
0.3066648542881012,
-0.318368524312973,
-0.21066410839557648,
-0.6209326386451721,
-0.05764726549386978,
0.3231314718723297,
-0.3583132028579712,
0.2622465491294861... | |
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
<manifestEntries> | [
0.10281824320554733,
-0.10148550570011139,
-0.13130325078964233,
-0.0006398410187102854,
-0.2668512761592865,
-0.08435969054698944,
0.02775399759411812,
0.027709081768989563,
-0.20391230285167694,
-0.9060221314430237,
-0.0387006476521492,
0.1335788369178772,
-0.41074445843696594,
-0.151369... | |
<Implementation-Build>${buildNumber}</Implementation-Build>
<Implementation-Title>${project.name}</Implementation-Title>
<Implementation-Vendor>ENTERPRISE</Implementation-Vendor>
<Implementation-Version>${project.version}</Implementation-Version> | [
0.10003063827753067,
0.22119101881980896,
0.16126877069473267,
-0.37761127948760986,
-0.038487568497657776,
0.18368269503116608,
0.05904699116945267,
0.017191560938954353,
-0.2154848575592041,
-0.6955711245536804,
-0.26902782917022705,
0.1776372194290161,
-0.11541897058486938,
0.1500592529... | |
<Built-By>${user.name}</Built-By>
<Built-OS>${os.name}</Built-OS>
<Build-Date>${timestamp}</Build-Date>
<SCM-Revision>${buildNumber}</SCM-Revision>
</manifestEntries> | [
-0.32180356979370117,
0.029745562002062798,
0.7236749529838562,
-0.2318865805864334,
0.043869275599718094,
0.1371123492717743,
-0.013928823173046112,
0.01195520255714655,
-0.1636369824409485,
-0.8916623592376709,
-0.19620159268379211,
0.22236700356006622,
0.22518585622310638,
0.40592935681... | |
</archive>
</configuration>
</plugin>
``` | [
0.11071717739105225,
0.26718881726264954,
-0.10833613574504852,
0.019907955080270767,
0.1193118467926979,
-0.3210994601249695,
0.0769888311624527,
0.172804057598114,
-0.09631123393774033,
-0.8022882342338562,
-0.8005281090736389,
0.4054815173149109,
-0.3714023232460022,
0.09666936099529266... | |
What is the maximum font size that can be rendered in a web page?
Does it depend on the machine, or the application (browser)?
Yes.
Every device has some set of fonts and font sizes it supports. For a desktop computer both sets are very large, but for a phone or other small device, the sets may be fairly limited. For... | [
-0.0021578120067715645,
0.19686993956565857,
0.46447861194610596,
0.16302888095378876,
-0.03962436318397522,
0.22813360393047333,
0.038791343569755554,
0.08138903975486755,
-0.20952492952346802,
-0.9397809505462646,
-0.2618635892868042,
0.42800581455230713,
0.07238181680440903,
-0.22028741... | |
I'm using some `JTextArea` in my Swing application. The surrounded `JScrollPane` is added to a `JPanel` using the `GridBagLayout` manager.
```
// Pseudo Code ----
JTextArea area = new JTextArea();
area.setRows(3);
JScrollPane sp = new JScrollPane(area);
JPanel p = new JPanel(new GridBagLayout());
p.add(sp, new Grid... | [
0.10847879201173782,
0.01708257757127285,
0.9393973350524902,
-0.27958977222442627,
-0.052543845027685165,
0.11637447774410248,
0.15500673651695251,
-0.6326507329940796,
-0.36636030673980713,
-0.672132670879364,
-0.3248836100101471,
0.3561568260192871,
-0.3232659697532654,
-0.1611304730176... | |
Does anyone know a solution? Has anyone an idea?
If I use a `BorderLayout` around my elements, it works.
Pete, MrWiggles, Thank you for your help!! | [
0.6303495168685913,
0.25773993134498596,
0.16726963222026825,
0.33534911274909973,
0.16495473682880402,
-0.11430229991674423,
0.5093878507614136,
0.2226458638906479,
-0.4064576327800751,
-0.3005225658416748,
-0.2326560765504837,
0.3102664649486542,
-0.1977642923593521,
0.12913163006305695,... | |
how could I request Java garbage collection externally, starting the program from JAR (Windows BAT used)?
* From the Java code I can do it with `System.gc()`
* When running a JNLP distribution, I get this "Java console" turned on from Control Panel / Java / ... and this Java console provides manual garbage collection... | [
0.13792264461517334,
-0.0451466366648674,
0.041920457035303116,
-0.12916110455989838,
-0.31875404715538025,
-0.1834602802991867,
0.36673593521118164,
-0.05812772735953331,
-0.3902854323387146,
-0.6559756994247437,
-0.024147341027855873,
0.5027547478675842,
-0.2510790526866913,
0.0414771735... | |
the GUI.
You'll need to specify **-Dcom.sun.management.jmxremote** when you kick off your java process. | [
0.26146310567855835,
-0.09760930389165878,
0.3690747916698456,
0.21814095973968506,
0.1009565219283104,
-0.3861440122127533,
0.045384231954813004,
0.37373587489128113,
-0.09624145179986954,
-0.8878077864646912,
-0.2694264352321625,
0.9871087074279785,
-0.12574586272239685,
-0.2709314823150... | |
What does this regex do? i know it replaces the filename (but not extension)
```
Regex r = new Regex("(?<!\\.[0-9a-z]*)[0-9]");
return r.Replace(sz, "#");
```
How do i make it only repeat 5 times? to make it convert
"1111111111.000" to "11111#####.000" ?
~~I havent' tried this but~~ **Have** tried it, **work... | [
-0.03256341069936752,
-0.023068491369485855,
0.47057297825813293,
-0.2698191702365875,
-0.036007530987262726,
0.3130605220794678,
0.1697954535484314,
-0.2463589906692505,
-0.2373092621564865,
-0.35915639996528625,
-0.15321019291877747,
0.3466053307056427,
-0.03842814266681671,
0.1380520015... | |
It's hellishly inefficient though, and it only works with engines that allow variable-width lookahead patterns. | [
0.49601489305496216,
0.06553012877702713,
0.379427045583725,
0.13131490349769592,
0.17250096797943115,
-0.2417507916688919,
0.3084762394428253,
0.1135883703827858,
0.0907043069601059,
-0.5358123183250427,
0.13303357362747192,
0.30835092067718506,
-0.1340714395046234,
-0.030022654682397842,... | |
I am using **jQuery.autocomplete(1.02)** on my search box and I want **exact** string and substring matching. I don't care (yet!) about the database load, I'm happy for it to fire off a query every keystroke and bypass the caching entirely - I just don't want anything missed.
To this end I have tried setting *cacheLen... | [
0.24457265436649323,
0.23379772901535034,
0.6050887107849121,
-0.2812017500400543,
0.08147367835044861,
-0.171839639544487,
0.46446841955184937,
-0.1790691316127777,
-0.22136150300502777,
-0.7995201945304871,
-0.23755429685115814,
0.5976181626319885,
-0.11833760142326355,
0.135143667459487... | |
-> http://localhost/service_search_request?q=ar
'ars' -> http://localhost/service_search_request?q=ars
```
Instead, it sends the first and the third and misses the second, giving me the wrong results for 'ar' :-/ I've cleared my cache and sessions but it looks like some sort of caching is still going on.... | [
0.11199706792831421,
-0.010905149392783642,
0.20112213492393494,
-0.11126551032066345,
-0.4411695599555969,
0.0034510029945522547,
0.6709441542625427,
0.34219688177108765,
-0.19027812778949738,
-0.811030924320221,
-0.18263889849185944,
0.3948765695095062,
-0.3658933937549591,
0.22354333102... | |
there a clean way around it?...
**C)** If not, what autocomplete would you use instead?
Naturally *D) No you're just using it incorrectly you douche!* is always a possibility, and indeed the one I'd prefer having spent time going down this road - assuming it comes with a link to the docs I've failed to find / read!
... | [
0.38068315386772156,
-0.06877528131008148,
0.15320315957069397,
0.139128178358078,
0.02581263892352581,
-0.2552599608898163,
0.5019756555557251,
0.13864459097385406,
-0.23843753337860107,
-0.5921689867973328,
-0.052725642919540405,
0.4424208700656891,
-0.2389228194952011,
-0.01186863239854... | |
some debug messages to it, to see what happens: (note: you need [firebug](http://getfirebug.com/) installed or "console" will be unknown)
```
function request(term, success, failure) {
console.debug("ac request...");
if (!options.matchCase)
term = term.toLowerCase();
var data = cache.load(term);... | [
-0.029862144961953163,
-0.24524839222431183,
0.4474371373653412,
-0.10595844686031342,
0.27811306715011597,
-0.10097554326057434,
0.5677099823951721,
-0.46463295817375183,
-0.12107671797275543,
-0.2867445647716522,
-0.739646852016449,
0.718414843082428,
-0.3715413510799408,
0.2282424271106... | |
AJAX url has been supplied, try loading the data now
} else if( (typeof options.url == "string") && (options.url.length > 0) ){
console.debug("ac request 2, data is not in the cache, request it");
```
"flushCache" can easily be used in the function you can attach / set as options. I used this, to clear t... | [
-0.2429201751947403,
-0.4478229284286499,
0.430461049079895,
-0.013732558116316795,
0.17596571147441864,
-0.1662919968366623,
0.11794616281986237,
-0.04522443935275078,
0.15066878497600555,
-0.7382766604423523,
-0.18543268740177155,
0.8081232905387878,
-0.16705922782421112,
-0.230092346668... | |
}
return data[1] + " (" + data[0] + ")";
}
``` | [
-0.1977083832025528,
0.05846477672457695,
0.17319776117801666,
-0.21077251434326172,
0.19396814703941345,
-0.3746286928653717,
0.07985318452119827,
-0.10981947928667068,
0.2651117444038391,
-0.18411830067634583,
-0.44760483503341675,
0.7774339318275452,
-0.3368337154388428,
-0.002583274152... | |
I have a number of bash scripts which invoke R scripts for plotting things. Something like:
```
#!/bin/bash
R --vanilla --slave <<RSCRIPT
cat("Plotting $1 to $2\n")
input <- read.table("$1")
png("$2")
plot(as.numeric(input[1,]))
dev.off()
RSCRIPT
```
The problem is that despite `--slave`, the call to `dev.off()` pr... | [
0.309109628200531,
0.19781522452831268,
0.3628140985965729,
-0.22211192548274994,
-0.17969806492328644,
-0.2233276069164276,
0.3500320017337799,
-0.5314838886260986,
-0.2736862599849701,
-0.5652229189872742,
0.10260149836540222,
0.6689463257789612,
-0.4986893832683563,
0.28743529319763184,... | |
(which == 1)
stop("cannot shut down device 1 (the null device)")
.Internal(dev.off(as.integer(which)))
dev.cur()
}
<environment: namespace:grDevices>
```
So it calls `.Internal(dev.off(...))` and then returns dev.cur(), which I suppose would be useful if you have several devices open so you know whic... | [
0.060948245227336884,
0.1306457370519638,
0.6350739598274231,
-0.4757513701915741,
0.07518618553876877,
0.01574656181037426,
0.46756449341773987,
-0.12384457886219025,
-0.2258993685245514,
-0.7594560384750366,
-0.48266109824180603,
0.7615165114402771,
-0.45752692222595215,
0.29746711254119... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.