text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
models with low RAM and single-core Pentium 4 CPUs and cranky disks. Needless to say, development work is sub-optimal, especially when working with Visual Studio solutions that can range 100 - 400 projects.
For small cases that can be isolated, we develop and test on our own laptops. But for the bigger cases, given th... | [
0.27992838621139526,
0.055513035506010056,
0.09255977720022202,
0.318316251039505,
0.19360826909542084,
0.1241440549492836,
0.09070476144552231,
-0.12174752354621887,
-0.13470567762851715,
-0.4229319095611572,
-0.041058339178562164,
0.6043398976325989,
-0.2336743026971817,
0.02080132625997... | |
customer's policies (e.g. plug laptop in masquerading desktop MAC address). I just like to know what others have tried to retain some of their advantage and efficiency with their own hardware when working in such environments. Whenever I can I try to duplicate the environment with virtual servers on my own laptop, but ... | [
0.17106172442436218,
0.27131378650665283,
0.6018030643463135,
0.1009824350476265,
0.23818764090538025,
0.16025586426258087,
0.2275233417749405,
0.2768547236919403,
-0.3230888843536377,
-0.6186188459396362,
-0.11035453528165817,
0.6952617168426514,
-0.015530599281191826,
0.10634957253932953... | |
the proposal up to someone who can, then I'd say the current situation is what they've decided to use.
In that case, either live with it, or don't, ie. move on.
The proposal should contain:
1. A proposal for what you want done
2. Why it should be done
3. The consequences of doing it
4. And most importantly, the cons... | [
0.5794353485107422,
0.04108574986457825,
0.18275532126426697,
0.2726106345653534,
0.17812849581241608,
-0.06530725210905075,
-0.10174977779388428,
-0.5479394793510437,
0.24797393381595612,
-0.598261833190918,
-0.07342605292797089,
0.5841006636619568,
0.21638767421245575,
-0.103894330561161... | |
The data model for my Core Data document-based app (10.5 only) is in a
framework, so automatic schema upgrades using a Core Data mapping
model don't appear to work. It appears that the Core Data machinery
doesn't find the appropriate data models or mapping model when they
are not in the app's main bundle. So, instead o... | [
-0.1469147801399231,
0.2008005827665329,
0.8072390556335449,
0.028071841225028038,
0.43308520317077637,
0.03569909185171127,
0.4859997630119324,
0.021737489849328995,
-0.2995145320892334,
-0.8371807932853699,
-0.3069431781768799,
0.5156185030937195,
-0.2454606294631958,
0.22949790954589844... | |
application
since you opened or saved it." when I try to save. As others on this
list have pointed out, this is due to my modification of the
document's file "behind its back". I tried updating the document's
file modification date, as shown below, but I then get an error dialog
with the message "The location of the do... | [
0.2216137796640396,
0.015960603952407837,
0.5219113230705261,
0.01766616478562355,
0.36441612243652344,
-0.32075923681259155,
0.4863158166408539,
-0.09876221418380737,
-0.5001117587089539,
-0.5414635539054871,
-0.17124482989311218,
0.538414478302002,
-0.18384401500225067,
0.108645156025886... | |
a document's persistent store without triggering one of
these (in *this* case unnecessary) warnings?
code for upgrading the data store in my subclasses
`-configurePersistentStoreCoordinatorForURL:ofType:...` :
```
if(upgradeNeeded) {
NSManagedObjectModel *sourceModel = [NSManagedObjectModel mergedModelFrom... | [
-0.24296434223651886,
-0.10375164449214935,
0.7330179214477539,
0.09250437468290329,
0.142771378159523,
0.0750889778137207,
0.7359426021575928,
-0.264812707901001,
-0.05047522857785225,
-0.6585159301757812,
-0.42292457818984985,
0.902155876159668,
-0.07077191770076752,
0.41071876883506775,... | |
}
NSManagedObjectModel *destinationModel = [self managedObjectModel];
NSMigrationManager *migrationManager = [[NSMigrationManager alloc] initWithSourceModel:sourceModel destinationModel:destinationModel];
NSMappingModel *mappingModel = [NSMappingModel mappingModelFromBundles:VUIModelB... | [
-0.6504961848258972,
-0.4683833420276642,
0.42802828550338745,
-0.10355494916439056,
0.21328401565551758,
0.17467814683914185,
0.5128286480903625,
0.00803800392895937,
-0.3552578389644623,
-0.8167405128479004,
-0.2864626944065094,
0.5733428001403809,
0.022778047248721123,
0.276811063289642... | |
project format.")];
return NO;
}
@try {
//move file to backup
NSAssert([url isFileURL], @"store url is not a file URL");
NSString *tmpPath = [NSString | [
0.24439509212970734,
-0.5926370024681091,
0.49042484164237976,
0.014517577365040779,
0.2659332752227783,
-0.06622394174337387,
0.7606996297836304,
-0.3248583674430847,
-0.2630431652069092,
-0.36611518263816833,
-0.4366077780723572,
0.6159363389015198,
-0.42661625146865845,
0.00589252728968... | |
tempFilePath];
id storeType = [meta objectForKey:NSStoreTypeKey];
if(![migrationManager migrateStoreFromURL:url
type:storeType | [
-0.19601468741893768,
-0.22923041880130768,
0.47649946808815,
-0.1754942685365677,
0.12765537202358246,
0.30457842350006104,
0.4009692668914795,
-0.23114144802093506,
-0.1721448004245758,
-0.744466245174408,
-0.14900986850261688,
0.47007182240486145,
-0.7967952489852905,
0.0902996584773063... | |
options:storeOptions
withMappingModel:mappingModel | [
-0.3621307611465454,
-0.37314578890800476,
0.10031377524137497,
0.22686342895030975,
0.09794370085000992,
0.1731141358613968,
0.06595569103956223,
-0.14106620848178864,
-0.3244558870792389,
-0.9504405856132507,
-0.48468974232673645,
0.5054364800453186,
-0.09947499632835388,
-0.117544978857... | |
toDestinationURL:[NSURLfileURLWithPath:tmpPath]
destinationType:storeType
destinationOptions:storeOptions | [
-0.25330662727355957,
-0.34296342730522156,
0.3340975344181061,
-0.1252802014350891,
0.057657767087221146,
0.3922751843929291,
0.5075157880783081,
0.04198431223630905,
-0.004715935792773962,
-0.7199260592460632,
-0.1028534546494484,
0.32190650701522827,
-0.11886299401521683,
0.090643696486... | |
error:error]) {
return NO;
} else { | [
-0.1609647274017334,
0.1486121565103531,
0.044548794627189636,
-0.24131911993026733,
0.27418994903564453,
0.30492666363716125,
0.49655264616012573,
-0.2567325830459595,
-0.08965731412172318,
-0.24048587679862976,
-0.15125331282615662,
0.8577549457550049,
-0.36588287353515625,
0.11889185756... | |
//replace old with new
if(![[NSFileManager defaultManager] removeItemAtPath:[url path] error:error] ||
![[NSFileManager defaultManager] moveItemAtPath:tmpPath toPath:[url path] error:error]) {
return NO; | [
-0.15710043907165527,
-0.09274551272392273,
0.44467616081237793,
-0.2947995662689209,
0.20750832557678223,
-0.11900348961353302,
0.35472095012664795,
-0.2397211194038391,
-0.06744198501110077,
-0.6447965502738953,
-0.37384501099586487,
0.6985247135162354,
-0.27519306540489197,
0.2237876057... | |
}
// update document file modification date to prevent warning (#292)
NSDate *newModificationDate = [[[NSFileManager defaultManager] fileAttributesAtPath:[url path] traverseLink:NO] bjectForKey:NSFileModificationDate];
[self setFileModificationDate:newModificati... | [
0.040250446647405624,
-0.21711574494838715,
0.7204377055168152,
-0.36127418279647827,
0.18580959737300873,
-0.009285186417400837,
0.528897225856781,
-0.5237460732460022,
-0.2796243727207184,
-0.48405590653419495,
-0.10096162557601929,
0.7035360336303711,
-0.2302381992340088,
0.038330759853... | |
}
@finally {
[migrationManager release];
}
}
}
return [super configurePersistentStoreCoordinatorForURL:url ofType:fileType modelConfiguration:configuration storeOptions:storeOptions error:error];
```
I haven't run across this particular situation, but I have a few gue... | [
-0.00224224547855556,
-0.3619030714035034,
0.3707454204559326,
-0.06962268799543381,
0.5094202160835266,
-0.1280757486820221,
0.38201916217803955,
-0.12589670717716217,
-0.25899481773376465,
-0.870600700378418,
-0.07393357902765274,
0.7322328686714172,
-0.5023444890975952,
0.04435278102755... | |
use FSExchangeObjects(), it'll realize that it's looking at a completely different file.
Second, you can manually set your document's managed object model by overriding -managedObjectModel, in particular using the +mergedModelFromBundles: method to load the models from your framework. According to the docs, it should ... | [
-0.06961429119110107,
-0.5650336146354675,
0.5585552453994751,
0.31110697984695435,
-0.08105215430259705,
-0.39904215931892395,
0.1099850982427597,
-0.17103096842765808,
-0.3156251609325409,
-0.7741698026657104,
-0.17244555056095123,
0.6692376136779785,
-0.4279142916202545,
-0.063714869320... | |
Alright, so I just finished my last compiler error (so I thought) and these errors came up:
```
1>GameEngine.obj : error LNK2001: unresolved external symbol "public: static double WeaponsDB::PI" (?PI@WeaponsDB@@2NA)
1>Component.obj : error LNK2001: unresolved external symbol "public: static double WeaponsDB::PI" (?PI@... | [
0.45121249556541443,
0.05903108790516853,
0.31304067373275757,
0.04452105239033699,
-0.22760511934757233,
0.05947771295905113,
0.56393963098526,
-0.7955692410469055,
-0.32499971985816956,
-0.23803357779979706,
-0.06556457281112671,
0.6823903322219849,
-0.5126171112060547,
-0.20867319405078... | |
static class Environment * Environment::instance_" (?instance_@Environment@@0PAV1@A)
1>Environment.obj : error LNK2019: unresolved external symbol "public: static void __cdecl Environment::spyAlertOver(void)" (?spyAlertOver@Environment@@SAXXZ) referenced in function "public: void __thiscall Environment::notificationOfS... | [
-0.36760932207107544,
-0.012899557128548622,
0.21509653329849243,
-0.2558181881904602,
0.09047294408082962,
0.3071955442428589,
-0.07569438219070435,
-0.20548628270626068,
-0.05964615195989609,
-0.24548743665218353,
-0.4254671037197113,
0.7797619104385376,
-0.415240079164505,
0.33928948640... | |
: error LNK2001: unresolved external symbol "public: static bool GameDriver::evaluatingInputFlag" (?evaluatingInputFlag@GameDriver@@2_NA)
1>GameDriver.obj : error LNK2001: unresolved external symbol "public: static bool GameDriver::keyQuitFlag" (?keyQuitFlag@GameDriver@@2_NA)
1>GameDriver.obj : error LNK2001: unresolve... | [
-0.6149348020553589,
0.1674191653728485,
0.19908052682876587,
-0.2156217098236084,
-0.04934588819742203,
0.2544700801372528,
0.3288404643535614,
-0.2508573532104492,
-0.10030282288789749,
-0.2529694736003876,
-0.45828917622566223,
0.904609739780426,
-0.20412877202033997,
0.2056047469377517... | |
error LNK2001: unresolved external symbol "private: static struct BITMAP * GUI_Env::buffer" (?buffer@GUI_Env@@0PAUBITMAP@@A)
1>GUI_Info.obj : error LNK2001: unresolved external symbol "private: static struct BITMAP * GUI_Info::buffer" (?buffer@GUI_Info@@0PAUBITMAP@@A)
1>MenuDriver.obj : error LNK2019: unresolved extern... | [
-0.437643826007843,
0.1952945441007614,
0.39592841267585754,
-0.10926354676485062,
-0.3267524242401123,
0.4291497766971588,
0.21403568983078003,
-0.6886676549911499,
-0.35232433676719666,
-0.4333818852901459,
-0.2445405125617981,
0.6212568283081055,
-0.3224318325519562,
-0.0044115353375673... | |
LNK1120: 23 unresolved externals
```
Alright, here's a brief overview.
PI is a static constant in WeaponsDB and is referenced by other classes using WeaponsDB::PI and the appropriate #include (what's wrong with this?)
Most other errors stem from static variables and static methods for timers from the allegro gaming... | [
0.19095957279205322,
0.20233392715454102,
0.3305167555809021,
-0.09551367908716202,
-0.1501455157995224,
0.052792053669691086,
0.28056326508522034,
-0.42739206552505493,
-0.028491050004959106,
-0.2842099368572235,
0.09365000575780869,
0.6662455797195435,
-0.40161001682281494,
0.08251187205... | |
why this causes an error.
Most often, when the linker is failing to detect a static member it is because you to forgot to really define it somewhere, as it was pointed before:
```
// header
class X {
static const int y;
};
// cpp
const int X::y = 1;
```
But in your case, as you are not only missing static variab... | [
0.3146038353443146,
0.14227551221847534,
-0.034477997571229935,
0.1012963205575943,
0.18585573136806488,
-0.2219829559326172,
0.41043397784233093,
-0.10630764812231064,
-0.39094242453575134,
-0.46796730160713196,
0.022151758894324303,
0.462599515914917,
-0.42589271068573,
0.314549237489700... | |
compile and link it together. If the symbols belong to a compilation unit in an external library (from your current project) then you must remember to link with the library. | [
0.4192136228084564,
0.23473842442035675,
0.08807818591594696,
0.26846247911453247,
0.14317366480827332,
-0.2561761140823364,
0.060659416019916534,
-0.2253880798816681,
0.04184110090136528,
-0.9823320508003235,
-0.24604934453964233,
0.23142948746681213,
-0.10492328554391861,
-0.287118256092... | |
I have a form without caption, using on double click to maximize : Code looks like this:
```
procedure xxxxxx;
begin
if Form1.WindowState=wsNormal then
begin
Form1.WindowState:=wsMaximized;
Form1.SetBounds(0,0,screen.Width,screen.Height-getHeightOfTaskBar);
end
else
beg... | [
0.2071288526058197,
0.0010323564056307077,
0.816947340965271,
-0.3062746822834015,
0.1257769763469696,
-0.1437644511461258,
0.5446563363075256,
-0.5064467787742615,
0.29587113857269287,
-0.7743144631385803,
-0.2991276979446411,
0.2907806932926178,
-0.16537736356258392,
0.18514113128185272,... | |
: TRect;
begin
hTaskbar := FindWindow('Shell_TrayWnd', Nil );
if hTaskBar<>0 then
GetWindowRect(hTaskBar, rect);
Result:=rect.bottom - rect.top;
end;
```
This works good, except that I have to figure out where is task bar to reset SetBounds ...
What is the correct way to do this?
Thanks.
Sou... | [
-0.10668393224477768,
-0.15985262393951416,
0.820041298866272,
-0.13434185087680817,
0.10214253515005112,
-0.08682925999164581,
0.5139303803443909,
-0.21985694766044617,
-0.14853732287883759,
-0.9216840267181396,
-0.3364989757537842,
0.7560181021690369,
-0.3486701548099518,
0.0774133503437... | |
- Left, Bottom - Top);
``` | [
-0.24396048486232758,
0.30043497681617737,
0.38298726081848145,
-0.4177435338497162,
-0.2902485132217407,
0.3528779149055481,
0.11982984095811844,
-0.0013182064285501838,
-0.1242174357175827,
-0.44458305835723877,
-0.607393205165863,
0.47121310234069824,
-0.37720710039138794,
0.31194549798... | |
Suppose I am entering validation code into my model of multi-language publication database. The database needs either an English or a Japanese title for a particular journal. So I need to validate\_presence\_of at least one of the two. Right now I can easily check that both exists, but am stumped on the case of "at lea... | [
-0.013735366053879261,
0.5127668976783752,
-0.09306835383176804,
-0.017295369878411293,
-0.03512691706418991,
-0.2351342737674713,
0.1126999482512474,
-0.14839763939380646,
-0.14280720055103302,
-0.31794115900993347,
-0.04756370559334755,
0.16748283803462982,
0.06261563301086426,
0.2084001... | |
:journal_title_ja, :if => :check_english
def check_japanese
journal_title_ja.nil?
end
def check_english
journal_title.nil?
end
end
```
This should work. Hope I got the question straight.
Watch the [episode no. 41 on railscasts](http://railscasts.com/episodes/41) for better understanding | [
-0.02068701758980751,
0.10473434627056122,
0.12328117340803146,
0.21131949126720428,
-0.29919373989105225,
-0.342944473028183,
0.5778555870056152,
0.060290250927209854,
-0.3011246919631958,
-0.480182021856308,
-0.3202087879180908,
0.3668675124645233,
-0.003689292585477233,
0.16760319471359... | |
i want ask some question about asp.net mvc
1. Is static constructor will init every user request?
2. Is static data share for every user?
This answer is completely generic and not only for ASP.NET MVC.
1. Static constructors will run at most once per application domain. It's guaranteed that it's run before any static... | [
0.36148542165756226,
-0.19642698764801025,
0.2587485611438751,
-0.03144901990890503,
-0.396019846200943,
-0.17871132493019104,
0.1305086612701416,
0.009513111785054207,
-0.5003604292869568,
-0.501892626285553,
0.035767294466495514,
0.29889407753944397,
-0.6786501407623291,
0.33388513326644... | |
for all users. *Side note: If you declare your static fields as `ThreadStatic`, they will only be available for a single thread, which probably doesn't make much sense in an ASP.NET application.* | [
0.4885573387145996,
-0.28012245893478394,
0.18724536895751953,
0.11421763896942139,
0.03470730409026146,
-0.08332448452711105,
0.2885449528694153,
0.42789125442504883,
-0.5663691163063049,
-0.482802152633667,
-0.0827576220035553,
0.16724005341529846,
-0.4128260016441345,
0.3722488880157470... | |
First a little intro:
Last year i wrote this <http://dragan.yourtree.org/code/canvas-3d-graph/>
Now, i want to make complete rewrite of it, because that old version have some limitations, for example: sometimes it happens that bars are not visible, because they are drawn one behind another.
In this old version there... | [
0.4333847165107727,
-0.05468420311808586,
0.5223106145858765,
-0.12148554623126984,
-0.23742423951625824,
-0.26210731267929077,
0.3080604672431946,
0.18203850090503693,
-0.3110096752643585,
-0.5020825862884521,
0.19447751343250275,
0.143058180809021,
-0.3360302150249481,
0.0730631500482559... | |
in and out.
I've already decided that i will use <http://sylvester.jcoglan.com/> for vector/matrix stuff, but i'm still unable to find good tutorial for 3D. There are tons of texts on the Internet, most of them date from the 90s, an are incomplete or written really bad.
So, my question is: what is the best online res... | [
0.32699054479599,
0.05264982208609581,
0.18745675683021545,
-0.1916244477033615,
-0.3850398361682892,
0.040197525173425674,
-0.23974832892417908,
-0.0060441503301262856,
-0.1420336365699768,
-0.6947613954544067,
0.19311858713626862,
0.14046406745910645,
-0.24952180683612823,
-0.17568787932... | |
JavaScript related project then I understand but if you are simply doing this to grasp the basics of 3d rendering there might be more mature platforms out there for you.
In any case..
Links that might be useful to your learning:
* [Prototyping A Simple 3d Renderer In JavaScript](http://hem.spray.se/vilius/js3Dtutor... | [
0.2845023572444916,
0.05295975133776665,
0.1211640015244484,
0.0232401080429554,
-0.4115709960460663,
-0.2561703026294708,
-0.049322791397571564,
-0.19369246065616608,
-0.21823641657829285,
-0.5896413326263428,
0.14847955107688904,
0.7537248134613037,
0.01757221296429634,
0.084614343941211... | |
I am looking into building an **authentication** in my ASP.NET application with the following requirements.
* A user has exactly one Role (i.e. Admin, SalesManager, Sales, ....)
* A role has a set of permissions to CRUD access a subset of existing objects. I.e.
"Sales has CREAD, READ, WRITE permission on object type "... | [
0.16101272404193878,
0.03534391522407532,
0.5518743395805359,
0.162276953458786,
-0.1980951428413391,
-0.034735411405563354,
-0.018086984753608704,
-0.18894214928150177,
0.029682613909244537,
-0.5627871751785278,
-0.29876619577407837,
0.596066415309906,
0.06333628296852112,
0.0950634628534... | |
All database managed (MSSQL), implemented in C#/ASP.NET
I would like to get feedback on these requirements? Any ideas how to implement this using ASP.NET framework(as much as possible)? (However, I'm also interested to know how this can be achieved without Memberships)
I think what you need to do here is implement a s... | [
0.2966102659702301,
-0.15438111126422882,
0.34629276394844055,
0.38363707065582275,
0.07054014503955841,
-0.2211115062236786,
-0.06797172874212265,
0.2055252343416214,
-0.20380696654319763,
-0.6652830243110657,
-0.07804695516824722,
0.5535528063774109,
-0.5372883081436157,
0.20787960290908... | |
or additional database queries to determine the active user's permissions.
I can't think of a way to declaratively define these permissions centrally. They need to be distributed into the implementation of the functions. If you want do improve the design, however, you could use dependency injection to insert authorize... | [
-0.1384194791316986,
0.126678004860878,
0.2885301411151886,
0.17949260771274567,
0.35792797803878784,
-0.26856333017349243,
0.2550133764743805,
-0.34118133783340454,
-0.11608384549617767,
-0.39058923721313477,
-0.22601822018623352,
0.49483275413513184,
-0.4712079167366028,
0.13937585055828... | |
I am adding a custom background for my UINavigationBar. It works fine as long as the phone is in portrait mode. As soon as I switch to landscape mode, half the bar appears blue (the default navbar color) and half of it has my image
How can I stretch the image for landscape mode and make it small again for portrait mod... | [
0.05453607067465782,
-0.2863906919956207,
0.763313889503479,
-0.004799865651875734,
0.06205400079488754,
0.3615259826183319,
0.4095660150051117,
-0.17921413481235504,
-0.20807544887065887,
-0.9680922031402588,
-0.08574207872152328,
0.6080952286720276,
-0.2250659316778183,
0.108746983110904... | |
the autoresizingMask of your background image view; try using `UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight` | [
0.06322049349546432,
-0.047928567975759506,
0.40711987018585205,
0.18082690238952637,
-0.0010859447065740824,
-0.03884592279791832,
0.395251989364624,
0.19431915879249573,
0.07356704771518707,
-0.8873631954193115,
-0.13808110356330872,
0.9304984211921692,
-0.09503499418497086,
-0.230783551... | |
```
#include<iostream>
using namespace std;
class A
{
int a;
int b;
public:
void eat()
{
cout<<"A::eat()"<<endl;
}
};
class B: public A
{
public:
void eat()
{
cout<<"B::eat()"<<endl;
}
};
class C: public A
{
public:
void eat()
{
cout<<"C::eat()"<<endl;
... | [
0.1691834181547165,
0.3650711178779602,
0.15918377041816711,
-0.6213207840919495,
0.35191547870635986,
0.37897878885269165,
0.3240906298160553,
-0.34513863921165466,
-0.12108747661113739,
-0.5343801379203796,
-0.6040241122245789,
0.6095300912857056,
-0.7453119158744812,
0.02472284622490406... | |
want to call foo with obj's B part without using virtual inheritance. How do i do that.
Also, in case of virtual inheritance, why the offset information need to be stored in the vtable. This can be determined at the compile time itself. In the above case, if we pass foo with D's object, at compile time only we can ca... | [
0.2856391966342926,
-0.21156160533428192,
0.05618901178240776,
-0.19390326738357544,
-0.19222475588321686,
-0.0635046437382698,
-0.04336543753743172,
-0.27139976620674133,
-0.0824122205376625,
-0.3948436677455902,
0.05827059596776962,
0.6611881852149963,
-0.47714996337890625,
-0.0514369048... | |
may want to do this), you may select between them by casting to B or C. The most appropriate from default casts here is the `static_cast` (as the weakest available), however it is not realy needed (it is still stronger than your case needs), as you are not casting to a derived type. A custom `safe_cast` template should... | [
0.27811112999916077,
-0.10293462872505188,
0.1292875111103058,
-0.18064893782138824,
-0.021858109161257744,
0.08418519794940948,
0.2881191074848175,
-0.5199461579322815,
0.13512581586837769,
-0.6444786190986633,
-0.09321536123752594,
0.6734538078308105,
-0.448393315076828,
-0.0690713450312... | |
of virtual inheritance,
> why the offset information need to be
> stored in the vtable. This can be
> determined at the compile time itself.
> In the above case, if we pass foo with
> D's object, at compile time only we
> can calculate the offset of D's A
> part.
This is a misconception. The foo function as it ... | [
0.1446002870798111,
-0.2243041843175888,
0.5032972693443298,
-0.03976348042488098,
-0.07951012998819351,
-0.005038199946284294,
0.009619561955332756,
-0.3009094297885895,
-0.08801262825727463,
-0.523643970489502,
-0.07821504026651382,
0.7073904275894165,
-0.3849889636039734,
0.095439247786... | |
passed compile time, you need to use templates:
```
template <class TypeDerivedFromA>
int foo(TypeDerivedFromA *ptr)
{
ptr->eat();
}
```
Virtual Inheritance
-------------------
Your questions mentions virtual inheritance. If you want to use virtual inheritance, you need to specify so:
```
class B: public virtual... | [
0.1805262416601181,
0.013422373682260513,
0.1811218559741974,
0.23163273930549622,
-0.01554823573678732,
0.22050625085830688,
0.08307939767837524,
-0.2387426495552063,
-0.26959526538848877,
-0.6980844140052795,
0.04466930404305458,
0.4191362261772156,
-0.24331963062286377,
0.22644442319869... | |
functions (which mean allowing derived class function to be called via base class pointer). If you want the B::eat to be called using A pointer, you can do this without virtual inheritance (actually virtual inheritance would prevent you doing so, as explained above), using virtual functions:
```
class A
{
int a;
... | [
0.03755718469619751,
-0.1884971708059311,
-0.026337068527936935,
-0.0884317085146904,
0.06114942207932472,
0.15735143423080444,
0.06719968467950821,
0.02062375657260418,
-0.0019251344492658973,
-0.5560535788536072,
-0.27994924783706665,
0.657566487789154,
-0.6264311075210571,
0.02288179658... | |
I need an equivalent to c++'s `std::multimap<K, V, Comp, Alloc>` in C-sharp. Does it exist in the standard library?
Because it's almost christmas :)
```
//////////////////////////////////////////////////////////////////////
// Algorithmia is (c) 2008 Solutions Design. All rights reserved.
// http://www.sd.nl
/////////... | [
-0.037572722882032394,
0.13233226537704468,
0.7284406423568726,
-0.0371609628200531,
0.09079515933990479,
-0.15020626783370972,
0.15803536772727966,
-0.1500764787197113,
-0.38755831122398376,
-0.7152670621871948,
-0.5447872281074524,
0.2854180932044983,
-0.25152838230133057,
0.180578738451... | |
// conditions and the following disclaimer.
// 2) Redistributions in binary form must reproduce the above copyright notice, this list of
// conditions and the following disclaimer in the documentation and/or other materials
// provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY SOLUTIONS DE... | [
0.34589526057243347,
0.6008312702178955,
0.38271740078926086,
-0.06321164220571518,
0.4227556586265564,
-0.02987724356353283,
-0.06834462285041809,
-0.14267225563526154,
-0.20462830364704132,
-0.42038992047309875,
-0.8582153916358948,
0.23862193524837494,
0.017365362495183945,
0.1127524375... | |
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)... | [
0.3242107629776001,
0.32947543263435364,
0.1304958611726761,
0.0548519603908062,
0.12449272722005844,
0.12040960043668747,
0.16702698171138763,
0.01834173873066902,
-0.2382778376340866,
-0.129806250333786,
-0.6194353699684143,
0.49957945942878723,
0.18027019500732422,
0.13199520111083984,
... | |
Solutions Design.
//
//////////////////////////////////////////////////////////////////////
// Contributers to the code:
// - Frans Bouma [FB]
//////////////////////////////////////////////////////////////////////
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SD.Tool... | [
-0.5458739399909973,
0.08567562699317932,
0.6217836737632751,
-0.005758362822234631,
0.33556824922561646,
0.43612197041511536,
0.17973960936069489,
-0.5844982266426086,
-0.18557840585708618,
-0.7464810013771057,
-0.5352820754051208,
0.2503381669521332,
-0.2785644829273224,
-0.0500307045876... | |
/// </summary>
/// <typeparam name="TKey">The type of the key.</typeparam>
/// <typeparam name="TValue">The type of the value.</typeparam>
public class MultiValueDictionary<TKey, TValue> : Dictionary<TKey, HashSet<TValue>>
{
/// <summary>
/// Initializes a new instance of the <see cref="... | [
0.08524281531572342,
-0.37850090861320496,
0.7647767663002014,
-0.052540410310029984,
-0.19437633454799652,
0.19782765209674835,
0.011524645611643791,
-0.4519270062446594,
-0.4218519628047943,
-0.6798983216285706,
-0.5206923484802246,
0.5269811153411865,
-0.3989274203777313,
0.161521479487... | |
{
}
/// <summary>
/// Adds the specified value under the specified key
/// </summary>
/// <param name="key">The key.</param>
/// <param name="value">The value.</param>
public void Add(TKey key, TValue value)
{ | [
0.4981859624385834,
-0.2611425518989563,
0.7430965900421143,
-0.07992221415042877,
0.046678122133016586,
0.3730001151561737,
-0.02412661351263523,
-0.7834863066673279,
-0.32035183906555176,
-0.17864958941936493,
-0.4791654050350189,
0.44293272495269775,
-0.5231121778488159,
0.0550603307783... | |
ArgumentVerifier.CantBeNull(key, "key");
HashSet<TValue> container = null;
if(!this.TryGetValue(key, out container))
{
container = new HashSet<TValue>();
base.Add(key, container);
} | [
-0.19742707908153534,
-0.45081275701522827,
0.6570307612419128,
-0.30334702134132385,
0.09687702357769012,
0.19670502841472626,
0.13142170011997223,
-0.1705043613910675,
-0.17446458339691162,
-0.5087796449661255,
-0.4651964008808136,
0.4834872782230377,
-0.3463084101676941,
0.2351532578468... | |
container.Add(value);
}
/// <summary>
/// Determines whether this dictionary contains the specified value for the specified key
/// </summary>
/// <param name="key">The key.</param>
/// <param name="value">The value.</param>
/// <returns>true if the value is sto... | [
0.012515567243099213,
-0.10511214286088943,
0.3726300597190857,
0.09322725981473923,
0.10810881108045578,
0.3460354804992676,
-0.33423224091529846,
-0.6081410646438599,
-0.3260558545589447,
-0.4134143590927124,
-0.2905268669128418,
0.07741806656122208,
-0.17059996724128723,
0.1867297738790... | |
public bool ContainsValue(TKey key, TValue value)
{
ArgumentVerifier.CantBeNull(key, "key");
bool toReturn = false;
HashSet<TValue> values = null;
if(this.TryGetValue(key, out values))
{ | [
0.038478173315525055,
-0.25707194209098816,
0.4514417350292206,
-0.1851317435503006,
-0.029522927477955818,
-0.15808852016925812,
0.6652460694313049,
-0.31895962357521057,
0.04881057143211365,
-0.34007877111434937,
-0.6416595578193665,
0.712268590927124,
-0.33883243799209595,
0.26214137673... | |
toReturn = values.Contains(value);
}
return toReturn;
}
/// <summary>
/// Removes the specified value for the specified key. It will leave the key in the dictionary.
/// </summary>
/// <param name="key">The key.</param>
/// <param | [
-0.47149229049682617,
-0.05298338085412979,
0.46957433223724365,
-0.1564496010541916,
-0.22986802458763123,
0.5218738913536072,
0.2962406575679779,
-0.5630038380622864,
0.05699392035603523,
-0.096466064453125,
-0.5405058860778809,
0.17186862230300903,
-0.12812574207782745,
0.23747888207435... | |
name="value">The value.</param>
public void Remove(TKey key, TValue value)
{
ArgumentVerifier.CantBeNull(key, "key");
HashSet<TValue> container = null;
if(this.TryGetValue(key, out container))
{
container.Remove(value); | [
0.04353001341223717,
-0.39846155047416687,
0.6071415543556213,
-0.25301846861839294,
0.17236661911010742,
0.15774564445018768,
0.277444064617157,
-0.42040354013442993,
-0.23074403405189514,
-0.22114598751068115,
-0.6561483144760132,
0.47237256169319153,
-0.46097689867019653,
0.611198723316... | |
if(container.Count <= 0)
{
this.Remove(key);
}
}
}
/// <summary>
/// | [
0.222361758351326,
-0.2669823467731476,
0.2201797068119049,
-0.1589149534702301,
0.22216174006462097,
-0.23066255450248718,
-0.16335232555866241,
-0.29049524664878845,
-0.04451902210712433,
-0.22813691198825836,
-0.2579839527606964,
0.3231498897075653,
-0.2869614362716675,
0.45198866724967... | |
Merges the specified multivaluedictionary into this instance.
/// </summary>
/// <param name="toMergeWith">To merge with.</param>
public void Merge(MultiValueDictionary<TKey, TValue> toMergeWith)
{
if(toMergeWith==null)
{
return; | [
0.137290358543396,
-0.3434012830257416,
0.8113296031951904,
-0.0644373819231987,
-0.20751558244228363,
0.4613606929779053,
0.5059599280357361,
-0.5815103054046631,
-0.3630748391151428,
-0.4800460636615753,
-0.1932598054409027,
0.7703723311424255,
-0.5358261466026306,
0.04929816350340843,
... | |
}
foreach(KeyValuePair<TKey, HashSet<TValue>> pair in toMergeWith)
{
foreach(TValue value in pair.Value)
{
this.Add(pair.Key, value); | [
-0.15680494904518127,
-0.1857326179742813,
0.7426645159721375,
-0.571011483669281,
0.16230939328670502,
0.1506410539150238,
0.39185482263565063,
-0.5138242244720459,
0.09835395216941833,
-0.6174876689910889,
-0.5965453386306763,
0.904934287071228,
-0.4406890869140625,
-0.034463658928871155... | |
}
}
}
/// <summary>
/// Gets the values for the key specified. This method is useful if you want to avoid an exception for key value retrieval and you can't use TryGetValue
/// (e.g. in lambdas)
/// </summary>
/// <param name="key">The key.</param> | [
0.08001033216714859,
-0.17015311121940613,
-0.0077916095033288,
0.03848089650273323,
0.08884362131357193,
0.14282065629959106,
0.09327279776334763,
-0.5061322450637817,
-0.3630092144012451,
-0.20246832072734833,
-0.21227896213531494,
0.46438613533973694,
-0.2271004319190979,
-0.10206574946... | |
/// <param name="returnEmptySet">if set to true and the key isn't found, an empty hashset is returned, otherwise, if the key isn't found, null is returned</param>
/// <returns>
/// This method will return null (or an empty set if returnEmptySet is true) if the key wasn't found, or
/// the values... | [
0.2917642891407013,
-0.2542085647583008,
0.48234114050865173,
-0.059066955000162125,
-0.1492106020450592,
0.32164353132247925,
0.5112500190734863,
-0.7654754519462585,
-0.5447655320167542,
-0.42543932795524597,
-0.40751710534095764,
0.5842665433883667,
-0.523438572883606,
-0.01373812463134... | |
{
HashSet<TValue> toReturn = null;
if(!base.TryGetValue(key, out toReturn) && returnEmptySet)
{
toReturn = new HashSet<TValue>();
}
return toReturn; | [
-0.30057916045188904,
-0.4514254927635193,
0.5402148962020874,
-0.3842960298061371,
-0.16591225564479828,
0.21607659757137299,
0.5442442297935486,
-0.3073636591434479,
-0.04065580293536186,
-0.4158104360103607,
-0.7163305878639221,
0.5568640232086182,
-0.32305002212524414,
0.13369779288768... | |
}
}
}
``` | [
0.033695679157972336,
0.4034728407859802,
0.1949702352285385,
-0.15257494151592255,
0.4299153685569763,
-0.20141436159610748,
0.07711705565452576,
0.4467844069004059,
0.3091506361961365,
-0.5090379118919373,
-0.3048633635044098,
0.5600791573524475,
-0.33611243963241577,
0.3141762912273407,... | |
I am looking for information about providing a license, or "terms of use", for a web application. The [Wikipedia article](http://en.wikipedia.org/wiki/Terms_of_Use) is very limited, and it seems that unlike "downloadable" software (or perhaps "installable" software, for lack of a better term), for which there is [much ... | [
0.8346448540687561,
0.4019545316696167,
0.22621436417102814,
0.05536186695098877,
0.2584308385848999,
-0.3192256987094879,
-0.0529136061668396,
-0.286087304353714,
0.037308208644390106,
-0.22805719077587128,
0.13194182515144348,
0.47218573093414307,
0.15173275768756866,
0.3111131191253662,... | |
jurisdictional limits you should take into consideration.
Hire a lawyer. Undesirable (and costly) as it seems, it can cost you a helluva lot more to get your TOS wrong. | [
0.14208993315696716,
0.038451869040727615,
0.11591105163097382,
0.33946874737739563,
0.29071205854415894,
-0.3449248671531677,
-0.028240565210580826,
-0.11700105667114258,
-0.29758235812187195,
-0.33073464035987854,
0.36968597769737244,
0.7204136848449707,
0.07349727302789688,
0.0700639486... | |
Is is possible to query the current browser from within an applet?
I would like to know if the current browser is IE6 or IE7.
Here's something for ya: <http://www.rgagnon.com/javadetails/java-0160.html> | [
0.10586868971586227,
-0.07646685093641281,
0.2159978598356247,
-0.272683709859848,
-0.1464669555425644,
-0.01968694105744362,
0.3246822953224182,
0.016146348789334297,
-0.25433990359306335,
-0.6492993831634521,
0.012027970515191555,
0.3734591603279114,
-0.14860191941261292,
-0.055643755942... | |
I need your expertise once again. I have a java class that searches a directory for xml files (displays the files it finds in the eclipse console window), applies the specified xslt to these and sends the output to a directory.
What I want to do now is create an xml containing the file names and file format types. The... | [
0.5743072032928467,
0.2393561750650406,
0.30485597252845764,
0.1335860639810562,
0.020108021795749664,
-0.17141534388065338,
-0.12795118987560272,
-0.17713406682014465,
-0.0018493403913453221,
-0.6317145824432373,
0.09276564419269562,
0.7596313953399658,
0.33370816707611084,
-0.12215175479... | |
</fileName>
<fileType> </fileType>
</file>
```
Where for every file it finds in the directory it creates a new `<file>`.
Any help is truely appreciated.
Have a look at DOM and ECS. The following example was adapted to you requirements from [here](https://web.archive.org/web/1/http://articles.techrepublic%... | [
0.055891647934913635,
-0.04506005346775055,
0.7411081790924072,
-0.05064773932099342,
0.3534480035305023,
-0.21553786098957062,
-0.05434350669384003,
-0.46725988388061523,
-0.15146929025650024,
-0.7175955176353455,
-0.6214296221733093,
0.8187582492828369,
-0.07604427635669708,
0.1934916675... | |
anyone able to tell me how often a materialized view is set to refresh with the following setting plz?
REFRESH FORCE ON DEMAND START WITH sysdate+0 NEXT (round(sysdate) + 1/24) + 1
i think i read it as every hour but i'm not sure
```
SQL> alter session set nls_date_format = 'yyyy-mm-dd :hh24:mi:ss';
Session changed.... | [
-0.013256286270916462,
-0.19817599654197693,
1.1591705083847046,
-0.033672578632831573,
-0.44773006439208984,
0.14049828052520752,
0.30780088901519775,
-0.15253058075904846,
-0.4739038050174713,
-1.0011433362960815,
-0.12162184715270996,
1.2082933187484741,
0.04847477003931999,
-0.03295047... | |
Closed as exact duplicate of [this question](https://stackoverflow.com/questions/145856).
I have an array/list of elements. I want to convert it to a string, separated by a custom delimitator. For example:
```
[1,2,3,4,5] => "1,2,3,4,5"
```
What's the shortest/esiest way to do this in c#?
I have always done this b... | [
-0.0647273063659668,
0.22523736953735352,
0.519639790058136,
-0.26520785689353943,
0.026177426800131798,
0.09189330041408539,
0.23513875901699066,
-0.41361701488494873,
-0.3676273822784424,
-0.3037196397781372,
-0.0527624674141407,
0.3853592276573181,
-0.4965379238128662,
0.053395688533782... | |
What do you guys think about this for a generic singleton?
```
using System;
using System.Reflection;
// Use like this
/*
public class Highlander : Singleton<Highlander>
{
private Highlander()
{
Console.WriteLine("There can be only one...");
}
}
*/
public class Singleton<T> where T : class
{
... | [
0.5510905981063843,
-0.4719127416610718,
0.31391534209251404,
0.048198189586400986,
0.06750297546386719,
-0.08825957030057907,
0.47012245655059814,
-0.3562026917934418,
-0.1859552562236786,
-0.6222409605979919,
-0.17800752818584442,
0.4575996994972229,
-0.22786839306354523,
0.4826887845993... | |
CreateInstance();
}
return instance;
}
private static void CreateInstance()
{
lock (initLock)
{
if (instance == null)
{ | [
0.06102674826979637,
-0.12566284835338593,
-0.045467350631952286,
-0.010761132463812828,
0.054960280656814575,
-0.21286705136299133,
0.4149622321128845,
-0.16120661795139313,
0.015768613666296005,
-0.24627070128917694,
-0.24419435858726501,
0.5633428692817688,
-0.3792479336261749,
0.412504... | |
Type t = typeof(T);
// Ensure there are no public constructors...
ConstructorInfo[] ctors = t.GetConstructors();
if (ctors.Length > 0)
{
throw | [
0.4041173756122589,
-0.353250652551651,
0.08798141032457352,
-0.37730729579925537,
0.17455549538135529,
-0.08905588090419769,
0.5647103190422058,
-0.6435214877128601,
0.10520534962415695,
-0.28462696075439453,
-0.2869448959827423,
0.6439456939697266,
-0.4360670745372772,
0.1030997037887573... | |
new InvalidOperationException(String.Format("{0} has at least one accesible ctor making it impossible to enforce singleton behaviour", t.Name));
}
// Create an instance via the private constructor
instance = (T)Activator.CreateInstance(t, true);
}
}
... | [
0.0008729425608180463,
-0.02559582144021988,
0.1707342267036438,
0.03489354997873306,
0.037846967577934265,
0.0731840506196022,
0.35192835330963135,
-0.2786954939365387,
-0.3833024501800537,
-0.5190374255180359,
-0.3774404227733612,
0.43572911620140076,
-0.48549845814704895,
0.619798302650... | |
class is just a few lines of code, and with the difficulty of making a generic singleton i always write those lines of code.
```
public class Singleton
{
private Singleton() {}
static Singleton() {}
private static Singleton _instance = new Singleton();
public static Singleton Instance { get { return _i... | [
-0.24403716623783112,
-0.11522501707077026,
0.20909236371517181,
0.2705686092376709,
-0.1395876556634903,
-0.052458297461271286,
0.2809734344482422,
0.1769481897354126,
0.009950090199708939,
-0.6832029223442078,
-0.47641822695732117,
0.2732519507408142,
-0.4052676558494568,
0.4732478559017... | |
I have an NHibernate Dao..lets call it MyClassDao for want of a better name.
I am writing the following code.
```
MyClassDao myDao = new MyClassDao();
var values = myDao.GetByCriteria(Restrictions.Eq("Status", someStatusValue));
```
I am using this in a Unit Test to pull back values from the database. However, it ... | [
-0.14407797157764435,
0.15303191542625427,
0.5603446960449219,
-0.12297414243221283,
-0.07613472640514374,
-0.12692546844482422,
0.2573868930339813,
-0.12566249072551727,
0.008406773209571838,
-0.629510223865509,
0.20378707349300385,
0.36853331327438354,
-0.006835354026407003,
0.2702004015... | |
using the NHibernate Query language to restrict the size of a result set?
Use ICriteria.SetMaxResults() | [
-0.03311973437666893,
-0.37278005480766296,
0.06340742111206055,
0.19661246240139008,
0.08022301644086838,
-0.2318660318851471,
0.0028728682082146406,
-0.3239121437072754,
-0.24130570888519287,
-0.37805497646331787,
0.04091363400220871,
0.5095810890197754,
-0.779869794845581,
0.12483602762... | |
Suppose you have a file that contains IP addresses, one address in each line:
```
10.0.10.1
10.0.10.1
10.0.10.3
10.0.10.2
10.0.10.1
```
You need a shell script that counts for each IP address how many times it appears in the file. For the previous input you need the following output:
```
10.0.10.1 3
10.0.10.2 1
10.... | [
0.10626894235610962,
0.09252750128507614,
0.11379525065422058,
-0.05600203573703766,
-0.2461058348417282,
-0.11377239227294922,
0.33889469504356384,
-0.2637849748134613,
-0.24838072061538696,
-0.8056389093399048,
-0.00919412449002266,
0.6517801284790039,
-0.41156500577926636,
-0.0207114238... | |
a better solution in bash, not in those languages.)
ADDITIONAL INFO:
Suppose that the source file is 5GB and the machine running the algorithm has 4GB. So sort is not an efficient solution, neither is reading the file more than once.
I liked the hashtable-like solution - anybody can provide improvements to that solu... | [
-0.07375741004943848,
0.04820837453007698,
0.053136784583330154,
-0.002006140537559986,
-0.29729804396629333,
-0.21398727595806122,
0.2397066354751587,
-0.30414697527885437,
-0.48069652915000916,
-0.7356634736061096,
0.039959900081157684,
0.5791585445404053,
-0.3263016641139984,
-0.3118859... | |
I'm used to. And I think it was an interesting problem.
So please, don't blame the question, just ignore it if you don't like it. :-)
```
sort ip_addresses | uniq -c
```
This will print the count first, but other than that it should be exactly what you want. | [
0.26783671975135803,
0.18481749296188354,
0.4590049088001251,
-0.003392802318558097,
0.13288334012031555,
-0.22551994025707245,
-0.19564884901046753,
0.1051521971821785,
-0.014817791059613228,
-0.5316622853279114,
-0.027635760605335236,
0.42653247714042664,
-0.4629659056663513,
-0.01902828... | |
What is the correct syntax to create objects in javascript that will work across the majority of web browsers (by that I mean : IE 6+, Firefox 2+, Opera 9+ )
Is this valid
```
var a = {
"class": "Person",
"name": "William Shakespeare",
"birthday": -12802392000000,
"nickname": "Bill"
};
```
Or is this:
```
... | [
0.22586002945899963,
0.3312968611717224,
0.44285422563552856,
0.00852755643427372,
-0.27080410718917847,
-0.03695320710539818,
0.11925286054611206,
-0.263400673866272,
-0.1625930815935135,
-0.10560686886310577,
-0.2542283236980438,
0.34076133370399475,
-0.08914954960346222,
-0.061449036002... | |
a valid object literal in Javascript, but it is not JSON. Other services besides browser-side Javascript use JSON (e.g. webservices using php, Java, etc.) and if you construct a string that lacks the quotes, there is no guarantee that it will be parsed correctly -- although I suspect most implementations would be robus... | [
0.3847232758998871,
0.255340039730072,
0.1506747454404831,
0.19620737433433533,
-0.39819589257240295,
-0.3753710091114044,
0.6530752182006836,
-0.21232372522354126,
-0.24132683873176575,
-0.39113712310791016,
-0.19218070805072784,
0.6682713031768799,
-0.3020719587802887,
-0.478428572416305... | |
strings into Javascript objects.
**edit:** I guess technically your original question is not about JSON but rather the Javascript's syntax for **object literals**. The difference is that objects constructable from a JSON string will exclude many other possible object literals, e.g.:
```
var a = {cat: "meow", dog: "wo... | [
0.12076473981142044,
-0.06911668181419373,
-0.014036724343895912,
-0.3181948959827423,
-0.1884477585554123,
0.3273109495639801,
0.35955801606178284,
-0.33219796419143677,
-0.1863110363483429,
-0.47081154584884644,
-0.39320817589759827,
0.10465222597122192,
-0.7634345889091492,
-0.027504188... | |
property names). But object literals "b" and "c" cannot. Object literal "b" contains functions (not allowed in JSON). Object literal "c" above contains references to other variables in a way that is not representable in JSON because some of the references are shared. If you make a change to `c.names` it will also chang... | [
-0.12377364188432693,
0.04392259195446968,
0.15658004581928253,
0.1514526754617691,
-0.2237958312034607,
-0.32093527913093567,
0.1360962986946106,
-0.09822756797075272,
-0.30700454115867615,
-0.36909928917884827,
-0.42110487818717957,
0.41054433584213257,
-0.3727683126926422,
0.17432804405... | |
One for the mathematicians. This has gone around the office and we want to see who can come up with a better optimised version.
```
(((a+p) <= b) && (a == 0 || a > 1) && (b >= p)) &&
((b - (a + p) == 0) || (b - (a + p) > 1))
```
**Edit**: all data is positive int's
**Edit**: Better == simpler
```
(a + p <= b) ... | [
-0.43280652165412903,
-0.11902736872434616,
0.25627878308296204,
-0.05654720216989517,
-0.10917947441339493,
0.1624658852815628,
0.07504767179489136,
-0.5631716251373291,
-0.07472316920757294,
-0.5309391617774963,
-0.2511582374572754,
0.5559241771697998,
-0.5493959784507751,
-0.42366907000... | |
I have a method `fetchObjects(String)` that is expected to return an array of `Contract` business objects. The `className` parameter tells me what kind of business objects I should return (of course this doesn't make sense in this construed case because I already said I will return `Contract`s, but it's basically the s... | [
-0.023115575313568115,
-0.056573208421468735,
0.36232489347457886,
-0.0716022402048111,
-0.07972665131092072,
0.23760180175304413,
0.04080823436379433,
-0.4004996418952942,
-0.12359313666820526,
-0.39779919385910034,
-0.0017213717801496387,
0.6436357498168945,
-0.44267839193344116,
0.37568... | |
build myself an empty Contracts array. *But,* this gives me a value of static type `Object`! So next I need to cast it to the appropriate type, which in this case is `Contract[]` (see "asterisk-underlined" part in the listing below).
My question is: Is there a way, and how, to cast to `Contract[]` as I do in the listi... | [
0.3806464970111847,
0.10374198853969574,
0.07377299666404724,
-0.1525837630033493,
-0.14879538118839264,
0.07298937439918518,
0.2614796459674835,
-0.5155714154243469,
0.05231829360127449,
-0.7215139865875244,
0.2575518786907196,
0.4928225576877594,
-0.09067118912935257,
0.13154743611812592... | |
`Contract`.
Is this somehow inherently impossible, or can it be done somehow? Maybe using generics?
```
package xx.testcode;
import java.util.HashSet;
import java.util.Set;
class TypedArrayReflection {
public static void main(String[] args) {
try {
Contract[] contracts = fetchObjects("Contr... | [
0.04854721948504448,
-0.2625063359737396,
0.37804412841796875,
-0.3175850510597229,
0.06455957144498825,
0.01676209270954132,
0.41272327303886414,
-0.5387807488441467,
-0.15537859499454498,
-0.5091336369514465,
-0.3336063027381897,
0.6657354235649109,
-0.5489038228988647,
0.116524793207645... | |
Class.forName("xx.testcode."+className);
Set<?> entries = ObjectManager.getEntrySet(className);
return entries.toArray(
(Contract[]) java.lang.reflect.Array.newInstance(
/********/ entriesType, entries.size()) );
}
}
class Contract { } // business object
... | [
-0.0814518854022026,
-0.4371687173843384,
0.32165178656578064,
-0.11298426240682602,
0.0501931868493557,
0.2251916229724884,
0.1775277853012085,
-0.5812408328056335,
-0.08510018140077591,
-0.7451609969139099,
-0.22709272801876068,
0.7356381416320801,
-0.45832502841949463,
0.125632017850875... | |
return new HashSet<Contract>();
return null; // Error
}
}
```
Thanks.
---
**Update:** Using the type-safe method `toArray`, taken from [CodeIdol](http://codeidol.com/java/javagenerics/Reification/The-Principle-of-Truth-in-Advertising/), I updated my `fetchObjects` method thus:
```
static Contract[] fet... | [
0.1436862200498581,
-0.12677794694900513,
0.5924050807952881,
-0.1454833745956421,
-0.18963904678821564,
0.12239512801170349,
0.3509274125099182,
-0.6031029224395752,
0.014967132359743118,
-0.32719892263412476,
-0.18057747185230255,
0.8827782869338989,
-0.33801454305648804,
0.0538181625306... | |
int i = 0;
for (T x : c)
a[i++] = x;
return a;
}
```
What do I need to do to get rid of the compiler error quoted in the comment? Do I absolutely have to specify `Set<Contract>` in the return type of my `getEntrySet` method so that this can work? Thanks for any pointers.
You may use the class as the p... | [
0.4100677967071533,
-0.26431596279144287,
0.3863580822944641,
-0.3117847144603729,
0.10223161429166794,
0.01683719828724861,
0.09849730134010315,
-0.29718226194381714,
0.037590257823467255,
-0.4423949122428894,
-0.31989380717277527,
0.8562150597572327,
-0.44286417961120605,
0.0590927116572... | |
return l.toArray((T[]) java.lang.reflect.Array.newInstance(clazz, l.size()));
}
```
EDIT: (after read Yang comment)
No, You cannot use generic type with the value of a variable. | [
0.05694732815027237,
-0.15073823928833008,
0.23891112208366394,
-0.37244194746017456,
-0.027341043576598167,
-0.02606869302690029,
0.2554827630519867,
-0.29995599389076233,
0.21222802996635437,
-0.33498555421829224,
-0.15250004827976227,
0.38142499327659607,
-0.6648309230804443,
0.15532767... | |
I have a new ASP.NET MVC project (my first), and I had been running fine with 1 controller, view, and model. After I added a new controller and view, my first view started throwing this error message when I try to run the project:
Description: An error occurred during the parsing of a resource required to service this... | [
0.11478245258331299,
0.03718347102403641,
0.38517364859580994,
-0.08379129320383072,
-0.12483131885528564,
-0.08628813922405243,
0.5672478079795837,
-0.3277361989021301,
-0.2902858257293701,
-0.7986565828323364,
-0.07851101458072662,
0.39579612016677856,
-0.380304753780365,
0.2313115149736... | |
2: <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
Line 3: </asp:Content>
```
This is the entire contents of my Code Behind for that aspx page:
```
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace PeopleManagement.Web.Views... | [
0.2240031659603119,
0.039079949259757996,
0.611619234085083,
-0.1603987067937851,
-0.11764678359031677,
0.13058121502399445,
0.254942923784256,
-0.3353481590747833,
-0.29481709003448486,
-0.7099225521087646,
-0.18681707978248596,
0.3942517042160034,
-0.259027361869812,
0.039543550461530685... | |
and copying and pasting the markup. Also try shutting down VS and restarting. | [
0.2967755198478699,
0.0195721834897995,
0.04980187490582466,
0.33330029249191284,
0.07929004728794098,
-0.2238357812166214,
0.1473824679851532,
0.18199628591537476,
-0.016971735283732414,
-0.5579350590705872,
-0.07089880853891373,
0.7985444068908691,
-0.01017726305872202,
-0.01788498461246... | |
I have been working on standardizing the source control structure for our Team Foundation Server rollout for the new year. I have started by using the [Microsoft Team Foundation Server Branching Guidance](http://www.codeplex.com/BranchingGuidance) documentation available on CodePlex.
I was hoping to get some feedback ... | [
0.6902414560317993,
-0.03508856147527695,
-0.0033353872131556273,
0.07585170865058899,
-0.024762267246842384,
-0.328121155500412,
0.03925344720482826,
0.0412784144282341,
0.02973632700741291,
-0.6041032075881958,
0.042503125965595245,
0.2927949130535126,
0.24597345292568207,
-0.28986847400... | |
{Team Project}/
{Subproject}/ | [
-0.1788802444934845,
-0.10181856900453568,
-0.38969865441322327,
-0.02742830291390419,
0.06346337497234344,
0.01669856160879135,
0.2396223545074463,
0.1611853986978531,
0.12919071316719055,
-0.45704561471939087,
-0.23597635328769684,
0.409201443195343,
-0.06345473974943161,
-0.394602805376... | |
Development/
Trunk/ | [
-0.205189511179924,
0.0653836652636528,
-0.004078313242644072,
-0.11480441689491272,
0.25993579626083374,
0.4140205979347229,
0.08400072157382965,
0.40436410903930664,
-0.18160434067249298,
-0.635934591293335,
-0.5671469569206238,
0.22782742977142334,
0.0965837612748146,
0.1814840734004974... | |
Source/
Tests/
Sandcastle/
TeamBuildTypes/ | [
0.1099281758069992,
0.19807901978492737,
-0.4010738134384155,
0.0012230387656018138,
-0.008352982811629772,
-0.02725711278617382,
0.5414676666259766,
-0.09750578552484512,
-0.03263489156961441,
-0.4617198407649994,
0.049179136753082275,
0.16204051673412323,
-0.04144677147269249,
-0.3151042... | |
{Build Name}/
Branches/
{Branch Name}/
Source/
Tests/ | [
0.3803015947341919,
0.17975278198719025,
-0.25011876225471497,
0.1336601972579956,
0.21638339757919312,
0.1552039384841919,
0.3912847340106964,
0.09389692544937134,
0.1706230491399765,
-0.4294828772544861,
-0.16053009033203125,
0.0820239782333374,
0.3308790922164917,
0.23344102501869202,
... | |
Sandcastle/
TeamBuildTypes/
{Build Name}/
Integration/
Source/ | [
-0.054151732474565506,
0.12408729642629623,
-0.132522314786911,
-0.17262278497219086,
-0.0893278419971466,
0.011081881821155548,
0.3159427344799042,
-0.14573346078395844,
0.0912400335073471,
-0.6806086301803589,
-0.16799725592136383,
0.2761926054954529,
-0.26064062118530273,
-0.09659317135... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.