text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
case 1:
return new CustomerDB { ID = 1, FirstName = "Test1AdministratorFirstName", LastName = "Test1AdministratorLastName", AccessGroup = AccessGroup.Administrator };
case 2:
return new CustomerDB { ID = 2, FirstName = "Test2SalespersonFirstName", LastName = "Test... | [
-0.09607318788766861,
-0.24010825157165527,
0.11791789531707764,
-0.08425958454608917,
0.2514248192310333,
0.12550967931747437,
0.044931039214134216,
-0.18905596435070038,
0.14002330601215363,
-0.47410592436790466,
-0.3476446568965912,
0.7293347120285034,
-0.30311310291290283,
0.2179760634... | |
default:
return null;
}
}
}
public interface IRepository
{
CustomerDB GetCustomerDB(int id);
}
public class CustomerDB
{
public int ID { get; set; | [
-0.19922824203968048,
-0.38689160346984863,
0.44916531443595886,
-0.035227347165346146,
-0.06131407991051674,
0.24009054899215698,
0.07187297195196152,
0.092935711145401,
0.09692222625017166,
-0.6847605109214783,
-0.38508182764053345,
0.8704189658164978,
-0.47265928983688354,
-0.0524885170... | |
}
public string FirstName { get; set; }
public string LastName { get; set; }
public AccessGroup AccessGroup { get; set; }
}
public enum AccessGroup
{
Administrator,
Salesperson
}
}
```
Your code violates the single responsibility principal in a pretty serious wa... | [
0.5159890055656433,
0.05507281795144081,
0.046149443835020065,
0.14831335842609406,
-0.01733563095331192,
-0.3212962746620178,
0.05582723394036293,
-0.0609290674328804,
-0.3262062966823578,
-0.23476332426071167,
-0.3082292973995209,
0.535345733165741,
-0.3119499981403351,
0.410206049680709... | |
be loading the Customer object and handing it back to the caller.
I would expect something more like:
```
Customer customer = repository.GetCustomer(3);
``` | [
0.1601766049861908,
0.1624387502670288,
0.39482760429382324,
-0.012116748839616776,
0.14572645723819733,
-0.2646082043647766,
0.05836983025074005,
0.09443251043558121,
0.03627706691622734,
-0.34150561690330505,
-0.39823779463768005,
0.6936901211738586,
-0.3464944362640381,
0.11232292652130... | |
Definition of Callback:
=======================
A Function that is set as a property within a Component. And is usually called when some event occurs on the Component.
For Example:
============
If you wish to display a dialog which reads *"I was clicked"* when the user clicks on the Component **componentB**, you wou... | [
-0.15747354924678802,
-0.24457813799381256,
0.5757599472999573,
-0.38348469138145447,
-0.17924323678016663,
-0.2431299239397049,
0.1754925698041916,
-0.5150131583213806,
0.08305252343416214,
-0.22760307788848877,
0.03058565780520439,
0.8418473601341248,
-0.5931610465049744,
0.1809041798114... | |
was clicked"* in an alert box when the component was clicked.
In C, that would be a valid callback. However I'm not so familar with JavaScript to say if it is or not because I'm not sure how variables are treated with respect to their memory locations.
In C/C++ you could declare a void pointer:
```
void aFunction()
... | [
0.3622111678123474,
-0.1636352837085724,
0.4886478781700134,
-0.5504467487335205,
-0.13824477791786194,
-0.2716450095176697,
0.3398086130619049,
-0.1298576146364212,
-0.10754715651273727,
-0.05470900610089302,
-0.01932935230433941,
0.5530946850776672,
-0.6198040246963501,
0.117080323398113... | |
};
);
```
is valid as well.
**EDIT** added a not to the second sentence: "I'm not so familar" | [
-0.10502251982688904,
-0.0038426306564360857,
0.4691908657550812,
-0.4712072014808655,
-0.006041344255208969,
0.28730282187461853,
0.7056739330291748,
0.5351884365081787,
0.025803394615650177,
-0.26023176312446594,
-0.32844752073287964,
0.42263731360435486,
-0.0648554116487503,
-0.12805929... | |
Most of my SPs can simply be executed (and tested) with data entered manually. This works well and using simple PRINT statements allows me to "debug".
There are however cases where more than one stored procedure is involved and finding valid data to input is tedious. It's easier to just trigger things from within my w... | [
0.3408306837081909,
0.0934322327375412,
0.25633180141448975,
0.18313926458358765,
-0.1406434327363968,
-0.2319965660572052,
0.4285309910774231,
-0.1154802069067955,
-0.25706225633621216,
-0.3608793616294861,
0.1700754016637802,
0.49198803305625916,
-0.13591809570789337,
-0.2284841388463974... | |
SP:StmtStarting events, and filter the activity down to just your process by setting SPID=xxx. Once you have it set up, it's a breeze to see what's going on. | [
0.3731690049171448,
-0.43735164403915405,
0.6329823136329651,
0.19725541770458221,
-0.11765151470899582,
-0.2814953327178955,
0.10455916076898575,
0.039008527994155884,
-0.3918251395225525,
-0.7163062691688538,
0.15934623777866364,
0.2650739848613739,
-0.14597421884536743,
-0.2050585150718... | |
I’m thinking through some database design concepts and believe that creating sample data simulating real-world volume of my application will help solidify some design decisions.
Does any anyone know of a tool to create sample data? I’m looking for something that’s database and platform neutral if possible (from MySQL... | [
0.5623596906661987,
-0.007864895276725292,
0.015421546064317226,
0.43833285570144653,
-0.019843755289912224,
0.045322611927986145,
-0.13027726113796234,
-0.07287053763866425,
-0.15273848176002502,
-0.5802038311958313,
0.24312864243984222,
0.36437082290649414,
-0.2516407370567322,
0.0831725... | |
to create sample data** ([MySQL Sample Data Creator](http://mysqlsampledata.enestrom.com/) is the kind of thing I vision but I think their'd be some more options like commit frequency so to create very large data sets... millions or billions of rows... don't think this tool would scale to the volume of data I want to c... | [
0.43631410598754883,
-0.15677131712436676,
0.11445310711860657,
0.10656856745481491,
-0.2005755752325058,
0.13622725009918213,
0.33925461769104004,
0.02613537572324276,
-0.2297220677137375,
-0.6518283486366272,
0.4139881432056427,
0.5367963910102844,
-0.20974424481391907,
0.173185929656028... | |
explained it in [this answer](https://stackoverflow.com/questions/591892/tools-for-generating-mock-data/614382#614382) to a similar question. | [
0.125807985663414,
0.061688877642154694,
0.16255904734134674,
0.29013946652412415,
0.049681566655635834,
-0.07252108305692673,
0.019656524062156677,
-0.27636608481407166,
-0.2042997181415558,
-0.0011809453135356307,
-0.1081119179725647,
0.03396647796034813,
0.09421978890895844,
-0.05259317... | |
Using C# and .Net 2.0, I'm using an irregularly shaped form (TransparencyKey, FormBorderStyle = None, etc...) and want to allow "normal" bordered mode.
I change the back colour to default from Lime
I change FormBorderStyle to FixedSingle
I change the TransparencyKey to Colour.None
Unfortuanately this looks a complet... | [
0.365717351436615,
-0.25763508677482605,
0.6859865188598633,
-0.3070913255214691,
-0.16343314945697784,
0.1959010362625122,
0.05712437629699707,
-0.0003347977180965245,
-0.3111434578895569,
-0.6375828385353088,
-0.04494110867381096,
0.5392621755599976,
-0.3783968687057495,
-0.0677491202950... | |
answer: Override the WndProc and block the WM\_PAINT message while you apply the new Window properties.
OLD answer: Override the WndProc, and block the `WM_ERASEBKGND` message.
Explanation of what the code below does:
When a window's region is invalidated, Windows sends a series of messages to the control that resul... | [
0.17924562096595764,
0.02967827580869198,
0.4743734300136566,
-0.09267061948776245,
0.1348000466823578,
0.17045257985591888,
0.2942536473274231,
-0.3396242558956146,
-0.2035178393125534,
-0.6984574198722839,
-0.4068739712238312,
0.3555750548839569,
-0.31824830174446106,
0.3356230556964874,... | |
will be a delay before the widget is updated and you'll get an annoying flicker.
Looking at your code again I was clearly solving a different problem. Try this new example. It will block the painting of the form/control if the `bAllowPaint` flag is unset.
The *NEW* example:
```
private const int WM_PAINT = 0x000... | [
0.18635624647140503,
-0.24662579596042633,
0.7249126434326172,
-0.18283914029598236,
0.35675108432769775,
0.03331637755036354,
0.5947629809379578,
-0.4806470572948456,
-0.261319637298584,
-0.8490239977836609,
-0.12182542681694031,
0.545619785785675,
-0.4522819519042969,
0.11837668716907501... | |
{
base.WndProc(ref m);
}
}
```
The *OLD* example:
```
private const int WM_ERASEBKGND = 0x0014;
protected override void WndProc(ref Message m)
{
if (m.Msg != WM_ERASEBKGND) // ignore WM_ERASEBKGND
{
base.WndProc(ref m);
}
}
``` | [
0.011454831808805466,
0.25310876965522766,
0.42615118622779846,
-0.49473559856414795,
0.35090041160583496,
0.042561572045087814,
0.5569844841957092,
-0.2846512794494629,
-0.31074410676956177,
-0.4694537818431854,
-0.32326003909111023,
0.6976672410964966,
-0.3169141709804535,
0.315556347370... | |
If I write a PHP script to connect to an SMTP server (in my case, this is Postfix installed locally) and send an email, the first "received" header in the e-mail turns out as:
```
Received: from [SERVER_IP] (SERVER_HOSTNAME [127.0.0.1]) by SERVER_HOSTNAME (Postfix) with ESMTP id D682A34381 for <TO_EMAIL>; Thu, 5 Mar ... | [
-0.060338281095027924,
0.38154008984565735,
0.6149687170982361,
-0.2778899669647217,
-0.37355226278305054,
-0.08691693842411041,
0.6759755611419678,
-0.145443856716156,
-0.11428852379322052,
-0.6222343444824219,
-0.20561067759990692,
0.11483661830425262,
-0.23901619017124176,
0.34803169965... | |
AB51934381 for <TO_EMAIL>; Thu, 5 Mar 2009 17:18:01 +0000 (GMT)
```
This is because the PHP CLI is being called by a regular Linux user (through a cron).
How can I cause the PHP CLI to be bound to the hostname/IP so that when it is called by the user through the cron job, the "received" header shows the server host... | [
-0.10914790630340576,
0.33534103631973267,
0.7021149396896362,
-0.24143199622631073,
-0.0037644163239747286,
-0.02369292825460434,
0.43304264545440674,
0.02546628937125206,
-0.3674401640892029,
-0.6732020378112793,
-0.17257626354694366,
0.5441055297851562,
-0.41439059376716614,
0.055656559... | |
new Window properties.
OLD answer: Override the WndProc, and block the `WM_ERASEBKGND` message.
Explanation of what the code below does:
When a window's region is invalidated, Windows sends a series of messages to the control that result in a freshly-painted widget. An early message in this series is `WM_ERASEBKGND`... | [
0.3430767059326172,
-0.1901121288537979,
0.5202834606170654,
-0.039184633642435074,
-0.05675436183810234,
0.1890496164560318,
0.2515866756439209,
-0.13546790182590485,
-0.4165256917476654,
-0.8650810718536377,
-0.13882283866405487,
0.3228425979614258,
-0.26386451721191406,
0.42738035321235... | |
annoying flicker.
Looking at your code again I was clearly solving a different problem. Try this new example. It will block the painting of the form/control if the `bAllowPaint` flag is unset.
The *NEW* example:
```
private const int WM_PAINT = 0x000F;
protected override void WndProc(ref Message m)
{
... | [
0.2004760056734085,
-0.2195318043231964,
0.6309381127357483,
-0.21256189048290253,
0.1633255034685135,
-0.05118119716644287,
0.6228909492492676,
-0.1755935102701187,
-0.21081236004829407,
-0.841169536113739,
0.07414887845516205,
0.5215001702308655,
-0.6127164959907532,
0.19031842052936554,... | |
base.WndProc(ref m);
}
}
```
The *OLD* example:
```
private const int WM_ERASEBKGND = 0x0014;
protected override void WndProc(ref Message m)
{
if (m.Msg != WM_ERASEBKGND) // ignore WM_ERASEBKGND
{
base.WndProc(ref m);
}
}
``` | [
0.022003864869475365,
0.21265336871147156,
0.4131898581981659,
-0.5267021059989929,
0.366868793964386,
-0.0014348403783515096,
0.5222076773643494,
-0.287394255399704,
-0.2919032573699951,
-0.43152838945388794,
-0.3011593818664551,
0.6538040637969971,
-0.3635433316230774,
0.3124566078186035... | |
I have a custom control that I made. It inherits from `System.Windows.Forms.Control`, and has several new properties that I have added. Is it possible to show my properties (TextOn and TextOff for example) instead of the default "Text" property.
My control works fine, I'd just like to de-clutter the property window.
Y... | [
0.30482643842697144,
0.01671828329563141,
0.5025078654289246,
0.22144001722335815,
0.012262165546417236,
-0.021074123680591583,
0.4215090870857239,
-0.2694920003414154,
-0.11792297661304474,
-0.5252231359481812,
-0.0388040691614151,
0.5533357858657837,
-0.3136383295059204,
0.42821171879768... | |
the [`GetProperties`](http://msdn.microsoft.com/en-us/library/system.componentmodel.typeconverter.getproperties.aspx) method to control what properties get displayed for your type. This approach is more robust to the underlying base classes changing but can take more effort, depending on what you want to achieve.
I of... | [
0.18515732884407043,
-0.2645159363746643,
0.47214487195014954,
0.22792373597621918,
-0.11086366325616837,
-0.026646964251995087,
0.04374942183494568,
-0.37928399443626404,
-0.21641317009925842,
-0.6060929894447327,
-0.29456159472465515,
0.5588828325271606,
-0.2136170119047165,
0.1775584965... | |
I am testing my Zend Framework application and would like to test that something happens when a particular key is not set in the registry. This is the function that I am testing:
```
protected function getDomainFromConfig() {
$config = Zend_Registry::get('config');
if (!isset($config->domain)) {
throw ... | [
0.3525233268737793,
-0.07196871936321259,
0.2723752558231354,
-0.18850959837436676,
0.08465291559696198,
-0.5996353626251221,
0.4659044146537781,
-0.412114679813385,
0.08153562247753143,
-0.6443595290184021,
-0.16937591135501862,
0.553256630897522,
-0.22973385453224182,
0.21008160710334778... | |
did not work:
```
$config = Zend_Registry::get('config');
$config->__unset('domain');
```
**Update:** What I really want to know is how should I test that my method throws an exception when the "domain" key in the config file is not set.
The only real way to change the value of the config object would be to dump it ... | [
0.0917116031050682,
0.07620871812105179,
0.4676675796508789,
0.023094825446605682,
0.19270223379135132,
-0.2378508299589157,
0.42333120107650757,
-0.3099198341369629,
-0.1619696170091629,
-0.4162025451660156,
-0.1989157348871231,
0.714830219745636,
-0.5274378657341003,
0.08958280831575394,... | |
should consider that it is not best practice to edit the registry in this way. In particular, the Zend\_Config object is designed to be static once it is instantiated originally.
I hope I have understood your problem well enough! | [
0.22458277642726898,
0.09379836916923523,
-0.11081301420927048,
0.02621663361787796,
0.24717506766319275,
-0.4297308921813965,
0.4043576419353485,
0.24142926931381226,
-0.14462295174598694,
-0.47411611676216125,
-0.2352226972579956,
0.6692790389060974,
-0.2652342915534973,
0.24617183208465... | |
I have an XML document, and I want to change the values for one of the attributes.
First I copied everything from input to output using:
```
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
```
And now I want to change the value of the attribu... | [
0.33753085136413574,
-0.0682147890329361,
0.23872800171375275,
0.06547768414020538,
-0.02138085663318634,
0.11501036584377289,
-0.0370599702000618,
-0.5530425310134888,
-0.11642889678478241,
-0.4750300943851471,
0.002730441279709339,
0.6633063554763794,
-0.33026719093322754,
0.206965953111... | |
I have a method in an object that is called from a number of places within the object. Is there a quick and easy way to get the name of the method that called this popular method.
Pseudo Code EXAMPLE:
```
public Main()
{
PopularMethod();
}
public ButtonClick(object sender, EventArgs e)
{
PopularMethod();
}... | [
0.07938667386770248,
-0.3377503454685211,
0.5808045864105225,
0.05394325032830238,
0.16230732202529907,
-0.06339268386363983,
0.08063533157110214,
0.17838574945926666,
-0.3782366216182709,
-0.5096390247344971,
-0.13964036107063293,
0.40200451016426086,
-0.47461992502212524,
0.1905484795570... | |
`ButtonClick`
I was looking at the `System.Reflection.MethodBase.GetCurrentMethod()` but that won't get me the calling method. I've looked at the `StackTrace` class but I really didn't relish running an entire stack trace every time that method is called.
I don't think it can be done without tracing the stack. However... | [
-0.043641045689582825,
0.07587823271751404,
0.5019686818122864,
-0.18393340706825256,
0.19620858132839203,
-0.37909072637557983,
0.39695581793785095,
-0.17028562724590302,
-0.20775152742862701,
-0.6415322422981262,
0.15274426341056824,
0.5702030658721924,
-0.22266311943531036,
0.0324094668... | |
First of all, a disclaimer:
I have experience in other languages, but am still learning the subtleties of C#
On to the problem... I am looking at some code, which uses the try/catch blocks in a way that concerns me. When a parsing routine is called, rather than return an error code, the programmer used the following l... | [
0.01469317078590393,
-0.15386244654655457,
-0.01257971953600645,
-0.093563012778759,
-0.1392594575881958,
-0.20700475573539734,
0.3940649926662445,
-0.1254143863916397,
-0.2923920750617981,
-0.15361621975898743,
-0.06699877977371216,
0.6615930199623108,
-0.4844917356967926,
-0.197516545653... | |
the caller, which throws the same error ...
back up about 6 levels.
Am I right in thinking all these catch/throw blocks are causing a performance problem, or is this a reasonable implementation under C#?
Throw (rather than catch) is expensive.
Don't put a catch block in unless you are going to do something useful (i... | [
0.2044532597064972,
-0.0116806635633111,
-0.05177988484501839,
-0.0009690771112218499,
-0.12428371608257294,
-0.3058830499649048,
0.5779623985290527,
-0.36108964681625366,
-0.011578187346458435,
-0.4365106523036957,
-0.2728520333766937,
0.5964627265930176,
-0.30671998858451843,
-0.07522069... | |
state (notably stack trace) is overwritten:
```
catch (SomeException e) {
throw e;
}
```
The latter case is a pointless way to throw away information about the exception. and without anything preceding the throw in the catch block is doubly pointless. It can be worse:
```
catch (SomeException e) {
throw new Som... | [
0.06921324878931046,
0.10220380127429962,
-0.041411422193050385,
0.07013090699911118,
0.01837914250791073,
-0.22382234036922455,
0.48000743985176086,
-0.2146153599023819,
-0.16173294186592102,
-0.5028983354568481,
-0.39065757393836975,
0.038250476121902466,
-0.23097413778305054,
0.31617721... | |
I am currently looking to detect whether an URL is encoded or not. Here are some specific examples:
1. `http://www.linxology.com/browse.php?u=Oi8vZXNwbnN0YXIuY29tL21lZGlhLXBsYXllci8%3D&b=13`
2. `http://www.linxology.com/browse.php?u=Oi8vZXNwbnN0YXIuY29tL290aGVyX2ZpbGVzL2VzcG5zdGFyL25hdl9iZy1vZmYucG5n&b=13`
Can you pl... | [
-0.0037445914931595325,
0.04817768931388855,
0.3603709638118744,
0.1817350536584854,
-0.061471424996852875,
0.21300777792930603,
0.22876688838005066,
0.29556015133857727,
-0.18860815465450287,
-0.5226044654846191,
-0.27019181847572327,
0.3417719900608063,
-0.5179225206375122,
-0.0245802700... | |
regular expression that generates it, and every regexp generates a regular language. URLs can be described by regular language (except if you need a subset of those that is not), almost every escaping scheme (and base64) is a regular transducer. Therefore, in theory, it's possible.
In practice, it gets rather messy.
... | [
-0.13664047420024872,
-0.0770069882273674,
0.49523234367370605,
0.3392161726951599,
-0.07369799166917801,
-0.05437231436371803,
0.22462981939315796,
-0.12009797990322113,
0.009661572054028511,
-0.292348176240921,
-0.29237934947013855,
0.5657570958137512,
-0.5956434011459351,
-0.05769940093... | |
those base64 encoded URLs that have some property - in your case, thy all begin with "://", which is fortunate, because that translates exactly to 4 characters "Oi8v". Otherwise, it would be more complex.
This gets `[?&][^?&#=;]+=Oi8v([A-Za-z0-9+/]{4})*(|[A-Za-z0-9+/]{2}(%3D%3D|[A-Za-z0-9+/]%3D)`
As you can see, it g... | [
0.11311358958482742,
0.3683156967163086,
0.30832937359809875,
0.11199308931827545,
-0.06686913967132568,
-0.12082277983427048,
0.17539244890213013,
-0.2106810361146927,
-0.27886608242988586,
-0.608518123626709,
-0.4054074287414551,
0.14295512437820435,
-0.1275607943534851,
0.10923573374748... | |
my first time on the site so apologies if it's tagged incorrectly or been answered elsewhere...
I keep running into particular situation on my current project and I was wondering how you guys would deal with it. The pattern is: a parent with a collection of children, and the parent has one or more references to partic... | [
0.045660350471735,
-0.19671928882598877,
-0.0693294107913971,
0.2610885202884674,
0.4011123478412628,
0.32909131050109863,
-0.07384821772575378,
-0.03533799946308136,
-0.3040863275527954,
-0.7893636226654053,
-0.28972193598747253,
0.03897549957036972,
-0.15030232071876526,
0.44550821185112... | |
{ get; set; }
public string Name { get; set; }
}
```
To me this seems like a good clean way of modelling the relationship, but causes problems immediately thanks to the circular association, I can't enforce the relationship in the DB because of the circular foreign keys, and LINQ to SQL blows up due to the cyclic... | [
0.059626609086990356,
-0.01813354529440403,
0.2835835814476013,
-0.0801941454410553,
-0.12352054566144943,
-0.03156576305627823,
0.24476805329322815,
-0.26987773180007935,
-0.2699905335903168,
-0.65772545337677,
-0.022458121180534363,
0.4725848436355591,
-0.42684853076934814,
0.43073377013... | |
public MenuItem DefaultItem
{
get
{
return Items.Single(x => x.IsDefault);
}
set
{
DefaultItem.IsDefault = false;
value.DefaultItem = true; | [
0.013703041709959507,
-0.2624772787094116,
0.3537655472755432,
-0.21342980861663818,
0.1762649565935135,
0.27882158756256104,
0.5165464878082275,
-0.06064755842089653,
-0.06567555665969849,
-0.5647245049476624,
-0.65360426902771,
0.683185875415802,
-0.45127764344215393,
0.11539748311042786... | |
}
}
}
public class MenuItem
{
public SystemMenu Parent { get; set; }
public string Name { get; set; }
public bool IsDefault { get; set; }
}
```
Has anyone dealt with something similar and could offer some advice?
Cheers!
Edit: Thanks for the responses so far, perhaps the 'Menu' example wasn't brill... | [
0.3057633936405182,
0.15205566585063934,
-0.03862043842673302,
-0.16983996331691742,
-0.09243506193161011,
0.029471829533576965,
0.26964014768600464,
0.25234442949295044,
-0.19269944727420807,
-0.5312206149101257,
-0.18044009804725647,
0.6213340759277344,
-0.12256535142660141,
0.2813535630... | |
Name { get; set; }
public IList<Employee> Employees { get; private set; }
public Employee ContactPerson { get; set; }
}
public class Employee
{
public Company EmployedBy { get; set; }
public string FullName { get; set; }
}
```
The Employee would definitely need a reference to their Company, and each ... | [
0.35808712244033813,
0.08441092073917389,
0.2380373179912567,
-0.04453849047422409,
0.03387192264199257,
0.09038878977298737,
0.08904939889907837,
0.11183589696884155,
-0.2101566195487976,
-0.574898898601532,
-0.2531372308731079,
0.2554231286048889,
-0.33163589239120483,
0.2529748976230621... | |
came up with:
Introduced a third entity called `WellKnownContact` and corresponding `WellKnownContactType` enum:
```
public class Company
{
public string Name { get; set; }
public IList<Employee> Employees { get; private set; }
private IList<WellKnownEmployee> WellKnownEmployees { get; private set; }
... | [
0.06692535430192947,
-0.20678739249706268,
0.26061707735061646,
-0.11639440059661865,
0.03244251757860184,
0.2469380795955658,
0.20645201206207275,
-0.3265538513660431,
0.030242744833230972,
-0.26704466342926025,
0.002337289974093437,
0.5981470346450806,
-0.13887591660022736,
0.30563470721... | |
set
{
if (ContactPerson != null)
{
// Remove existing WellKnownContact of type ContactPerson
} | [
-0.10067174583673477,
-0.11582356691360474,
0.31924933195114136,
-0.14357765018939972,
0.2786112427711487,
-0.15709418058395386,
0.40037092566490173,
-0.204862579703331,
0.3032377064228058,
-0.41597655415534973,
-0.04784810170531273,
0.6844280362129211,
-0.36761295795440674,
0.173426195979... | |
// Add new WellKnownContact of type ContactPerson
}
}
}
public class Employee
{
public Company EmployedBy { get; set; }
public string FullName { get; set; }
}
public class WellKnownEmployee
{
public Company Company { get; set; }
public Employee Employee { get; set; }
public WellKnownEm... | [
-0.04858672246336937,
-0.0035616536624729633,
0.6429970860481262,
-0.14207522571086884,
0.26533108949661255,
-0.008130577392876148,
0.1250775009393692,
-0.22695155441761017,
-0.10846704244613647,
-0.31191161274909973,
0.03885640576481819,
0.5955926775932312,
0.028001943603157997,
0.2792908... | |
the DB which saves trying to get LINQ to SQL to do anything too clever! Also allows for multiple types of 'well known contacts' which is definitely coming in the next sprint (so not really YAGNI!).
Interestingly, once I came up with the contrived Company/Employee example it made it MUCH easier to think about, in contr... | [
0.21654313802719116,
0.07781641185283661,
0.08826469630002975,
0.24684102833271027,
-0.5231095552444458,
-0.44219064712524414,
0.34847790002822876,
0.14143547415733337,
-0.012519841082394123,
-0.4776189923286438,
0.20078474283218384,
0.5111693739891052,
-0.0975276529788971,
0.1488942801952... | |
I'm using the [MAPI code by Dave Brooks](http://www.codeproject.com/KB/IP/SendFileToNET.aspx).
I am attempting to programatically send out a Crystal Report that is generated.
When I run through the code without threading everything runs fine. The problem is when I use threading I get the return error "General MAPI fa... | [
0.23231418430805206,
0.25999438762664795,
-0.017521588131785393,
-0.24443911015987396,
-0.24034230411052704,
-0.05069280415773392,
0.6269740462303162,
-0.17981241643428802,
-0.44612330198287964,
-0.6824039816856384,
-0.0911053940653801,
0.4008857309818268,
-0.5183578729629517,
0.1601574718... | |
As New Thread(operation)
theThread.Start()
End Sub
Public Sub SendEmail()
Dim m As MAPI
m = New MAPI()
Dim email As String
For Each email In emailAddress
m.AddRecipientBCC(email)
Next email
m.AddAttachment(@"c:\temp\report.pdf")
m.SendMailPopup("Requested Report", "")
End Sub
```
A ver... | [
0.16772927343845367,
-0.060237057507038116,
0.9063701033592224,
-0.36349669098854065,
0.04345517233014107,
-0.031963929533958435,
0.4307743310928345,
-0.3136464059352875,
-0.3410675525665283,
-0.6774612665176392,
-0.46403592824935913,
0.40043264627456665,
-0.4379245340824127,
0.35938194394... | |
MTA. | [
-0.14078831672668457,
0.10671065002679825,
-0.0008753000875003636,
0.008714980445802212,
-0.12398067116737366,
-0.04749804735183716,
0.14397594332695007,
-0.1416177600622177,
-0.30954107642173767,
-0.17537538707256317,
0.04280104860663414,
0.2577059268951416,
-0.125741109251976,
-0.0071447... | |
Ideally I would have a "isActive" field in the table to indicate if a record is active, but it would involve changes in multiple stored procedures to make the field do what it is meant to do.
I came up with a dirty trick, and kind of tempted to carry it out. Since the result set is generated by a few joins, I was thi... | [
0.4287985563278198,
0.02009507082402706,
0.07210317999124527,
-0.017778774723410606,
0.1428670883178711,
-0.039903923869132996,
0.0914205014705658,
-0.30007311701774597,
-0.35919129848480225,
-0.30103006958961487,
0.23312163352966309,
0.48557066917419434,
-0.2934271991252899,
-0.0049164658... | |
way to have a "not active" state without changing all the other stored procedures is to MOVE the record to a "non active" table while the record is not active. | [
-0.03167538344860077,
-0.1674748808145523,
0.1417352259159088,
0.20119963586330414,
0.5482494235038757,
-0.08499171584844589,
0.2876424193382263,
0.13163164258003235,
-0.4839768707752228,
-0.5255038738250732,
-0.33437442779541016,
0.23064550757408142,
-0.2810235917568207,
0.338766634464263... | |
I'm trying to figure out if it is possible to instantiate and invoke a delegate by name, rather than explicitly. I think the code belows explains it fairly well....I want to accept a function name, and then instantiate the delegate based on that. In the example I use a select case, but I want to eliminate that and just... | [
-0.02942448854446411,
0.34939250349998474,
-0.06436623632907867,
0.1336115151643753,
-0.07168798893690109,
-0.25601303577423096,
0.19771812856197357,
-0.23482511937618256,
-0.18370777368545532,
-0.4628770649433136,
-0.19831101596355438,
0.4497464597225189,
-0.23894630372524261,
0.166483506... | |
myDelegate_Implementation1()
'Some code
End Sub
Private Sub myDelegate_Implementation2()
'Some code
End Sub
Public Sub InvokeMethod(ByVal methodName As String)
Dim func As myDelegate = Nothing
'??? HOW TO GET RID OF THIS SELECT CASE BLOCK?:
Select Case methodName... | [
-0.23212261497974396,
-0.1194988265633583,
0.41322749853134155,
-0.23955123126506805,
0.048665668815374374,
-0.1909169852733612,
0.36635470390319824,
-0.15951527655124664,
-0.22980791330337524,
-0.23208490014076233,
-0.2190759927034378,
0.45295122265815735,
-0.3138423562049866,
0.174788877... | |
func = AddressOf myDelegate_Implementation1
Case "myDelegate_Implementation2"
func = AddressOf myDelegate_Implementation2
End Select
func.Invoke()
End Sub
```
Thanks Keith, exactly what I was looking for.
(BFree's approach would work as well in most circumstances though... | [
-0.33291444182395935,
0.06667226552963257,
0.3428790271282196,
-0.10216786712408066,
0.04763514921069145,
-0.16700664162635803,
0.09732040762901306,
-0.15494060516357422,
-0.31153586506843567,
-0.44514700770378113,
-0.1956353634595871,
0.6080747842788696,
-0.30925846099853516,
-0.085451431... | |
Dim theDelegate As xxxDelegate = CType(System.Delegate.CreateDelegate(GetType(xxxDelegate), Me, xxxImplementerName), xxxDelegate)
theDelegate.Invoke()
End Sub
Private Sub LoadFunctions()
Dim thisClass As Type = Type.GetType(Me.GetType.BaseType.FullName.ToString)
For Each method As MethodInfo In thisClass.G... | [
0.15313328802585602,
-0.2804010212421417,
0.9226154685020447,
-0.22770415246486664,
-0.03219485282897949,
0.051289789378643036,
0.2545265257358551,
-0.43495091795921326,
-0.015536477789282799,
-0.32146981358528137,
-0.12611690163612366,
0.5521235466003418,
-0.4208739399909973,
0.5004051923... | |
delegate we expect
(MethodDelegate) Delegate.CreateDelegate(
typeof( MethodDelegate ), this, "methodName", true );
```
C#, I know, but the similar will work in VB.
Normally I'd go with @BFree's answer, but this works well when working with event driven reflection - I think this will be slightly quicker if callin... | [
0.5248621106147766,
-0.07498743385076523,
0.027107547968626022,
0.2446499913930893,
-0.2144727259874344,
-0.23548346757888794,
0.1544584035873413,
-0.3381211459636688,
-0.23728406429290771,
-0.5539020895957947,
0.01206579152494669,
0.3776909112930298,
-0.12105641514062881,
0.27373799681663... | |
I just introduced a bug into my code because I seem to have misunderstood the jsp tag lifecycle.
The tag worked like this before the bug:
I pass the tag some collection as an attribute, and it displays it as a table. The collection was passed into the JSP from the controller.
After the bug:
I removed the attribute wh... | [
0.16138796508312225,
-0.18331676721572876,
0.2161528468132019,
0.1894388198852539,
0.030383458361029625,
-0.20416179299354553,
-0.1420411318540573,
-0.1458846628665924,
-0.47939079999923706,
-0.4443262815475464,
0.056195855140686035,
0.13079804182052612,
-0.6177016496658325,
0.083102509379... | |
null on subsequent executions! It was still defined as a non-requred attribute in the TLD.
I **expected** the tag to not hold on to previous values between executions.
You answered the question yourself - it's pooled. See the [tag tutorial](http://java.sun.com/products/jsp/tutorial/TagLibraries8.html) for what to impl... | [
0.1947498768568039,
-0.18409721553325653,
0.1000017300248146,
-0.16107839345932007,
-0.16292238235473633,
0.010958289727568626,
0.4846842885017395,
-0.5289747714996338,
-0.3607425093650818,
-0.37210074067115784,
-0.21551461517810822,
0.3305557370185852,
-0.5790448784828186,
0.0270532164722... | |
I am working with SQL Server (I am a SQL Server noob) and trying to alter a table. I want to `CREATE TABLE LIKE` to safely store data while I drop keys and constraints and all the other rigamorole that SQL Server seems to require when altering on the original table but I have not been able to find a match to that comma... | [
0.35701343417167664,
0.21777278184890747,
0.3400017321109772,
0.028069887310266495,
0.05385778099298477,
-0.027865583077073097,
-0.04987011477351189,
0.11929487437009811,
-0.3670778274536133,
-0.8087142705917358,
0.2396392971277237,
0.44311296939849854,
-0.379187673330307,
0.40684702992439... | |
your new table.
Then copy your data doing any migrations you need. Then you will drop the original table and do a rename on Mytable.
Or you can get one of the many excellant tools that compare databases and generate difference scripts or VSTS DB Edition (Comes with developer) and you can do a diff script from a proje... | [
0.17706938087940216,
0.014217467978596687,
0.6054441332817078,
0.12943285703659058,
-0.2151416391134262,
-0.030362870544195175,
0.017391229048371315,
-0.1098797395825386,
-0.09972966462373734,
-0.9502158761024475,
0.05852131545543671,
0.16438010334968567,
-0.3781169056892395,
0.49005112051... | |
MyTable. This only creates the columns it doesn't copy defaults, constraints indexes or anything else. | [
0.007217710837721825,
0.19427816569805145,
0.6077988743782043,
0.1331271231174469,
-0.039261166006326675,
0.005355467088520527,
-0.18914246559143066,
0.1841430366039276,
-0.2920180559158325,
-0.8257991671562195,
0.1649671345949173,
0.06925325840711594,
-0.23561684787273407,
0.2597527503967... | |
I am writing an application that logs status updates (GPS locations) from devices to a database. The updates occur at a set interval for each device, which is currently every 3 seconds. I'm using a simple table in SQL Server 08 for storing each update.
I've noticed that running the inserts is an area of slow down in m... | [
0.22005753219127655,
0.30217304825782776,
0.6358954906463623,
-0.02624364383518696,
0.4198077321052551,
0.03547089919447899,
0.3582134544849396,
0.2745422124862671,
-0.0023659528233110905,
-0.7799960970878601,
0.0810234472155571,
0.5824083089828491,
-0.1484070122241974,
-0.147197425365448,... | |
it will help:
The status updates come in from an asynchronous Socket thread. In my current implementation, the database insert call is executed from this thread. I'm thinking I can create a queue for holding update data that the Socket thread can quickly add its update to and then go on its merry way. There would then... | [
0.3696227967739105,
0.10959013551473618,
0.508574903011322,
0.08017024397850037,
0.01031270157545805,
0.02175789140164852,
-0.028961656615138054,
0.12441360205411911,
-0.2808145582675934,
-0.5989416241645813,
0.08214852958917618,
0.8503987193107605,
-0.215534508228302,
0.07814115285873413,... | |
more efficient than writing one row of data at a random time. Is my assumption correct, or way off base? Also, on the SQL side, is there a command to tell it to write a bunch of rows at once that would improve write performance?
This is how the database is being written to:
I'm using LinqToSQL in C#, so for each inse... | [
0.02837388962507248,
0.021888215094804764,
0.4659440517425537,
0.030404556542634964,
0.16579294204711914,
-0.16905762255191803,
-0.13987644016742706,
-0.1305283010005951,
-0.11037766933441162,
-0.574552595615387,
0.17000000178813934,
0.6533201336860657,
-0.3282603919506073,
-0.207951068878... | |
this allows you to use BCP to insert chunks of data very quickly.
Also, make sure your indexes are efficient. If you have a clustered index on anything that does not increase sequentially (integer, date) then you will suffer performance slowdowns as the pages are filled up. | [
-0.10726787149906158,
-0.02482215315103531,
0.2025454193353653,
0.45213109254837036,
-0.01902577094733715,
-0.03731073439121246,
-0.13777153193950653,
-0.07224268466234207,
-0.5804929137229919,
-0.6745849847793579,
0.011882420629262924,
0.08953714370727539,
-0.1714189350605011,
0.118574202... | |
Weird problem in Django with forms :
I have a Form.class defined like this ...
```
class MeetingForm(forms.Form):
owner = forms.ModelChoiceField(
queryset=Profile.objects.all(),
widget=forms.HiddenInput() )
date = forms.DateTimeField()
name = forms.CharField(max_length=30)
etc.... | [
0.059652313590049744,
0.07745489478111267,
0.5921730995178223,
-0.028580496087670326,
0.1665879786014557,
-0.4469606578350067,
-0.004468526225537062,
0.0904281735420227,
-0.39081650972366333,
-0.3344458341598511,
0.10257645696401596,
0.3937365710735321,
-0.4512191414833069,
0.3790081143379... | |
} )
return mf
```
Which works as expected. Except, the "owner"-field of the meeting is blank. What I think I should do is pre-fill the owner field in the newMeetingForm like this :
```
def newMeetingForm(request,profile) :
mf = MeetingForm( {
'date' : date.today(),
'owner' : profile,
... | [
-0.22477209568023682,
-0.1834327131509781,
0.738247811794281,
-0.4308018088340759,
0.4143829345703125,
-0.22269536554813385,
0.1794663667678833,
-0.1329319179058075,
0.14284777641296387,
-0.6549926996231079,
-0.3695192039012909,
0.6327013373374939,
-0.1534806787967682,
0.4643598198890686,
... | |
I'm using this in the template :
```
{{ form.as_p }}
```
But with that extra 'owner' line in newMeetingForm it literally seems to come out as an empty string. I assume that somehow it's failing silently, perhaps as the ModelChoiceField tries to render the owner value that I prefilled it with. But the values look OK.... | [
0.43651244044303894,
0.24828995764255524,
0.2042207419872284,
-0.17849650979042053,
-0.009378681890666485,
-0.17198605835437775,
0.06148330122232437,
-0.03194965049624443,
-0.2504410147666931,
-0.8336625695228577,
0.22514338791370392,
0.552647590637207,
-0.046237118542194366,
0.06391328573... | |
though it won't affect rendering, is that you should be instantiating the MeetingForm with the dictionary as `initial` data. If you pass it as the first positional argument, django will assume you mean for that data to be the POST data, and that therefore the form should be validated. (Apologies if you already know thi... | [
0.07468952983617783,
-0.03499123081564903,
0.7020177245140076,
-0.11344265937805176,
-0.1926681101322174,
-0.3026212453842163,
-0.038013800978660583,
-0.20958076417446136,
0.16185344755649567,
-0.6322132349014282,
-0.0621878057718277,
0.6459245681762695,
-0.03449433296918869,
-0.1672540754... | |
p = Profile.objects.get(id=someid)
>>> mf = MeetingForm(initial={'date':date.today(), 'owner':p})
>>> print mf.as_p()
```
This will output the form and, if there are serious explosions, the errors as well.
Also, and I know this is silly but I've done stuff like this too :-) (extra set of eyes... etc...), are you sur... | [
0.5033817291259766,
-0.04469453915953636,
0.7515057325363159,
-0.11701735854148865,
0.2104199081659317,
-0.09770958125591278,
0.22846224904060364,
-0.40521225333213806,
-0.07941602915525436,
-0.7722461819648743,
-0.3463060259819031,
0.4878385365009308,
-0.24493443965911865,
-0.089462660253... | |
Lets say I have the following Django model:
```
class StandardLabel(models.Model):
id = models.AutoField(primary_key=True)
label = models.CharField(max_length=255)
abbreviation = models.CharField(max_length=255)
```
Each label has an ID number, the label text, and an abbreviation. Now, I want to have the... | [
0.05336741358041763,
0.4538940489292145,
0.20881572365760803,
-0.23221106827259064,
0.01028502732515335,
-0.27901867032051086,
0.06465517729520798,
-0.079594187438488,
-0.07055728137493134,
-0.36920037865638733,
-0.14624381065368652,
0.8842660784721375,
-0.3150654733181,
-0.080479159951210... | |
abbreviation_spanish = models.CharField(max_length=255)
```
This is obviously not ideal - adding languages requires editing the model, the correct field name depends on the language.
2: Add the language as a foreign key:
```
class StandardLabel(models.Model):
id = models.AutoField(primary_key=True)
label = ... | [
-0.25540098547935486,
0.14598478376865387,
0.39793431758880615,
-0.25910046696662903,
0.1267234832048416,
-0.229096457362175,
-0.09490663558244705,
-0.22888575494289398,
-0.023426823318004608,
-0.4405874013900757,
-0.12744729220867157,
0.7975761294364929,
-0.5140042901039124,
-0.1946872919... | |
so:
```
x = OtherObjectWithAReferenceToTheseLabels.object.get(pk=3)
thelabel = labels[x.labelIdNumber].label
```
Which doesn't work if there is a row per label, possibly with multiple languages for a single label. To solve that one, I need another field:
```
class StandardLabel(models.Model):
id = models.AutoFi... | [
-0.21333202719688416,
0.060919102281332016,
0.08259215205907822,
0.038229819387197495,
-0.02816576324403286,
0.022944428026676178,
0.1170748621225357,
-0.6578129529953003,
-0.22802753746509552,
-0.5901142358779907,
-0.15408319234848022,
0.5773230791091919,
-0.4130842089653015,
0.1205669566... | |
id = models.AutoField(primary_key=True)
text = models.ManyToManyField('LabelText')
class LabelText(models.Model):
id = models.AutoField(primary_key=True)
label = models.CharField(max_length=255)
abbreviation = models.CharField(max_length=255)
language = models.ForeignKey('languages.Language')
labe... | [
-0.32871711254119873,
0.025963030755519867,
0.3052569627761841,
-0.13472257554531097,
-0.0755060464143753,
-0.10107174515724182,
0.2512738108634949,
-0.34561291337013245,
-0.07521246373653412,
-0.6612605452537537,
-0.1503773182630539,
0.631331741809845,
-0.5648711323738098,
0.1033682823181... | |
abstract model, which I subclass to get different label sets for different fields.
I suppose that if option 3 /didn't/ hit the database, it's what I'd choose. I believe the real problem is that the filter `text__language=1` doesn't cache the `LabelText` instances, and so the DB is hit when I `text.get(language=1)`
Wh... | [
-0.13556113839149475,
0.13129065930843353,
0.21770907938480377,
-0.1650531142950058,
-0.3171710968017578,
-0.11231660842895508,
0.2760731279850006,
-0.11289045959711075,
-0.14678731560707092,
-0.7435280680656433,
0.4041786193847656,
0.605224609375,
-0.5773780941963196,
0.20082153379917145,... | |
add a new language, but that isn't hard, and how often do you expect to add languages? In the meantime, it'll give you better database performance (no added joins or indexes) and you don't have to muck up your query logic with translation stuff; keep it all in the templates where it belongs.
Even better, use a reusabl... | [
0.16763922572135925,
0.31176865100860596,
0.23182301223278046,
0.26082226634025574,
0.06789791584014893,
-0.28446412086486816,
0.17216235399246216,
0.12947212159633636,
-0.3568357825279236,
-0.4621070921421051,
-0.08793056011199951,
0.6459064483642578,
-0.5465144515037537,
-0.1445503234863... | |
(This question is related to [another one](https://stackoverflow.com/questions/607370/wpf-how-do-i-set-the-owner-window-of-a-dialog-shown-by-a-usercontrol), but different enough that I think it warrants placement here.)
Here's a (heavily snipped) `Window`:
```
<Window x:Class="Gmd.TimeTracker2.TimeTrackerMainForm"
... | [
-0.30729910731315613,
0.10617880523204803,
0.5661073327064514,
-0.05174601823091507,
0.16469472646713257,
-0.17170870304107666,
-0.0567728616297245,
-0.21568666398525238,
-0.33762210607528687,
-0.5662230849266052,
-0.2416701465845108,
0.41612035036087036,
-0.17117692530155182,
0.0532648414... | |
CanExecute="CanViewTaskPropertiesExecute" />
</Window.CommandBindings>
<DockPanel>
<!-- snip stuff -->
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!-- snip more stuff -->
<Butto... | [
0.21349768340587616,
-0.3081430196762085,
0.6262532472610474,
0.1041385754942894,
0.04772701486945152,
0.32977038621902466,
0.12684349715709686,
-0.2669261693954468,
-0.41678860783576965,
-0.7899755835533142,
0.1406301110982895,
0.41591715812683105,
-0.38006192445755005,
-0.040638964623212... | |
task" Grid.Row="1" x:Name="btnAddTask" Click="HandleNewTaskClick" />
</Grid>
</DockPanel>
</Window>
```
and here's a (heavily snipped) `UserControl`:
```
<UserControl x:Class="Gmd.TimeTracker2.TaskStopwatchControl"
xmlns:local="clr-namespace:Gmd.TimeTracker2"
xmlns:localcommands... | [
-0.27095264196395874,
-0.24965262413024902,
0.4202592968940735,
-0.17763911187648773,
0.06547998636960983,
0.15204444527626038,
0.021560905501246452,
-0.2996882200241089,
-0.5541784763336182,
-0.7005346417427063,
-0.1934366375207901,
0.5385360717773438,
-0.20964902639389038,
-0.08301959186... | |
x:Name="mnuProperties" Header="_Properties" Command="{x:Static localcommands:TaskCommands.ViewTaskProperties}"
CommandTarget="What goes here?" />
</ContextMenu>
</UserControl.ContextMenu>
<StackPanel>
<TextBlock MaxWidth="100" Text="{Binding Task.TaskName, Mode=TwoWay}" Te... | [
-0.5166953802108765,
-0.3608664870262146,
0.7252925634384155,
-0.06335582584142685,
0.20297633111476898,
-0.014636865817010403,
0.08174887299537659,
-0.38339126110076904,
-0.35201796889305115,
-0.6306588053703308,
-0.46052324771881104,
0.44661131501197815,
-0.2448204606771469,
-0.050015881... | |
added to the `Window`. Perhaps via the Button in the window. Perhaps, more problematically, from a persistent backing store when the application is started.
As can be seen from the xaml, I've decided that it makes sense for me to try to use Commands as a way to handle various operations that the user can perform with... | [
0.10894691199064255,
-0.043266311287879944,
0.4292120039463043,
0.07713387906551361,
0.18689608573913574,
-0.037440720945596695,
0.01440680306404829,
0.12052305787801743,
-0.39778900146484375,
-0.6473204493522644,
-0.18097934126853943,
0.5401765704154968,
-0.25033092498779297,
0.1258369684... | |
`UserControl`'s `ContextMenu` and the command's `CanExecute`, defined in the Window. When the application first starts and the saved Tasks are restored into TaskStopwatches on the Window, no actual UI elements are selected. If I then immediately r-click a `UserControl` in the `Window` in an attempt to execute the `View... | [
-0.11325658857822418,
-0.25328266620635986,
0.860500693321228,
-0.06952337920665741,
0.1620749831199646,
0.06938263028860092,
0.2840745151042938,
0.14886590838432312,
-0.018625574186444283,
-0.6848042607307434,
-0.36770039796829224,
0.9013274312019348,
-0.38108837604522705,
-0.088465228676... | |
to be known-- I've learned that menus will route the event through the element that last had focus to avoid always sending the event from the menu item. What I think I would like, though, is for the source of the event to be the control itself, or the Task that the control is wrapping itself around (but `Task` isn't an... | [
0.019496871158480644,
-0.29026728868484497,
0.17988084256649017,
0.10608872771263123,
-0.06087067723274231,
-0.08632414042949677,
-0.02024875208735466,
0.39170318841934204,
-0.20339158177375793,
-0.3989315927028656,
0.141817107796669,
0.47737815976142883,
-0.11021551489830017,
0.1366142183... | |
UserControl, so naturally I first tried:
```
<MenuItem x:Name="mnuProperties"
Header="_Properties"
Command="{x:Static localcommands:TaskCommands.ViewTaskProperties}"
CommandTarget="{Binding ElementName=This}" />
```
This failed as an invalid binding. I'm not sure why. Then I thought,... | [
-0.7071999907493591,
-0.02422923780977726,
0.4511594772338867,
-0.3444943428039551,
0.2690995931625366,
0.11434577405452728,
0.11709413677453995,
-0.15549132227897644,
-0.33238279819488525,
-0.8688862919807434,
0.03717159852385521,
0.7717977166175842,
-0.5356210470199585,
0.212121069431304... | |
CommandTarget="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:TaskStopwatchControl}}}" />
```
That also failed, but when I looked at my xaml again, I realized that the `ContextMenu` is in a property of the UserControl, it's not a child element. So I guessed (and at this point it was ... | [
-0.615852952003479,
-0.3367788791656494,
0.35671234130859375,
-0.08767387270927429,
0.32513970136642456,
0.29244711995124817,
0.16786755621433258,
-0.31040123105049133,
-0.302355021238327,
-0.6705799102783203,
-0.14263619482517242,
0.5925719738006592,
-0.2826242744922638,
0.134093806147575... | |
me back off and realize that I'm missing some sort of fundamental concept here, though. So what do I do?
1. Is my understanding re: the role of `CommandTarget` correct in that this provides a mechanism to modify the source of a command?
2. How do I bind from a `MenuItem` in `UserControl.ContextMenu` to the owning `Use... | [
0.3835124671459198,
0.06984169781208038,
0.23205037415027618,
-0.01587800122797489,
0.05881529301404953,
-0.23756635189056396,
0.26263493299484253,
-0.40100711584091187,
0.10344136506319046,
-0.3818398416042328,
-0.07529598474502563,
0.7291890382766724,
-0.1406773030757904,
0.1558696925640... | |
context menu, incorrect? Perhaps I need to write my own command instead of using the `RoutedUICommand`:
```
private static RoutedUICommand viewTaskPropertiesCommand = new RoutedUICommand("View a task's details.", "ViewTaskProperties", typeof(TaskCommands));
public static RoutedUICommand ViewTaskProperties
{
get { ... | [
-0.4040401577949524,
-0.17641682922840118,
0.5160480737686157,
-0.10399007797241211,
-0.02184683457016945,
0.04434990882873535,
0.18556572496891022,
-0.3373644948005676,
-0.25487372279167175,
-0.7739612460136414,
-0.020703500136733055,
0.6201564073562622,
-0.25517043471336365,
0.0089139891... | |
Command="{x:Static localcommands:TaskCommands.ViewTaskProperties}"
CommandTarget="{Binding PlacementTarget,
RelativeSource={RelativeSource FindAncestor, | [
-0.4289640486240387,
-0.5494304895401001,
0.4593207538127899,
-0.12913452088832855,
0.5640100836753845,
0.39725032448768616,
-0.12375448644161224,
-0.15607070922851562,
-0.14335216581821442,
-0.545979917049408,
-0.18118184804916382,
0.427143394947052,
-0.11508447676897049,
0.32283610105514... | |
AncestorType={x:Type ContextMenu}}}"/>
```
To avoid repeating this in every MenuItem you could use a Style.
3 & 4: I would say your desire is reasonable. Since the Execute handler is on the Window it doesn't matter right now, but if you had different regions of the application, each with their own Execute handler fo... | [
0.40173807740211487,
-0.17440350353717804,
0.3035663366317749,
-0.10837657749652863,
-0.029839787632226944,
0.24785256385803223,
0.22033460438251495,
-0.24251164495944977,
0.026421966031193733,
-0.8918547630310059,
0.1782105565071106,
0.3973521888256073,
-0.3006400763988495,
0.033087108284... | |
What is the best way to reset the scroll position to the top of page after the an asynchronous postback?
The asynchronous postback is initiated from a ASP.NET GridView CommandField column and the ASP.NET update panel Update method is called in the GridView OnRowCommand.
My current application is an ASP.NET 3.5 web s... | [
0.26332196593284607,
-0.0013175548519939184,
0.8445823788642883,
-0.12704148888587952,
-0.012313088402152061,
-0.04761726036667824,
0.215305358171463,
-0.031970199197530746,
-0.19795550405979156,
-0.9840194582939148,
-0.04467097669839859,
0.8625531196594238,
0.038537923246622086,
0.0348150... | |
page that perform an asynchronous postback that I do not want to scroll to the top of the page.
**EDIT 1:** I have developed a solution where I do not need to use the PageRequestManager. See my follow up answer for solution.
Here is the following solution I developed based on this [source](http://www.codeproject.com/K... | [
-0.11933909356594086,
-0.030171414837241173,
0.9882363080978394,
-0.13867151737213135,
-0.2671035826206207,
-0.12123401463031769,
0.25424233078956604,
-0.3971860408782959,
-0.07399942725896835,
-0.9157118797302246,
-0.40276899933815,
0.3864881694316864,
-0.3078644573688507,
0.1198677867650... | |
if(e.Row.RowType.Equals(DataControlRowType.DataRow))
{
foreach (DataControlFieldCell cell in e.Row.Cells)
{
foreach(Control control in cell.Controls)
{
LinkButton lb = control as LinkButton;
if (lb != null && lb.CommandName == "Edit") | [
-0.41346821188926697,
-0.2467784881591797,
0.4236942231655121,
-0.14531949162483215,
0.554441511631012,
0.171867236495018,
0.09921742230653763,
-0.46889105439186096,
-0.0015855164965614676,
-0.4399445950984955,
-0.39160844683647156,
0.3295380175113678,
-0.4627208113670349,
0.20978437364101... | |
lb.Attributes.Add("onclick", "SetScrollEvent();");
}
}
}
}
``` | [
0.3659311532974243,
0.05914396047592163,
0.023587174713611603,
-0.033776216208934784,
-0.023842038586735725,
-0.0632549300789833,
-0.05215895548462868,
-0.4111047685146332,
-0.08205074071884155,
-0.5145639777183533,
-0.029982037842273712,
0.7805501818656921,
-0.4131092429161072,
0.23510290... | |
I am not a designer, so I took a design template from <http://www.opendesigns.org/> and was successful in implementing the design in one page, but when I tried to put it into a masterpage, it came out funny looking, so I was curious if there were any resources/tutorials on taking design templates and putting them in ma... | [
0.817365825176239,
0.12052837014198303,
0.10053133219480515,
0.05872025340795517,
-0.17431960999965668,
0.18074452877044678,
0.10097163170576096,
0.05452029034495354,
-0.2570383846759796,
-0.804505467414856,
-0.16211895644664764,
0.17373238503932953,
-0.061249345541000366,
0.16282524168491... | |
placeholder where I need it. | [
-0.31985029578208923,
0.2897353768348694,
-0.00543422345072031,
-0.07362343370914459,
0.1686936467885971,
0.20283252000808716,
-0.6709522604942322,
-0.1742388755083084,
0.12768732011318207,
-0.5587563514709473,
0.17897580564022064,
0.3786449730396271,
0.41666629910469055,
0.308127582073211... | |
I'm sorry if this has already been asked, but I haven't been able to find an answer specific to this situation:
For our web application, we have 3 systems: dev, QA, and production. Right now, a third party is maintaining the code, but soon it will be in our hands. We will have separate build environments for each stag... | [
0.7378129363059998,
0.3371867537498474,
0.07252423465251923,
0.057482969015836716,
0.13341079652309418,
0.13120898604393005,
0.20713713765144348,
-0.07032740116119385,
0.036539264023303986,
-0.5805270075798035,
-0.13787172734737396,
0.41399937868118286,
0.26532042026519775,
0.2274555712938... | |
DEV. If everything is ok on Dev, we will check into QA, and so on.
Should we have separate repositories for each, or would this fall under 'branching', where we'd have a separate branch for dev, QA, and prod. Could you also provide the best means of implementing whatever the ideal route is?
Let me know if there are a... | [
0.7240521907806396,
-0.05841197073459625,
0.03939677029848099,
0.5841057896614075,
0.17532166838645935,
-0.22416828572750092,
0.2515733540058136,
-0.009043702855706215,
-0.11213059723377228,
-0.4447898864746094,
0.05041859671473503,
0.6875887513160706,
-0.27419161796569824,
-0.107992120087... | |
make a QA branch. We test and fix on it and then push it out and it becomes our current release branch. | [
0.5888851881027222,
-0.28226029872894287,
0.274444580078125,
0.03895748406648636,
0.32897332310676575,
-0.07285512238740921,
-0.21169497072696686,
-0.06731199473142624,
0.3006719648838043,
0.060891974717378616,
-0.06427338719367981,
-0.04835192486643791,
-0.2212289422750473,
0.248014047741... | |
Is it possible to install a RubyGem that I created in NetBeans, through NetBeans without uploading it to RubyForge?
Actually, I think he meant to have put docViewController (it's new view controller, right?). In any case, if this is what you meant, and not FlipsideViewController as Eric says, then your problem is that ... | [
0.2517003118991852,
0.11460383981466293,
-0.011982386000454426,
0.0864638164639473,
0.007276715710759163,
-0.41244637966156006,
0.5733106732368469,
0.23562496900558472,
-0.19130589067935944,
-0.6647300124168396,
-0.09599754959344864,
0.5169721841812134,
-0.3631308972835541,
0.2325298935174... | |
**Duplicate of [this question](https://stackoverflow.com/questions/42294/how-do-you-get-the-footer-to-stay-at-the-bottom-of-a-web-page).**
I've got an existing site ([jacquelinewhite.co.uk](http://www.jacquelinewhite.co.uk)), on it there is a footer. Currently this footer always sits underneath the main content. I'm t... | [
0.09783335030078888,
-0.009829266928136349,
0.8673101663589478,
-0.1994752585887909,
-0.03217272087931633,
0.2613762617111206,
0.036425262689590454,
-0.000032548345188843086,
-0.5611817240715027,
-0.59001225233078,
-0.08381607383489609,
0.0847453698515892,
0.09586416929960251,
0.1277339905... | |
is bigger then the footer covers the content.
How should I fix this?
This one's always worked well for me: [CSS Sticky Footer](http://ryanfait.com/sticky-footer/) | [
-0.19737626612186432,
-0.20548099279403687,
0.49726107716560364,
-0.06411183625459671,
0.10977618396282196,
0.17542332410812378,
0.12227189540863037,
0.6922502517700195,
-0.7062944769859314,
-0.622870683670044,
0.4924992620944977,
0.2805402874946594,
-0.16884316504001617,
0.046996526420116... | |
Is it possible for a computer to "learn" a regular expression by user-provided examples?
To clarify:
* I do **not** want to learn regular expressions.
* I want to create a program which "learns" a regular expression from examples which are interactively provided by a user, perhaps by selecting parts from a text or se... | [
0.13999515771865845,
0.04107852652668953,
-0.09447069466114044,
0.6651079058647156,
0.14180493354797363,
0.24178023636341095,
0.2781645655632019,
0.2928996980190277,
-0.22004126012325287,
-0.5834131240844727,
-0.16994284093379974,
0.4115426242351532,
0.007605213206261396,
-0.41403210163116... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.