text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
I'll start a new project, that will include forms whose inputs and their types (textbox, checkbox etc), Validation rules are defined in DB.
I have to choose one of the frameworks for **Form Creation**, **Form Validation**, **Edit/Insert Forms** but I'm stuck. I doubt MVC will make handling **Parent-Child relationship*... | [
0.36226215958595276,
0.18776701390743256,
0.19419372081756592,
0.3030458688735962,
-0.27070096135139465,
0.05076401308178902,
0.44259464740753174,
-0.21750925481319427,
-0.08503876626491547,
-0.6583330035209656,
0.26567596197128296,
0.34561416506767273,
-0.09592824429273605,
0.283500909805... | |
butt. I do not think you will need reflection for WebForms, as long as you can somehow get the controls into an array.
My vote: WebForms. | [
0.3876104950904846,
-0.1876688301563263,
0.38967907428741455,
0.48096805810928345,
-0.32414817810058594,
0.14529505372047424,
0.06312189251184464,
0.1182064563035965,
-0.4524160325527191,
-0.8912438750267029,
0.2445746809244156,
0.5219478607177734,
0.036494117230176926,
-0.31642946600914,
... | |
I have this code on an applet. The applet works ok, but I get a lot of unnecessary duplicate download. In particular, I have noticed that each "getResource" triggers a download of the .JAR file.
```
static {
ac = new ImageIcon(MyClass.class.getResource("images/ac.png")).getImage();
dc = new ImageIcon(MyClass.c... | [
0.2804039716720581,
0.1864512413740158,
0.43699342012405396,
-0.04646304249763489,
-0.10726112872362137,
-0.12090449035167694,
0.3335248529911041,
-0.00044363204506225884,
-0.48190271854400635,
-0.8001845479011536,
-0.021808164194226265,
0.7669128775596619,
-0.43843188881874084,
0.03288696... | |
web server and reach them using separate HTTP requests (yes, its ugly and yes, it does not reduce number of needed downloads, but it at least reduces the amount of data that need to be transferred). | [
0.1305244117975235,
-0.00741125363856554,
0.47373878955841064,
0.4638412892818451,
-0.00018320487288292497,
-0.022182833403348923,
0.30758875608444214,
0.04899578541517258,
-0.44933265447616577,
-0.8647677302360535,
-0.1621033102273941,
0.15623080730438232,
-0.00039910917985253036,
0.09981... | |
I often find that the headers section of a file get larger and larger all the time but it never gets smaller. Throughout the life of a source file classes may have moved and been refactored and it's very possible that there are quite a few `#includes` that don't need to be there and anymore. Leaving them there only pro... | [
0.7267727255821228,
0.17124266922473907,
-0.11121470481157303,
0.29062849283218384,
-0.03771410509943962,
-0.34386658668518066,
0.5029510855674744,
0.05316956341266632,
-0.31501394510269165,
-0.5425296425819397,
0.02243703603744507,
0.31359073519706726,
-0.14827124774456024,
0.384896576404... | |
Does lint do this maybe?
It's not automatic, but [doxygen](http://www.doxygen.nl/) will produce dependency diagrams for `#included` files. You will have to go through them visually, but they can be very useful for getting a picture of what is using what. | [
0.47996193170547485,
-0.013038713485002518,
0.3408011198043823,
0.014375840313732624,
0.21491876244544983,
-0.5008590221405029,
-0.1251916140317917,
-0.19098050892353058,
-0.34445327520370483,
-0.3119514286518097,
0.0025054041761904955,
0.48251885175704956,
-0.24880963563919067,
-0.1246785... | |
I have an entity *Test*. It contains a Navaigation Property *Question* and *Question* contains a Navigation Property *QuestionLocale*.
```
var test = context.Tests
.Include("Question")
.FirstOrDefault();
```
works as expected. But how is it possible to include the *QuestionLocale*?
You can use:
```
v... | [
0.13544142246246338,
0.21093979477882385,
0.1059151142835617,
0.15022093057632446,
0.04710359871387482,
-0.2700135409832001,
0.22600668668746948,
-0.20660491287708282,
0.266137957572937,
-0.47239410877227783,
-0.141584575176239,
0.37995919585227966,
-0.03838865086436272,
0.1696959435939788... | |
I have run into an issue in which IE does not open up the Save As/Open dialog box for an Excel document like Firefox does.
So I have created a servlet filter that is using '\*.xls' as the url pattern. The issue that I now face (since this is the first filter I have created) is how to get the name of the file that the ... | [
0.5067304968833923,
0.022142937406897545,
0.4643598198890686,
-0.22808432579040527,
-0.09114512801170349,
-0.4373224377632141,
0.2535407841205597,
0.1138869896531105,
0.03954291343688965,
-0.9139958620071411,
-0.11136900633573532,
0.3536541163921356,
-0.6694628596305847,
0.1732374131679535... | |
have doFilter().
```
String fileName = "fileName.xls";
HttpServletRequest httpRequest = (HttpServletRequest) pRequest;
String requestURI = httpRequest.getRequestURI();
if(StringUtils.isNotBlank(requestURI))
{
String uri[] = StringUtils.split(requestURI, '/');
fileName = uri[uri.length - 1];
}
HttpServletRespons... | [
0.585457444190979,
-0.07077755779027939,
0.7469703555107117,
-0.16029079258441925,
0.009118677116930485,
-0.4311673939228058,
0.21281035244464874,
-0.37104544043540955,
0.09793785959482193,
-0.6616184711456299,
-0.4077884256839752,
0.6020843982696533,
-0.4876355826854706,
0.022451566532254... | |
set appropriately as well as the content disposition header, thus:
> response.setContentType("application/vnd.ms-excel");
>
> response.setHeader("Content-Disposition",
> "attachment; filename=\"" + filename +
> "\""); | [
0.06864549964666367,
0.0030840083491057158,
0.7396010160446167,
-0.049996912479400635,
-0.05307098105549812,
0.22756792604923248,
0.04427371919155121,
-0.5563955307006836,
-0.07345318049192429,
-0.639069139957428,
-0.7050967812538147,
0.6988614201545715,
-0.49603545665740967,
0.03203098475... | |
**[edit]**
I should note that I need to do this on a live production server. The MS SQL Server is already attached to our website and supports a 3rd party ERP package. I want to set up a separate database that I can code against for some auxiliary pages and internal-use apps) which will be completely independent (mo... | [
-0.02421356551349163,
0.21541330218315125,
0.32700636982917786,
0.01230876985937357,
-0.36225470900535583,
-0.28764608502388,
0.681510329246521,
-0.09840381890535355,
0.005656324792653322,
-0.36052238941192627,
-0.08168371021747589,
0.5111628174781799,
-0.4078620970249176,
0.08897338062524... | |
done it successfully?
For a development machine this is safe to do. The two database servers listen on different ports, so there is no problem of running both at the same time.
I wouldn't recommend it though for a production system. | [
0.7312911152839661,
0.10338687151670456,
-0.03620801493525505,
-0.0709245428442955,
0.2696077227592468,
-0.057604651898145676,
0.5126540064811707,
-0.08835972100496292,
-0.23982711136341095,
-0.13705655932426453,
0.4886188209056854,
0.6703106760978699,
0.17383697628974915,
-0.0558268949389... | |
To avoid singletons and global variables I'd like to be able to pass parameters to a TFrame component. However since a TFrame normally is included on form at design time it is only possible to use the default constructor.
The parent form can of course set some properties in the OnCreate callback after the TFrame has b... | [
0.6087065935134888,
0.08285428583621979,
0.4310138523578644,
0.17428772151470184,
0.08751387894153595,
-0.12279048562049866,
0.11529599875211716,
-0.35386815667152405,
-0.0015794711653143167,
-0.6805394887924194,
-0.17834755778312683,
0.6805548071861267,
-0.3395873010158539,
0.241294428706... | |
read. Then the required parameters could be passed to the TFrame constructor when created by the factory. Is there a way of accomplishing this?
Or does anyone have a better solution on how to pass parameters to a TFrame?
All components, including descendants of `TFrame`, need to be able to be constructed using the con... | [
0.8051238059997559,
0.15448401868343353,
0.25181859731674194,
0.25769877433776855,
0.14096666872501373,
-0.021447855979204178,
0.06536010652780533,
-0.38148602843284607,
-0.03023350052535534,
-0.5397322773933411,
-0.10504718124866486,
0.6346340179443359,
-0.275198757648468,
0.3768220841884... | |
provide some other constructor that requires other parameters.
Because of the design-time requirement, all components need to be able to exist with some or all of their properties still at their default values. That doesn't mean the components have to do useful things while they're in that state, but they do need to b... | [
0.24288058280944824,
0.020153097808361053,
0.4900331199169159,
0.2903488874435425,
0.4631921648979187,
-0.3780227601528168,
0.3810368776321411,
-0.10344584286212921,
-0.16109773516654968,
-0.6147292256355286,
-0.380245566368103,
0.562165379524231,
-0.04215039312839508,
0.04884153604507446,... | |
even if all its properties haven't been set up for final use yet.
My preferred option is to enforce the component's rules only at run time. Check that all the properties are set to sensible values before you allow them to be used. You can use assertions to enforce the proper use of your components. Consumers of your c... | [
0.5596005320549011,
0.17892830073833466,
0.39558911323547363,
0.2904488146305084,
0.21872371435165405,
-0.42521294951438904,
0.2220211625099182,
-0.3615950047969818,
0.17041124403476715,
-0.45562446117401123,
-0.016220999881625175,
0.8283972144126892,
0.1513475626707077,
-0.146094232797622... | |
I have asp.net 3.5 website, and i want to put an ajax uploader, but i want this ajax uploader to:
1. don't refresh the page while/after uploading
2. easy to integrate
3. free
4. Not swf upload control
5. i will use it in uploading images, so want a simple way to get the uploaded image file name, and be able to tell it... | [
0.4158419668674469,
-0.14749135076999664,
0.4622321128845215,
0.09073222428560257,
-0.6009016036987305,
-0.22586841881275177,
0.3177972733974457,
0.1372891366481781,
-0.3405818045139313,
-0.9828375577926636,
0.14368408918380737,
0.5495293140411377,
0.0407819002866745,
-0.2649160325527191,
... | |
<http://mattberseth.com/blog/2008/07/aspnet_file_upload_with_realti.html> | [
0.2058938890695572,
-0.39845010638237,
0.3505232036113739,
-0.17459192872047424,
0.10696931928396225,
0.1422235369682312,
0.20604123175144196,
0.06754911690950394,
-0.37654954195022583,
-0.41254371404647827,
-0.207543283700943,
0.6061733961105347,
0.07859958708286285,
0.135210320353508,
... | |
I have read a bit about [Design-Time Attributes for Components](http://msdn.microsoft.com/en-us/library/tk67c2t8.aspx). There I found an attribute called [CategoryAttribute](http://msdn.microsoft.com/en-us/library/system.componentmodel.categoryattribute.aspx). On that page it says that
> The CategoryAttribute class d... | [
-0.03283960744738579,
0.059986311942338943,
0.2580113708972931,
-0.09258905053138733,
-0.3735787570476532,
0.04628337547183037,
0.028488056734204292,
-0.24004802107810974,
-0.12541233003139496,
-0.45530787110328674,
-0.12412116676568985,
0.4970075786113739,
-0.13568870723247528,
0.22543282... | |
do I use them?
And yes, I do have the correct `using` to have access to the `CategoryAttribute`, cause `[Category("Whatever")]` do work. I'm just wondering how I use those defined common categories.
As you can see on MSDN it's only a getter property, not a setter.
```
public static CategoryAttribute Appearance { get;... | [
0.04697675630450249,
0.16278566420078278,
0.3783875107765198,
-0.15427470207214355,
-0.2782445549964905,
-0.27067553997039795,
0.1892499327659607,
-0.1798485815525055,
-0.17944760620594025,
-0.6928446888923645,
-0.10811995714902878,
0.8207190036773682,
-0.2902318239212036,
0.09360118210315... | |
{
appearance = new CategoryAttribute("Appearance");
}
return appearance;
}
}
```
So it doesn't do a heck of a lot.
The only use I can see for it, is something like this:
```
foreach (CategoryAttribute attrib | [
-0.39826008677482605,
0.08127449452877045,
0.3055025339126587,
-0.5451461672782898,
-0.2019074559211731,
-0.13114270567893982,
0.23723167181015015,
0.060273427516222,
-0.12750717997550964,
-0.6952415108680725,
-0.48776254057884216,
0.6638697981834412,
-0.30224940180778503,
-0.0049769137986... | |
in prop.GetCustomAttributes(typeof(CategoryAttribute), false))
{
bool result = attrib.Equals(CategoryAttribute.Appearance);
}
```
Basically, when using reflection to look at the class, you can easily check which category this belongs to without having to do a String comparison.... | [
0.1511775553226471,
-0.16995161771774292,
0.25673577189445496,
-0.07699676603078842,
-0.3403925597667694,
-0.23167505860328674,
0.40852972865104675,
-0.27242428064346313,
-0.08876470476388931,
-0.5231404304504395,
-0.16863161325454712,
0.6926770806312561,
-0.3084224760532379,
0.02679663524... | |
I have a table with two columns, userID and contentID. Basically this table is used to assign access to certain content to specific users. I have the request of every user that is assigned to content A also be assigned to content B. So how would I write a new row with this data (userid, [id of content B]) for each row ... | [
0.5455114841461182,
0.15881885588169098,
0.27457618713378906,
-0.03633333370089531,
0.12100475281476974,
0.18578845262527466,
-0.16651633381843567,
-0.00889789778739214,
0.1676100492477417,
-0.6989468932151794,
0.24943381547927856,
0.3227548897266388,
-0.4502701461315155,
0.311900854110717... | |
(contentid)
SELECT 11 AS Expr1
WHERE (contentid = 6)
```
and didn't work, so I'm not sure what I did wrong, here is what I tried to use:
```
insert into tbl_contentAccess
(userid, contentid)
select userid, 11
where contentid = 6
```
OK I found a new solution, don't worry about this anymore, thanks everyone... | [
-0.23217152059078217,
0.19418688118457794,
0.5203058123588562,
0.04790876805782318,
0.011112436652183533,
0.1620928943157196,
0.28317829966545105,
-0.06462852656841278,
0.03632726892828941,
-0.8960216641426086,
-0.20165322721004486,
0.5713222622871399,
-0.5447240471839905,
-0.1825012117624... | |
Let's say I have the following XML file
```
<a id="123">
<b type="foo" value="1" />
<b type="baz" value="1" />
</a>
<a id="789">
<b type="bar" value="12" />
</a>
<a id="999">
<b type="foo", value="2" />
</a>
```
I want to get a list of all the 'a' nodes that have a 'b' subnode with a type="foo" and value=... | [
0.48416849970817566,
0.3030073642730713,
0.3780692219734192,
-0.338893324136734,
-0.1768515557050705,
-0.28150495886802673,
0.02010435052216053,
-0.1915929913520813,
-0.09817081689834595,
-0.425570011138916,
0.04396383836865425,
0.4948761463165283,
-0.11117655038833618,
-0.0055277920328080... | |
I have an application that needs to allow users to write expressions similar to excel:
(H1 + (D1 / C3)) \* I8
and more complex things like
If(H1 = 'True', D3 \* .2, D3 \* .5)
I can only do so much with regular expressions. Any suggestions as to the right approach to doing this as well as any resources I can learn ... | [
0.14470800757408142,
0.3447266221046448,
0.354775071144104,
0.15773800015449524,
-0.014111848548054695,
-0.3375113308429718,
0.700596809387207,
0.3026267886161804,
-0.21561355888843536,
-0.6419162154197693,
0.042487043887376785,
0.5757135152816772,
0.367275208234787,
-0.09306241571903229,
... | |
**edit:**
ok, the line:
```
$( <?php echo("'#".$_GET['item']."'") ?> ).parent().show();
```
Is obviously and attempt to keep the menu open at the right place. I don't think this ever worked (got I hate working on other ppls code).
Then my current problem is how to access the `<ul class="myul">` directly above th... | [
-0.09701749682426453,
0.09866603463888168,
0.5214157700538635,
-0.23394836485385895,
-0.10518520325422287,
0.18909065425395966,
0.4340783655643463,
0.14929039776325226,
-0.04845459759235382,
-0.8158898949623108,
-0.19441941380500793,
0.4252367615699768,
-0.23845434188842773,
0.381558626890... | |
$( <?php echo("'#".$_GET['item']."'") ?> ).parent().show();
$('.myul').hide();
$('.slide_ul li:not(:first-child)').hide(); | [
0.13223470747470856,
-0.09328119456768036,
0.3150264024734497,
-0.4075165092945099,
0.24291808903217316,
0.3324195444583893,
0.2330758273601532,
-0.1420123428106308,
0.1811078041791916,
-0.2250826209783554,
-0.599744975566864,
0.18491943180561066,
-0.507089376449585,
0.4395688772201538,
... | |
$('.hideMe').click(function(){
$(this).next('ul').slideToggle('fast').siblings('ul:visible').slideUp('fast');
});
$('.myul a').click(function(e){
var url = $(this).attr('href'); | [
-0.21505993604660034,
-0.2761371433734894,
0.680701732635498,
-0.18692496418952942,
-0.06574750691652298,
0.20878493785858154,
0.32790419459342957,
-0.16789087653160095,
0.06613201647996902,
-0.54541015625,
-0.4070829451084137,
0.6391668915748596,
-0.31268149614334106,
0.5450479984283447,
... | |
var index = url.indexOf('=');
var substr = url.slice(index+1);
$('#productContainer >div').hide();
$('#productContainer').load("products/"+substr+"/product.html", function(){ | [
0.2417830228805542,
-0.41377130150794983,
0.7727335095405579,
-0.4524891674518585,
-0.07861713320016861,
0.31442791223526,
0.13372856378555298,
-0.36257120966911316,
0.006080185528844595,
-0.3750007152557373,
-0.535334050655365,
0.29796677827835083,
-0.4372907876968384,
0.3226970136165619,... | |
$(this).fadeIn('slow');
var i = 0;
$('.slide_ul li:not(:first-child)').hide(); | [
0.11303099989891052,
-0.2587108910083771,
0.3862898051738739,
-0.5496269464492798,
0.40061119198799133,
0.3497450649738312,
0.4002166986465454,
-0.13223707675933838,
0.1747649908065796,
-0.3579822778701782,
-0.23633700609207153,
0.34610041975975037,
-0.3559161126613617,
0.4157547056674957,... | |
});
});
```
HTML:
```
<!-- Right Navigation --> | [
-0.4200514554977417,
0.07413074374198914,
0.680146336555481,
-0.15614278614521027,
0.264660507440567,
-0.1449693888425827,
0.2930116355419159,
0.1083727478981018,
0.04255088046193123,
-0.7047346234321594,
-0.5822763442993164,
0.6820268630981445,
-0.2756480276584625,
0.06373968720436096,
... | |
<div id="rightNav">
<div id="navMenu">
<h2 id="navMenuheader">Catalogue</h1>
<h3 | [
-0.5447884798049927,
-0.06060657277703285,
0.11656217277050018,
-0.15663118660449982,
-0.015565790235996246,
0.02657296322286129,
-0.1773403137922287,
-0.424541711807251,
-0.23825393617153168,
-0.5713586807250977,
-0.17642474174499512,
0.21484233438968658,
-0.05767682194709778,
-0.00565851... | |
class="hideMe">Widgets</h3>
<ul class="myul">
<h4 class="hideMe">Widget Coins</h2> | [
0.34496405720710754,
-0.24879667162895203,
0.18361450731754303,
0.06255926936864853,
-0.23961544036865234,
0.25570929050445557,
-0.12026335299015045,
-0.21903663873672485,
-0.0006245292606763542,
-0.5012927651405334,
-0.17716309428215027,
0.09585853666067123,
0.017076704651117325,
-0.07112... | |
<ul class="myul">
<li id="001" >
<a href="products.php?item=001">The South African Widget</a> | [
0.2831553518772125,
-0.13252577185630798,
0.05347234383225441,
0.026574987918138504,
-0.13687264919281006,
0.32998204231262207,
0.0077713001519441605,
0.1295774281024933,
-0.2702369689941406,
-0.29276344180107117,
-0.13708823919296265,
-0.16311685740947723,
-0.05056837201118469,
-0.0672925... | |
</li>
```
The result of the menu click is to injectContent into a black div in the middle of the page. Does `$(document).ready(function(){` happen everytime this occurs? Otherwise I can't see why all the menu positions are updated.
I guess I need some more code to identify the place in the menu we are and leave the... | [
-0.03631395101547241,
0.383151650428772,
0.3029424548149109,
-0.3849526345729828,
0.39973199367523193,
0.20526458323001862,
0.26633280515670776,
-0.10453647375106812,
-0.055304259061813354,
-0.9483875632286072,
-0.26475009322166443,
0.3345068097114563,
-0.5604106187820435,
0.15607011318206... | |
on my desk.
Just had to add some jquery to reopen the relevant section of the menu after it has all been hidden. So right after the line `$('.myul').hide()` I reopen the menu section based on the url query ( products.php?item=001 ):
```
var item = <?php echo("'".$_GET['item']."'") ?>;
if (item != '... | [
0.31366991996765137,
0.28243616223335266,
0.6168243288993835,
-0.4398813247680664,
-0.0010029898257926106,
0.24667637050151825,
0.34986937046051025,
-0.25008463859558105,
-0.16298119723796844,
-0.2712920308113098,
-0.200241819024086,
0.2652169466018677,
-0.1121663749217987,
0.2495590597391... | |
item = "li#" + item;
$(item).parent().show();
$(item).parent().parent().show();
}
``` | [
0.10150949656963348,
0.23194916546344757,
0.07602275907993317,
-0.26569241285324097,
0.04495062306523323,
0.20562495291233063,
0.4055224359035492,
-0.36480098962783813,
-0.1530791074037552,
-0.3054284453392029,
-0.5456762909889221,
0.4206095039844513,
-0.5417792797088623,
0.599512875080108... | |
I would like the text in my textBox to be set to upper-case whenever currentItemChanged is triggered. In other words, whenever the text in the box changes I'd like to make the contents upper-case. Here is my code:
```
private void rootBindingSource_CurrentItemChanged(object sender, System.EventArgs e)
{
toUserText... | [
-0.3482949733734131,
0.012768464162945747,
0.4951234757900238,
-0.29063427448272705,
0.36213019490242004,
0.015256119892001152,
0.4542543590068817,
-0.18087628483772278,
-0.223049595952034,
-0.6862049698829651,
-0.34078317880630493,
0.7651331424713135,
-0.37463340163230896,
0.2427321374416... | |
Within Control Panel -> Regional and Language Options, there is a Formats tab, with a drop down of all possible language formats. I wish to retrieve this list using VB.NET. Could anyone point in the direction of which Windows API call to use?
Thanks
Did you try `System.Globalization.CultureInfo.GetCultures(CultureType... | [
0.6000674366950989,
-0.1662101447582245,
0.49119889736175537,
0.24403971433639526,
-0.0432511568069458,
0.09127651154994965,
0.2640089988708496,
0.14100795984268188,
-0.22653411328792572,
-0.7248237133026123,
0.14121636748313904,
0.21180012822151184,
-0.18014118075370789,
0.257442951202392... | |
I m looking for a way to find and replace large number of text files. For example;
I want to choose;
```
<li><a href="">Istanbul, TR POS </a></li>
<li><a href="">Ankara, TR POS </a></li>
<li><a href="">Izmir, TR POS </a></li>
```
WITH;
```
<li><a href="pos-istanbul-tr.php">Istanbul, TR POS </a></li>
<li><a href="p... | [
0.3036431670188904,
0.34427982568740845,
0.4397393763065338,
-0.06697139143943787,
-0.09707283973693848,
0.4105406403541565,
0.05686894804239273,
-0.04492976516485214,
-0.17049627006053925,
-0.7961118817329407,
-0.1361204981803894,
0.14558830857276917,
-0.7305865287780762,
0.16221544146537... | |
$1/eg' \
> *.html
```
### Cross-platform variant (+ building on [@Jonathan Leffler's answer](https://stackoverflow.com/questions/615204/replace-text-with-regular-expression/615286#615286))
Save it to `fill-href.pl`:
```
#!/usr/bin/perl -w -pi.bak
s/href="">([^,]+)/href="pos-\L$1\E-tr.php">$1/g
```
Run:
```
perl... | [
-0.05700038745999336,
-0.011439237743616104,
0.39017993211746216,
0.15400531888008118,
-0.060507893562316895,
0.28686994314193726,
0.20979896187782288,
-0.3231169581413269,
-0.17865429818630219,
-0.5317304730415344,
-0.3799037039279938,
0.19970892369747162,
-0.35731154680252075,
-0.0856033... | |
I am looking to do a presentation at work to our development team. I was wondering if their is any new tool which would be easy to demonstrate. It is just an after work thing for talking about new technologies. Thanks
[historical debugging](http://channel9.msdn.com/posts/VisualStudio/Historical-Debugger-and-Test-Impact... | [
0.489391565322876,
-0.1640355885028839,
0.7782230377197266,
-0.1168074831366539,
-0.3941621482372284,
-0.002872540382668376,
0.24366171658039093,
0.39534467458724976,
-0.24386006593704224,
-0.9379566311836243,
0.37917575240135193,
0.43532124161720276,
0.12106955796480179,
-0.05843671038746... | |
I have a simple web service deployed on tomcat using Apache Axis.
If i access the webservice as <http://localhost:8080/webservices/TransactionService> i see the usual message
> **TransactionService**
>
>
> Hi there, this is an AXIS service!
>
>
> Perhaps there will be a form for invoking the service here...
sho... | [
0.1626846045255661,
0.013054273091256618,
0.5871406197547913,
0.22707384824752808,
-0.014360187575221062,
-0.06810922920703888,
0.1659284234046936,
0.28128665685653687,
-0.3258294463157654,
-0.6862748861312866,
0.028561530634760857,
0.4751736521720886,
-0.3578518331050873,
0.43936946988105... | |
**message:** /webservices/TransactionService
>
>
> **description:** The requested resource (/webservices/TransactionService) is not available.
>
>
> **--------------------------------------------------------------------------------**
>
>
> **Apache Tomcat/5.5**
There is nothing in the tomcat logs
If i try deplo... | [
-0.12530691921710968,
0.04582134261727333,
0.38160958886146545,
0.20209789276123047,
0.2098218947649002,
-0.16832035779953003,
0.47935914993286133,
-0.050191301852464676,
-0.5663804411888123,
-0.7468858957290649,
-0.37371930480003357,
0.8526470065116882,
-0.2743054926395416,
-0.16015122830... | |
of the hosts is default. It responds to all requests now matter what host they are targeted too, if there is no specific Host. For your setup you may want to leave only that one active. | [
0.03008829616010189,
-0.41272273659706116,
0.42676687240600586,
0.17995242774486542,
-0.04504416510462761,
-0.1253339648246765,
-0.09364517778158188,
0.1848045438528061,
-0.30048149824142456,
-0.8902026414871216,
-0.1399570107460022,
0.62227463722229,
-0.5386033654212952,
-0.00447802338749... | |
My company is building a product. It's going to be versioned by SVN. It's a webapp so basically there will never be a version out which doesn't have some features in them and thus could always be labeled as beta. But since it's going to be a corporate product I really don't want the "unstable watchout" on there. So how... | [
0.81577068567276,
0.09850499033927917,
0.3201781213283539,
-0.10533939301967621,
0.05480078235268593,
-0.4408717453479767,
0.18904320895671844,
0.26357585191726685,
-0.1980341672897339,
-0.3917196989059448,
0.12485627830028534,
0.5141237378120422,
-0.10139292478561401,
0.23574060201644897,... | |
a major version for which customers might have to pay more, or is it an update of the current major version which may be free? Less of an R&D decision and more a product decision.
**minor**: Starts from 0 whenever **major** is incremented. +1 for every version that goes public.
**release**: Every time you hit a devel... | [
0.17232397198677063,
-0.34551963210105896,
0.548026978969574,
-0.2125643640756607,
-0.06675992906093597,
-0.2057679295539856,
0.4571024477481842,
0.1759197860956192,
-0.4243837893009186,
-0.535382091999054,
-0.7626869678497314,
0.5162091255187988,
-0.1688733845949173,
0.4463745355606079,
... | |
revision, I find that works best.
**Examples**
My current chrome: 83.0.4103.61 | [
0.1807655394077301,
0.40047842264175415,
0.5754557847976685,
-0.045309197157621384,
0.07846719771623611,
0.26401033997535706,
0.08532527089118958,
-0.04670504480600357,
-0.3847367763519287,
-1.0482836961746216,
0.038623929023742676,
0.679909884929657,
0.341208815574646,
0.19115757942199707... | |
I am considering Erlang as a potential for my upcoming project. I need a "Highly scalable, highly reliable" (duh, what project doesn't?) web server to accept HTTP requests, but not really serve up HTML. We have thousands of distributed clients (other systems, not users) that will be submitting binary data to central cl... | [
0.27106747031211853,
-0.029811669141054153,
0.2859728932380676,
0.2789258658885956,
0.10771671682596207,
-0.09186282008886337,
0.06869541853666306,
0.12902016937732697,
-0.22020475566387177,
-0.5863931775093079,
-0.08258116245269775,
0.19800610840320587,
-0.25719743967056274,
-0.1535011380... | |
a technology like Erlang? For instance, I understand Erlang's text processing capabilities might leave something to be desired.
You comments are appreciated.
Thanks.
This sounds like a perfect candidate for a language like Erlang. The scaling properties of the language are very good, but if you're worried about the da... | [
0.2759750783443451,
0.07275998592376709,
0.07969118654727936,
0.4143269658088684,
0.2861040532588959,
-0.2156200110912323,
-0.12168274074792862,
0.3870583176612854,
-0.22418679296970367,
-0.5967574715614319,
0.1543317586183548,
0.3979097902774811,
-0.13821551203727722,
0.013546028174459934... | |
I am receiving the following exception while trying to make an SSL connection to a web service. Does this error mean my local keystore/certificate is expired, or is it that I cannot trust the remote server because it has the expired certificate?
```
javax.net.ssl.SSLHandshakeException: certificate expired
at com.i... | [
0.02919524349272251,
0.24082708358764648,
0.5606984496116638,
-0.13819172978401184,
0.045650631189346313,
-0.3103698194026947,
0.6277561783790588,
-0.16887828707695007,
-0.2919984459877014,
-0.8045601844787598,
-0.3241763710975647,
0.19118943810462952,
-0.14177925884723663,
0.4329814910888... | |
I often see legacy code checking for `NULL` before deleting a pointer, similar to,
```
if (NULL != pSomeObject)
{
delete pSomeObject;
pSomeObject = NULL;
}
```
Is there any reason to checking for a `NULL` pointer before deleting it? What is the reason for setting the pointer to `NULL` afterwards?
It's perfe... | [
0.20166164636611938,
0.09664079546928406,
-0.20956115424633026,
0.057726841419935226,
0.4096381664276123,
-0.40168488025665283,
0.6149721145629883,
0.10841693729162216,
-0.3639200031757355,
-0.5203084945678711,
-0.3219996690750122,
0.5512295365333557,
-0.2839387059211731,
0.268543124198913... | |
may no longer be "safe" to `delete NULL` | [
0.1760391741991043,
0.26516154408454895,
0.0758395716547966,
0.0915893092751503,
0.24142177402973175,
-0.29940077662467957,
0.7735639810562134,
0.353037565946579,
-0.15722313523292542,
-0.324756920337677,
-0.416328489780426,
-0.2884413003921509,
-0.1913355141878128,
0.47973495721817017,
... | |
Lets say I have something like this:
```
<tr>
<td><input type="text" /></td>
<td>Somevalue</td>
<td><intput type="text /></td>
</tr>
```
I am in the event handler for a keypress in the first text box. I want to find the next td which has a text box in it if it exists using jQuery.
Something like this should work (as... | [
0.06641308218240738,
-0.31309038400650024,
0.2201801985502243,
-0.04895971715450287,
-0.027527766302227974,
-0.3176155388355255,
0.10181128978729248,
-0.33240583539009094,
0.13599078357219696,
-0.7550404071807861,
-0.13729515671730042,
0.7843338847160339,
-0.05661052092909813,
-0.119728907... | |
I'm using a NotifyIcon control in one of my child (modal) forms and it is working fine. SHowing balloon tips as expected, handling mouse events etc... It doesn't however vanish when I would expect it to. Specifically, when i exit the child form and the parent is back in control the icon still remains. It's tooltip is a... | [
-0.0653710663318634,
-0.1921461969614029,
0.818706214427948,
0.3462563455104828,
0.058726873248815536,
0.06568141281604767,
0.39348360896110535,
-0.15006500482559204,
-0.1696321815252304,
-0.6000640392303467,
0.037688836455345154,
0.3908091187477112,
-0.23260001838207245,
0.115621022880077... | |
normally? Ok normally is a bad word :-0 How can I get it to disappear when the form that created it disappears?
Could someone explain what is causing this as well, I thought .net was supposed to clean up after itself?
G
**EDIT:** If I call the Dispose method in the form closed evernt this works, but do I really have... | [
0.37533971667289734,
-0.21122923493385315,
0.3351490795612335,
0.13893400132656097,
-0.14958706498146057,
-0.1865314096212387,
0.3482643663883209,
0.026003696024417877,
-0.394135057926178,
-0.4923922121524811,
0.04853728786110878,
0.4868351221084595,
-0.2971293330192566,
0.0970883220434188... | |
do it. Under the covers something is using some unmanaged resourced, and you need to release it. Generally, anything in your app that implements IDisposable that you're using, do yourself a favor and Dispose it. | [
1.010926604270935,
0.022196874022483826,
-0.02158721722662449,
0.34660327434539795,
0.22609755396842957,
-0.5838381052017212,
0.06147162243723869,
0.07582393288612366,
-0.12276102602481842,
-0.21648314595222473,
-0.219668909907341,
0.3957843482494354,
-0.28052040934562683,
0.10596060752868... | |
a. What are the things I must consider?
b. I have several Stored Procedures being execute by the current application. If I create equivalent methods to execute these procedures, what would be the risk or the challenge.
Architecturally, one thing you must consider in transforming a web app to a web service is that loca... | [
0.42205196619033813,
0.279116690158844,
0.014420284889638424,
0.2838188707828522,
0.1837252825498581,
-0.051093585789203644,
0.0837884321808815,
-0.15971596539020538,
-0.2628891170024872,
-0.7342352271080017,
0.06757756322622299,
0.5912175178527832,
-0.398833692073822,
-0.0977211445569992,... | |
SOAP vs a REST-based protocol.
Also, think about security - the security considerations are different between a web application and a web service.
Finally, think about how others will know about your web service (or if they will at all). | [
0.3338682949542999,
-0.35827162861824036,
0.1374005377292633,
0.34271112084388733,
-0.3198687434196472,
-0.12091746181249619,
0.14140620827674866,
-0.28460434079170227,
0.06870246678590775,
-0.6813962459564209,
0.19952073693275452,
0.4533655643463135,
0.09522845596075058,
-0.08637332916259... | |
I have one aspx page that has two UserControls on it; each is primarily a ModalPopupExtender. One has validators; one does not. The one that does not has a Submit button with the CausesValidation="false" attribute on it.
When that Submit button is clicked, nothing happens. Click it again, and the postback happens as e... | [
0.09687935560941696,
0.03705580532550812,
0.49535253643989563,
0.11405075341463089,
-0.3285426199436188,
0.080062136054039,
0.46801692247390747,
-0.2722465693950653,
-0.18896789848804474,
-0.6118001937866211,
-0.029639622196555138,
0.4349990487098694,
-0.1835366040468216,
-0.05539707094430... | |
"Show Dialog" button for the non-validating dialog was not marked this way; this was causing the entire page to validate when that dialog was shown - including the *other* dialog, which did have validation and was failing it. This caused the Submit button to fail for apparently no reason.
Moral of the story: Make sure... | [
0.18607331812381744,
-0.026265433058142662,
0.357145756483078,
0.3085329234600067,
-0.339322030544281,
-0.32477086782455444,
0.7768042087554932,
-0.12302699685096741,
-0.08283333480358124,
-0.24871040880680084,
-0.20648011565208435,
0.2091044783592224,
-0.19958363473415375,
-0.012584141455... | |
I've been playing with PostSharp a bit and I ran into a nasty problem.
Following IL in Silverlight assembly:
```
.method public hidebysig specialname newslot virtual final instance void
set_AccountProfileModifiedAt(valuetype [mscorlib]System.DateTime 'value') cil managed
{
.maxstack 2
.locals (
[0] b... | [
-0.06053707003593445,
-0.08007253706455231,
0.7701773047447205,
-0.1560194045305252,
0.030407048761844635,
-0.1420750468969345,
0.35112422704696655,
-0.04445117339491844,
-0.20042406022548676,
-0.6360280513763428,
-0.17096897959709167,
0.5812904238700867,
-0.38190382719039917,
0.1438840478... | |
[mscorlib]System.DateTime::op_Inequality(valuetype
[mscorlib]System.DateTime, valuetype [mscorlib]System.DateTime)
L_000e: stloc.0
L_000f: ldarg.0
L_0010: ldarg.1
L_0011: stfld valuetype [mscorlib]System.DateTime
Accounts.AccountOwner::accountProfileModifiedAt
L_0016: br.s L_0018
L_0018: ... | [
-0.6911895275115967,
0.03493649885058403,
0.7631600499153137,
-0.2221774458885193,
0.12281563133001328,
0.19502954185009003,
0.2125144898891449,
-0.1680060774087906,
-0.5575870871543884,
-0.41030722856521606,
-0.45479580760002136,
0.41665852069854736,
-0.2254074215888977,
0.037945874035358... | |
L_002c: leave.s L_002e
L_002e: ret
}
```
triggers System.Security.VerificationException: Operation could destabilize the runtime. exception.
Reflector parses it OK. What could be wrong with it?
**Update 1**
Code is intended to work as follows:
```
public void set_AccountProfileModifiedAt(DateTime value)
{
... | [
0.2239886075258255,
-0.0347028449177742,
0.7953944206237793,
-0.19474145770072937,
0.4004455506801605,
-0.2380836009979248,
0.4367222189903259,
-0.38742324709892273,
-0.14373962581157684,
-0.45919886231422424,
-0.3619998097419739,
0.6367895007133484,
-0.24178801476955414,
0.041725013405084... | |
L_001c: stloc.1
L_001d: ldloc.1
```
and replacing L\_001e: brtrue.s L\_002b with L\_001e: br.s L\_002b does the trick but it's an unconditional return - not what I want.
**Update 5**
If I use C# compiler to mimic required behavior (I still need to do that with Postsharp)
I get following IL:
```
.method public hi... | [
-0.01575249433517456,
-0.0522751547396183,
0.759766161441803,
-0.23611977696418762,
0.06274084746837616,
-0.12930813431739807,
0.3496001362800598,
-0.040730882436037064,
-0.17092104256153107,
-0.695523202419281,
-0.2766835391521454,
0.5878283381462097,
-0.4475512206554413,
0.03217460587620... | |
L_0001: ldarg.0
L_0002: call instance valuetype [mscorlib]System.DateTime
Accounts.AccountOwner::get_AccountProfileModifiedAt()
L_0007: ldarg.1
L_0008: call bool [mscorlib]System.DateTime::op_Inequality(valuetype
[mscorlib]System.DateTime, valuetype [mscorlib]System.DateTime)
L_000d: stloc.0
... | [
-0.5859400629997253,
0.13956761360168457,
0.7608046531677246,
-0.3066880404949188,
0.11355440318584442,
0.4258039593696594,
0.19126933813095093,
-0.16823060810565948,
-0.32388216257095337,
-0.6270362138748169,
-0.44534561038017273,
0.5582603216171265,
-0.2508619427680969,
-0.07223065942525... | |
ldstr "AccountProfileModifiedAt"
L_0023: call instance void
Accounts.AccountOwner::NotifyPropertyChanged(string)
L_0028: nop
L_0029: ret
}
```
Note there are minor differences - extra br.s jump at L\_0016 and some strange jump L\_001e: brtrue.s L\_002b. In compiler version I get direct jump to ret.
Di... | [
0.03582620993256569,
0.30667299032211304,
0.4002070724964142,
-0.17125052213668823,
-0.10242509096860886,
0.07568959146738052,
0.6203579902648926,
-0.4987765848636627,
-0.07783567905426025,
-0.3497958779335022,
0.17753683030605316,
0.6342740654945374,
-0.3136289715766907,
-0.07715940475463... | |
block; this is useless but should not matter. | [
0.4357343018054962,
0.3132130801677704,
-0.004200126975774765,
0.017753001302480698,
-0.16580422222614288,
-0.051210012286901474,
0.2972232401371002,
-0.26906898617744446,
0.06427101790904999,
-0.51100754737854,
-0.26749154925346375,
0.16622266173362732,
-0.2359127700328827,
-0.13616883754... | |
Take a standard Windows application. It loads a DLL using LoadLibrary to call a function in it (we'll call this DLL\_A). That function loads another DLL (we'll call it DLL\_B). The application now unloads the DLL\_A DLL using FreeLibrary as it no longer requires it.
The question is:
**Is DLL\_B still in memory and lo... | [
-0.02898721769452095,
-0.1679660826921463,
0.2507396936416626,
-0.1631060391664505,
0.04851176589727402,
-0.1180327907204628,
-0.04618692770600319,
-0.13232415914535522,
-0.1520339995622635,
-0.43429774045944214,
-0.3557308316230774,
0.683582067489624,
-0.3966420292854309,
0.12290345877408... | |
LoadLibrary() docs:
> The system maintains a per-process
> reference count on all loaded modules.
> Calling LoadLibrary increments the
> reference count. Calling the
> FreeLibrary or
> FreeLibraryAndExitThread function
> decrements the reference count. The
> system unloads a module when its
> reference count r... | [
0.06294310837984085,
0.03379193693399429,
0.5450937747955322,
-0.11608085036277771,
-0.04953279346227646,
-0.1408637911081314,
0.29288536310195923,
-0.3150467276573181,
-0.26026657223701477,
-0.3933528959751129,
-0.4357461929321289,
0.6867368817329407,
-0.6370908617973328,
0.31114995479583... | |
Say you have a program that currently functions the way it is supposed to. The application has very poor code behind it, eats up a lot of memory, is unscalable and would take major rewriting to implement any changes in functionality.
At what point does refactoring become less logical then a total rebuild?
Joel wrote a... | [
0.5458571910858154,
0.35021746158599854,
-0.17124100029468536,
0.08175059407949448,
0.12017624825239182,
-0.17705759406089783,
0.7624529600143433,
0.26026004552841187,
-0.263460248708725,
-0.3400973081588745,
0.1011720821261406,
0.32483819127082825,
-0.10577697306871414,
0.4325534701347351... | |
undocumented errors and problems. Ie., it has a lot of domain knowledge embedded in it and it will be difficult or impossible for you to replicate it. You'll constantly be hitting against bugs-of-omission.
A book I found immensely useful is [Working Effectively With Legacy Code](https://rads.stackoverflow.com/amzn/cli... | [
0.070064015686512,
0.3082854449748993,
-0.30076301097869873,
0.05971894785761833,
0.4613543450832367,
-0.008660855703055859,
0.28858399391174316,
-0.24627672135829926,
-0.2892141044139862,
-0.3991381525993347,
-0.1542692929506302,
0.4795325994491577,
-0.1501716673374176,
-0.110231660306453... | |
Using Transact SQL is there a way to specify a default datetime on a column (in the create table statement) such that the datetime is the minimum possible value for datetime values?
```
create table atable
(
atableID int IDENTITY(1, 1) PRIMARY KEY CLUSTERED,
Modified datetime DEFAULT XXXXX??????
)
```
Perhaps I... | [
0.2019617259502411,
-0.10694407671689987,
0.5615148544311523,
-0.05146242305636406,
0.06252472847700119,
0.013616258278489113,
0.16796770691871643,
0.05272544547915459,
0.06855029612779617,
-0.3874703049659729,
0.31383875012397766,
0.3713010251522064,
-0.43477946519851685,
0.61142760515213... | |
you need to), or if you are worried about setting it correctly you could even set a trigger on the table to set your modified date on edits.
If you have your heart set on getting the minimum possible date then:
```
create table atable
(
atableID int IDENTITY(1, 1) PRIMARY KEY CLUSTERED,
Modified datetime DEFAULT... | [
0.11147107928991318,
-0.21927279233932495,
0.8313614130020142,
-0.1074511781334877,
0.36382612586021423,
-0.2950862944126129,
-0.16694211959838867,
-0.32246723771095276,
-0.29135188460350037,
-0.8555614352226257,
0.010905178263783455,
0.634045422077179,
-0.32382503151893616,
0.285519421100... | |
I just finished James Kovac's [article on Inversion of Control and Dependency Injection](http://msdn.microsoft.com/en-us/magazine/cc337885.aspx) and then used what I learned to make my own IoC/DI example below.
I'm quite satisified with this example since it:
* **satisfies the testability** **aspect** of IoC in that ... | [
0.5088204145431519,
0.20973289012908936,
-0.06529301404953003,
0.08026309311389923,
-0.0001464675588067621,
-0.27993854880332947,
0.1292864829301834,
-0.2658389210700989,
-0.16800957918167114,
-0.4640672504901886,
-0.03400921821594238,
0.19314789772033691,
-0.0737113356590271,
0.0563947036... | |
my Customer class "acting as a container" in this sense?
* if I were to port this to WPF, **where would Modules (in terms of Prism) fit into this example** (e.g. would AuthorizationService and Repository be modules?)
* if I were to port this to WPF, **where would MVVM fit in**? Do have have parts of MVVM through having... | [
0.21002694964408875,
-0.3361412286758423,
0.571010947227478,
-0.11328946053981781,
0.023635761812329292,
0.01807243935763836,
0.2981773018836975,
-0.3579738736152649,
-0.3036775588989258,
-0.365123450756073,
-0.21843528747558594,
0.5665692687034607,
-0.34659191966056824,
0.2756354808807373... | |
Main(string[] args)
{
AuthorizationService authorizationService = new AuthorizationService();
//real example
Repository repository = new Repository(authorizationService);
for (int id = 1; id <= 3; id++)
{ | [
0.21323426067829132,
-0.08071792870759964,
0.4208729863166809,
-0.12392403930425644,
0.27145057916641235,
0.029624206945300102,
0.5451124310493469,
-0.3392532765865326,
-0.15297210216522217,
-0.04170374572277069,
-0.15493816137313843,
0.437050998210907,
-0.3703324794769287,
0.5465224385261... | |
Customer customer = repository.GetCustomer(id);
customer.Display();
}
Console.WriteLine();
//mock test example
MockRepository mockRepository = new MockRepository(authorizationService);
Customer mockCustomerAdministrator = repository.GetCustome... | [
-0.09058535099029541,
0.21099738776683807,
0.4440231919288635,
-0.05943943187594414,
0.11086275428533554,
0.48411914706230164,
0.3561103045940399,
-0.32259878516197205,
0.17573827505111694,
-0.4239746928215027,
-0.17690670490264893,
0.5859090685844421,
-0.009865443222224712,
0.180586606264... | |
Customer mockCustomerSalesperson = repository.GetCustomer(2);
UnitTester.Assert("Administrators have access", mockCustomerAdministrator.GetAuthorizationMessage(), "Access Granted");
UnitTester.Assert("Salespeople do not have access", mockCustomerAdministrator.GetAuthorizationMessage(), "Access G... | [
0.060256343334913254,
0.061487846076488495,
0.6001113653182983,
-0.06256619095802307,
0.1799461841583252,
0.36195147037506104,
0.3319183588027954,
-0.19269317388534546,
0.4784008264541626,
-0.2685451805591583,
-0.3574303686618805,
0.953047513961792,
0.2558729648590088,
0.4302775263786316,
... | |
{
Console.WriteLine(value == expectedResult ? String.Format("{0}: test succeeded", title) : String.Format("{0}: TEST FAILED!", title));
}
}
public class Customer
{
public int ID { get; set; }
public string FirstName { get; set; }
public string LastName { get; se... | [
-0.13252902030944824,
-0.11276031285524368,
0.3516693711280823,
-0.0800895020365715,
0.331609308719635,
0.11106239259243011,
0.09442377090454102,
0.09135279059410095,
0.3838179111480713,
-0.3251142203807831,
-0.12879329919815063,
0.49422556161880493,
0.22762422263622284,
0.2873939573764801... | |
get; set; }
public AuthorizationService AuthorizationService { get; set; }
public string GetAuthorizationMessage()
{
return this.AuthorizationService.GetAccessMessage(this);
}
public Customer()
{
}
public void Display()
{ | [
0.20912118256092072,
-0.25114309787750244,
0.6121127009391785,
-0.21186700463294983,
0.32782742381095886,
0.042317360639572144,
0.362485408782959,
-0.08115478605031967,
-0.04603840038180351,
-0.47725537419319153,
-0.3895188570022583,
0.5746752619743347,
-0.20065708458423615,
0.238442972302... | |
Console.WriteLine("Customer: {1}, {0} ({2}): {3}", this.FirstName, this.LastName, this.AccessGroup, this.GetAuthorizationMessage());
}
}
public class AuthorizationService
{
public string GetAccessMessage(Customer customer)
{
return customer.AccessGroup == AccessGroup.Adm... | [
-0.32122790813446045,
-0.19732637703418732,
0.4622199237346649,
0.05952228978276253,
0.4486945569515228,
0.04006141796708107,
0.18910858035087585,
-0.0325150191783905,
0.023752616718411446,
-0.4184437692165375,
-0.24909722805023193,
0.5334144234657288,
-0.1436230093240738,
0.46672198176383... | |
IRepository
{
private List<Customer> _customerSet = new List<Customer>();
private AuthorizationService _authorizationService;
public Repository(AuthorizationService authorizationService)
{
_authorizationService = authorizationService;
_customerSet.Add(new Cus... | [
-0.031635113060474396,
0.000475010514492169,
0.4015396237373352,
-0.27593761682510376,
-0.08805141597986221,
0.21424102783203125,
0.5661794543266296,
-0.22139598429203033,
-0.025673871859908104,
-0.4020068049430847,
-0.277869313955307,
0.7094060182571411,
-0.23390674591064453,
0.2655832767... | |
_customerSet.Add(new Customer {AuthorizationService = _authorizationService, ID = 2, FirstName = "John", LastName = "Johnson", AccessGroup = AccessGroup.Administrator });
_customerSet.Add(new Customer {AuthorizationService = _authorizationService, ID = 3, FirstName = "Hank", LastName = "Rivers", AccessGroup... | [
0.13010859489440918,
0.08342602849006653,
0.5190094709396362,
-0.17691926658153534,
0.41274550557136536,
0.3258516490459442,
0.4180126488208771,
-0.08172021061182022,
-0.19065046310424805,
-0.41584208607673645,
-0.3954451382160187,
0.637834906578064,
-0.39128008484840393,
0.368498235940933... | |
where c.ID == id
select c).SingleOrDefault();
}
}
public class MockRepository : IRepository
{
private List<Customer> _customerSet = new List<Customer>();
private AuthorizationService _authorizationService;
public MockRepository(AuthorizationService autho... | [
0.03977954015135765,
0.03677049279212952,
0.4999907612800598,
-0.1810891032218933,
-0.05890129506587982,
0.3297326862812042,
0.3235258460044861,
-0.30142003297805786,
-0.13705141842365265,
-0.5821635127067566,
-0.14304323494434357,
0.7769827842712402,
-0.26014605164527893,
0.35456863045692... | |
_authorizationService = authorizationService;
_customerSet.Add(new Customer { AuthorizationService = _authorizationService, ID = 1, FirstName = "Test1AdministratorFirstName", LastName = "Test1AdministratorLastName", AccessGroup = AccessGroup.Administrator });
_customerSet.Add(new Customer { Auth... | [
0.18253082036972046,
-0.012271463871002197,
0.4930530786514282,
-0.01891341432929039,
0.3123911917209625,
0.02225785329937935,
0.5091012716293335,
-0.3959318995475769,
-0.06801342219114304,
-0.485501229763031,
-0.3076760172843933,
0.5285497307777405,
-0.24834544956684113,
0.395946979522705... | |
return (from c in _customerSet
where c.ID == id
select c).SingleOrDefault();
}
}
public interface IRepository
{ | [
-0.018364716321229935,
-0.3799819052219391,
0.3717872202396393,
-0.18739771842956543,
-0.04063640534877777,
0.21303361654281616,
0.20439288020133972,
-0.15649263560771942,
0.13173018395900726,
-0.7222883701324463,
-0.06170351803302765,
0.8219152688980103,
-0.46105727553367615,
0.1786529123... | |
Customer GetCustomer(int id);
}
public enum AccessGroup
{
Administrator,
Salesperson
}
}
```
AND PER REQUEST, HERE IS THE ORIGINAL CODE:
-------------------------------------------
```
using System;
using System.Collections.Generic;
namespace TestSimpleDependencyInjection1
{
cla... | [
-0.0013728722697123885,
-0.16862814128398895,
0.6709166169166565,
-0.16663488745689392,
0.20169195532798767,
0.045700836926698685,
0.32097765803337097,
-0.09788638353347778,
0.11205106228590012,
-0.31672728061676025,
-0.5549048185348511,
0.7453024387359619,
-0.2403927892446518,
0.307715207... | |
//real example
Repository repository = new Repository();
for (int id = 1; id <= 3; id++)
{
Customer customer = new Customer(id, authorizationService, repository);
customer.Display(); | [
0.33563950657844543,
0.014361811801791191,
0.40692633390426636,
-0.1313614696264267,
0.16227799654006958,
0.5309751629829407,
0.2770862281322479,
-0.020384982228279114,
-0.06090813875198364,
-0.5258281230926514,
-0.27075448632240295,
0.5723962783813477,
-0.2551758587360382,
0.2564549446105... | |
}
Console.WriteLine();
//mock test example
MockRepository mockRepository = new MockRepository();
Customer mockCustomerAdministrator = new Customer(1, authorizationService, mockRepository);
Customer mockCustomerSalesperson = new Customer(2, authorizationServic... | [
-0.07093393802642822,
0.12091432511806488,
0.545325756072998,
0.03443532809615135,
0.3151962459087372,
0.40850430727005005,
0.5157806873321533,
-0.35347214341163635,
0.1399976760149002,
-0.7368168234825134,
-0.26578474044799805,
0.7021799683570862,
0.029705526307225227,
0.11726213991641998... | |
"Access Granted");
UnitTester.Assert("Salespeople do not have access", mockCustomerAdministrator.GetAuthorizationMessage(), "Access Granted");
Console.ReadLine();
}
}
public static class UnitTester
{
public static void Assert(string title, string value, string expec... | [
0.086436927318573,
-0.2454259693622589,
0.48933953046798706,
0.10280387848615646,
0.29143351316452026,
0.13116396963596344,
0.24664607644081116,
-0.3892239034175873,
0.4758213758468628,
-0.19462703168392181,
-0.4000597298145294,
0.9168850183486938,
0.31384778022766113,
0.44147130846977234,... | |
String.Format("{0}: TEST FAILED!", title));
}
}
public class Customer
{
private AuthorizationService authorizationService;
private IRepository repository;
public int ID { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
... | [
0.0012231040745973587,
-0.1855764389038086,
0.47270113229751587,
-0.1288953423500061,
0.18780680000782013,
0.04075267165899277,
0.1932138055562973,
0.0480361133813858,
0.11261435598134995,
-0.27106955647468567,
-0.31027528643608093,
0.5185824036598206,
-0.009609655477106571,
0.250629216432... | |
set; }
public string GetAuthorizationMessage()
{
return authorizationService.GetAccessMessage(this);
}
public Customer(int id, AuthorizationService authorizationService, IRepository repository)
{
this.authorizationService = authorizationService;
... | [
0.23888538777828217,
-0.16132262349128723,
0.5597844123840332,
-0.034694794565439224,
0.3575305938720703,
-0.05668086186051369,
0.4376595914363861,
-0.30544590950012207,
0.041723739355802536,
-0.3111453354358673,
-0.45937636494636536,
0.7099106907844543,
-0.23751351237297058,
0.31087288260... | |
CustomerDB customerDB = repository.GetCustomerDB(id);
this.ID = customerDB.ID;
this.FirstName = customerDB.FirstName;
this.LastName = customerDB.LastName;
this.AccessGroup = customerDB.AccessGroup;
}
public void Display()
{
Console.Wri... | [
-0.019186565652489662,
0.0015208815457299352,
0.7546051144599915,
-0.36216220259666443,
0.32438474893569946,
0.3835533559322357,
-0.015729302540421486,
0.1486818939447403,
0.010887893848121166,
-0.595138430595398,
-0.1627470999956131,
0.43970146775245667,
-0.3451797366142273,
0.42711803317... | |
{1}, {0} ({2}): {3}", this.FirstName, this.LastName, this.AccessGroup, this.GetAuthorizationMessage());
}
}
public class AuthorizationService
{
public string GetAccessMessage(Customer customer)
{
return customer.AccessGroup == AccessGroup.Administrator ? "Access Granted"... | [
-0.3199349343776703,
-0.1516149938106537,
0.5516208410263062,
-0.03661194071173668,
0.21694166958332062,
0.1166924461722374,
0.22392137348651886,
-0.07782625406980515,
-0.09311188757419586,
-0.37671270966529846,
-0.2076409012079239,
0.7909798622131348,
-0.20334656536579132,
0.4253470897674... | |
private List<CustomerDB> _customerDBSet = new List<CustomerDB>();
public Repository()
{
_customerDBSet.Add(new CustomerDB { ID = 1, FirstName = "Jim", LastName = "Smith", AccessGroup = AccessGroup.Administrator });
_customerDBSet.Add(new CustomerDB { ID = 2, FirstName = "John", ... | [
0.0862882137298584,
0.061493173241615295,
0.2860020101070404,
-0.0997714102268219,
0.1502881646156311,
0.2340119481086731,
0.1642785668373108,
0.014541287906467915,
-0.3420133590698242,
-0.384041428565979,
-0.3699069321155548,
0.5763120055198669,
-0.4815516471862793,
0.39308297634124756,
... | |
"Rivers", AccessGroup = AccessGroup.Salesperson });
}
public CustomerDB GetCustomerDB(int id)
{
CustomerDB customerDBchosen = null;
//this should be done with LINQ (couldn't get it CustomerDB to implement IEnumerable correctly)
foreach (CustomerDB customerDB ... | [
-0.2762995958328247,
0.084632009267807,
0.5514683723449707,
0.12943214178085327,
0.18178848922252655,
0.048877280205488205,
0.5566534996032715,
-0.15776166319847107,
-0.08020929247140884,
-0.44916221499443054,
-0.10083728283643723,
0.38113465905189514,
-0.40178292989730835,
0.1939253807067... | |
if (customerDB.ID == id)
{
customerDBchosen = customerDB;
break;
} | [
-0.20723654329776764,
-0.16056811809539795,
0.15173940360546112,
-0.1150238960981369,
0.3231990337371826,
-0.3204050660133362,
0.2647438645362854,
-0.02376650460064411,
-0.08592783659696579,
-0.09966903179883957,
-0.714496374130249,
0.33855772018432617,
-0.25747907161712646,
0.179222628474... | |
}
return customerDBchosen;
}
}
public class MockRepository : IRepository
{
public CustomerDB GetCustomerDB(int id)
{
switch (id)
{ | [
-0.03308793902397156,
-0.196674183011055,
0.20428107678890228,
0.10280951857566833,
-0.005184149369597435,
0.27477794885635376,
0.24237553775310516,
0.047779835760593414,
0.0201796293258667,
-0.5942422747612,
-0.13021831214427948,
0.825631856918335,
-0.25596049427986145,
0.2302800565958023... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.