text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
existing ORM before rolling your own.
You've probably noticed I've talked a lot about ORMs in this post. That's because, in general, hard-coding SQL strings is a *bad thing*. The correct way to use dynamic SQL is to have a tool which generates SQL on-the-fly, which is exactly what many ORMs can and already do. | [
0.45117223262786865,
-0.06866642087697983,
0.04276730492711067,
0.3199447989463806,
-0.2167806476354599,
-0.25968796014785767,
0.04852752760052681,
0.3519876003265381,
-0.3533676862716675,
-0.42234525084495544,
0.04058966785669327,
0.5665016770362854,
-0.23308515548706055,
-0.0360820144414... | |
I'd like to perform a quick check whether or not a file can be opened. It should be written in portable C, or at least to work on Win32 and POSIX systems. #ifdefs are acceptable.
I'm trying to avoid this:
```
int openable(const char*filename) {
FILE *f = fopen(filename,"r");
if (!f)
return 0; /* opena... | [
0.26542928814888,
-0.025489231571555138,
0.3836948573589325,
-0.10083863884210587,
0.07661707699298859,
-0.3785475492477417,
0.16554668545722961,
-0.1800536811351776,
-0.06588230282068253,
-0.8566963076591492,
-0.26181599497795105,
0.478743314743042,
-0.3747330904006958,
0.1501775830984115... | |
if it's actually openable.
The POSIX standard solution is `[access](http://www.opengroup.org/onlinepubs/000095399/functions/access.html)()`, which is also in the Windows runtime as `[_access()](http://msdn.microsoft.com/en-us/library/1w06ktdy%28VS.80%29.aspx)`.
I guess it is slighly better than `fopen()`+`fclose()` be... | [
-0.18526358902454376,
0.09353340417146683,
0.49080517888069153,
0.14247067272663116,
0.17471958696842194,
-0.5391771793365479,
0.2384566068649292,
0.25604283809661865,
-0.08178669959306717,
-0.6274187564849854,
-0.304751455783844,
0.4565145671367645,
0.0835033729672432,
0.21156686544418335... | |
you still need to watch for "unexpected" EOF, of course. I/O is hard. | [
0.4197862446308136,
0.0490875244140625,
0.2570439279079437,
0.07797831296920776,
0.06966361403465271,
0.020360643044114113,
0.2802736759185791,
0.11602123081684113,
-0.08689858764410019,
-0.5524210333824158,
-0.0952155590057373,
0.652045488357544,
0.22316081821918488,
-0.2618408501148224,
... | |
In my master page, I have a language dropdown menu. When the user selects a language from the dropdown, a submit sends the currently selected language to the "Translate" method in my controller. After which it should redirect to the url it was before the translation submit so it can show the exact same page, but now in... | [
-0.18387268483638763,
0.06123742461204529,
0.5911053419113159,
0.18311774730682373,
-0.16627396643161774,
0.10870055854320526,
0.44864019751548767,
0.27352383732795715,
0.12688562273979187,
-0.8652037978172302,
-0.5141341090202332,
0.366759717464447,
0.025715628638863564,
0.311277687549591... | |
better way?
**--EDIT--**
Because I want my bookmarks to include the site language too, all my exposed actions have a siteLanguage parameter too. If I could somehow efficiently show the user a bunch of regular (GET) links where the siteLanguage parameter is filled in with the relevant value, that would be even bette... | [
0.32743075489997864,
0.0014557396061718464,
0.36421021819114685,
0.09358039498329163,
-0.06489521265029907,
-0.22433438897132874,
0.3872039020061493,
-0.19675661623477936,
-0.42365333437919617,
-0.8905685544013977,
0.2132231891155243,
0.4534543454647064,
-0.35932862758636475,
0.07485364377... | |
Controller) and all my real controllers inherit from my custom class.
Then, I implement OnActionExecuting in the base class to do some common work.
Then, in your masterpage, if you have a form like this, it will submit to the current URL with a GET request and add the language as a querystring parameter:
```
<form i... | [
0.1509992629289627,
-0.5863286256790161,
0.7693437337875366,
0.4562413692474365,
0.16279789805412292,
-0.27794140577316284,
-0.2655355930328369,
-0.09763967245817184,
-0.14478377997875214,
-0.4294728636741638,
-0.2609717845916748,
0.6315510272979736,
-0.2375868558883667,
0.3502759337425232... | |
for a language parameter in the querystring in your base controller class and set the flag that tells the real controller method which language to use. In the model, you directly go to the real controller to regenerate the page and avoid a redirect.
Note, this only works universally, if you are not already using query... | [
-0.2761649191379547,
-0.2788025736808777,
0.4679821729660034,
0.08770061284303665,
-0.05472799763083458,
0.016304198652505875,
0.32718026638031006,
0.11136828362941742,
-0.20038186013698578,
-0.6577997207641602,
-0.26105034351348877,
0.4833914339542389,
-0.4448706805706024,
0.3179136514663... | |
In C#, the Changed event for a control (say, a numericupdown) gets fired whether the value was change directly by the user or if it was changed programatically as the result of some other event.
Is there a way to determine whether the event occurred as a result of user input? For example, both manually changing the va... | [
0.13962528109550476,
-0.004077615682035685,
0.04463003948330879,
-0.2137608677148819,
-0.12168620526790619,
-0.33308127522468567,
-0.003077949397265911,
-0.16104130446910858,
-0.3628469705581665,
0.02250606194138527,
-0.4110778868198395,
0.7463130950927734,
-0.5865995287895203,
-0.21821857... | |
private void numericUpDown1_ValueChanged(object sender, EventArgs e)
{
MessageBox.Show("value changed");
}
private void button1_Click_1(object sender, EventArgs e)
{
numericUpDown1.Value = 3;
}
```
There is no nice way to do it. You can find workarounds for specific cases, e.g.
* ... | [
0.044365596026182175,
-0.306927889585495,
0.32955434918403625,
-0.2491454780101776,
0.14065109193325043,
-0.11380401998758316,
0.5968499779701233,
-0.06894199550151825,
-0.3394867777824402,
-0.5691404342651367,
-0.19446851313114166,
0.7148597240447998,
-0.5075439214706421,
0.24822616577148... | |
try to organize your form in a way that it doesn't matter where the value got changed. | [
0.8072100281715393,
0.0014642158057540655,
-0.517861008644104,
0.15317468345165253,
0.016788886860013008,
0.19261643290519714,
0.13499806821346283,
0.17170119285583496,
-0.2977845370769501,
-0.6723294854164124,
0.306897908449173,
0.2843175530433655,
-0.06905028969049454,
-0.249295160174369... | |
What is the best way to get a byte array from a struct to send over TCP sockets? I'm using .Net (VB or C#).
One option is to marshal the native representation of the struct into a buffer directly, similar to how `memcpy` works in C.
You would need to add the appropriate attribute to your struct,
```
[StructLayout... | [
0.009624208323657513,
-0.06863764673471451,
0.18354785442352295,
0.01641417108476162,
-0.19139464199543,
0.1252179741859436,
0.081578828394413,
-0.43080270290374756,
-0.38221973180770874,
-0.6772364377975464,
0.11472634226083755,
0.28029775619506836,
-0.28025928139686584,
0.094240576028823... | |
/// <returns></returns>
public static byte[] Serialize(object obj)
{
Type objectType = obj.GetType();
int objectSize = Marshal.SizeOf(obj);
IntPtr buffer = Marshal.AllocHGlobal(objectSize);
Marshal.StructureToPtr(obj, buffer, false);
byte[] array = new byte[objectSize];
... | [
0.042694173753261566,
0.12838704884052277,
0.33633244037628174,
-0.09479865431785583,
0.03808070719242096,
0.04276994988322258,
0.3902597725391388,
-0.6315209865570068,
-0.5203000903129578,
-0.36486053466796875,
-0.5430124402046204,
0.21164710819721222,
-0.6009913682937622,
0.2740353345870... | |
}
```
Still, this is by far the least portable solution. Both sides will need to use the same alignment and endianness, and you will need to implement versioning yourself if you will ever need to change the struct itself.
In most cases, your serialization format shouldn't be a direct copy of your internal data struc... | [
0.15670248866081238,
0.14409281313419342,
0.28497835993766785,
0.13249102234840393,
0.12737545371055603,
-0.12240063399076462,
-0.006000426597893238,
0.14154858887195587,
0.08351247012615204,
-0.7839341163635254,
-0.10551287233829498,
0.5881146788597107,
-0.36187800765037537,
0.34163150191... | |
I know about startElement, endElement, and writeAttribute methods on ResponseWriter. My problem is that I want to for example output a h:commandLink by declaring it like `HtmlCommandLink link = new HtmlCommandLink();` .
How can I output other UIComponents like this in my own component? I might want to use some RichFac... | [
0.26363739371299744,
0.03491814061999321,
0.6057950854301453,
-0.173079252243042,
-0.5295296311378479,
-0.10320906341075897,
0.2709333598613739,
-0.10237261652946472,
-0.21369975805282593,
-0.8266014456748962,
-0.0004688322660513222,
0.41811639070510864,
-0.4929509460926056,
0.143962919712... | |
the comment. Once that is rendered, I would like to output for example the richfaces `<a4j:commandButton>` component. This have to be done inside my own java tag file which Ive called for `CommentsTreeUI.java`.
Normally I output all my elements that display the forms and buttons with `writer.startElement("input", myC... | [
-0.08242128789424896,
0.054993849247694016,
0.5824947357177734,
-0.21997664868831635,
-0.25623857975006104,
0.19572001695632935,
0.11225016415119171,
-0.22545865178108215,
0.036058686673641205,
-0.7971750497817993,
-0.10240703821182251,
0.6769785284996033,
-0.35102736949920654,
-0.27057078... | |
Say I have a type that implements a property with a string type:
```
public class Record
{
public string Value { get; set; }
}
```
Then I have an interface that defines a property with the same name:
```
public interface IIntValued
{
public int Value { get; set; }
}
```
I can use explicit interface as f... | [
-0.0015274847391992807,
0.19395366311073303,
0.25142160058021545,
0.05566062405705452,
0.03432884067296982,
-0.22614061832427979,
0.026139819994568825,
-0.28266650438308716,
0.0570928230881691,
-0.809979259967804,
-0.005009828135371208,
0.7260444760322571,
-0.24890011548995972,
0.460695624... | |
}
}
```
However, if I want to be able to reference the string "Value" in my explicit interface, can I do it? If so, how? I imagine it to be something like:
```
public class Record : IIntValued
{
public string Value { get; set; }
public int IIntValued.Value
{
get
{
s... | [
0.26293957233428955,
-0.051337651908397675,
0.3619339168071747,
0.006776126567274332,
0.2326786071062088,
-0.17956602573394775,
0.3912348449230194,
-0.3365758955478668,
-0.0679507702589035,
-0.6295654773712158,
-0.10546597838401794,
0.8175985217094421,
-0.18335945904254913,
0.0946233719587... | |
return int.parse(value);
}
set{}
}
}
```
As you can see, I want the "string valued" "Value" property for an expression in the "int valued" "Value" property. If it were another explicitly implemented interface member, I could typecast to that Interface and then use, but how would it work for... | [
0.10918023437261581,
0.12790590524673462,
-0.05467812716960907,
-0.1703673005104065,
-0.11315533518791199,
-0.19938690960407257,
0.3752322793006897,
0.015247969888150692,
0.08439951390028,
-0.44218459725379944,
0.011197833344340324,
0.6604641675949097,
-0.5582574605941772,
-0.1003525555133... | |
an implicit type member, just `Value` or `this.Value` should be fine - because it won't resolve to `IIntValued.Value` by default. | [
-0.2574995756149292,
-0.18867841362953186,
0.17528082430362701,
-0.08946618437767029,
-0.04739902913570404,
-0.23221084475517273,
0.4094790816307068,
-0.013822421431541443,
0.23638686537742615,
-0.3591867983341217,
-0.012951677665114403,
0.455557644367218,
-0.4198618531227112,
0.2084682881... | |
In TFS, what is the best way to mark dead branches? Do you move your branch? Branch release it? Delete it? Rename it? What problems have you run into for each of these approaches? What are the good points?
It would be nice if there were a simple interface solution that would simply mark or filter the current view if a... | [
0.2712402641773224,
-0.5692428946495056,
0.44895216822624207,
0.20964880287647247,
-0.038232628256082535,
-0.14249730110168457,
0.03334350511431694,
0.032950129359960556,
-0.4765021502971649,
-0.6062402129173279,
-0.10624846816062927,
0.3042679727077484,
-0.32966890931129456,
0.12070421874... | |
deleted items in SCE (Tools -> Options -> Source Control -> Visual Studio Team Foundation Server -> Show deleted items in the Source Control Explorer).
And you can choose to undelete the branches if necessary. | [
0.03903968259692192,
-0.393619567155838,
0.0775982216000557,
0.33403515815734863,
0.22743359208106995,
-0.085392065346241,
0.21431858837604523,
0.23913972079753876,
-0.5151477456092834,
-0.43794143199920654,
-0.6613955497741699,
0.2357260286808014,
-0.1778935194015503,
0.013033567927777767... | |
I'm trying to do a simple resize and reposition of a div element that shows a ajax loading image. The content it loads can change size, so I want the div element to resize to be the size of the parent, which in this case is a table dimension with the id "thEngineCategories".
```
function resize_divProgress() {
var... | [
0.004355557728558779,
-0.20524263381958008,
0.2587359547615051,
-0.030113020911812782,
-0.046427905559539795,
0.21147505939006805,
-0.06101395562291145,
-0.40072351694107056,
-0.10228551179170609,
-0.4813516139984131,
-0.21362484991550446,
0.4918038845062256,
-0.3124289810657501,
-0.203948... | |
'px';
}
```
The following is the javascript I have and it errors on
```
div.style.left = control.offsetLeft + 'px';
```
saying "div.style is undefined". Whats wrong here?
The div in html is as follows:
```
<div class="overlay" id="divProgress">
```
The js function is called as follows:
```
<th id="thEngineCa... | [
-0.15980631113052368,
0.07898299396038055,
0.721198558807373,
-0.22342327237129211,
-0.18931853771209717,
0.2534785270690918,
0.16003268957138062,
-0.40728890895843506,
-0.0630749836564064,
-0.6394717693328857,
-0.3700965344905853,
0.4415518343448639,
-0.3745170533657074,
-0.10435439646244... | |
font-weight: bold;
text-align: center;
}
```
Is there a better way to handle what I'm trying to do?
I [created a basic test page](http://pastebin.com/f35593ddb) from the code you provided and couldn't reproduce the problem. This suggests there is something else going on in your page that is causing the behaviour ... | [
0.34658318758010864,
0.32871952652931213,
0.09346063435077667,
-0.13129155337810516,
-0.21511827409267426,
0.19354109466075897,
0.28504088521003723,
-0.4413160979747772,
-0.010609219782054424,
-0.6664782166481018,
0.2101864069700241,
0.49042314291000366,
-0.40417999029159546,
-0.0308706630... | |
code is the source of the problem :) | [
0.0417778342962265,
0.42713549733161926,
0.06368621438741684,
0.27183371782302856,
-0.007172742858529091,
0.21223317086696625,
0.34874334931373596,
-0.17416299879550934,
0.03147367760539055,
-0.5024346709251404,
-0.26573657989501953,
0.5138670802116394,
-0.4660693407058716,
-0.021098252385... | |
I just installed a trial version of [ReSharper](http://www.jetbrains.com/resharper/index.html) and one of the first things I noticed is that it always suggests to replace explicitly typed local variables with implicitly typed ones, e.g:
```
public string SomeMethod(int aParam)
{
int aNumber = SomeOtherMethod(aPara... | [
0.12430831789970398,
-0.17783336341381073,
0.15252624452114105,
0.08001235872507095,
-0.23723798990249634,
0.0745839774608612,
0.19880472123622894,
-0.07578515261411667,
-0.2274722307920456,
-0.35026878118515015,
0.07052873820066452,
0.7634032368659973,
-0.36050453782081604,
0.036022279411... | |
just reading the declaration, for example:
```
var someVariable = new List<int>();
```
In the example above, its evident that “var” refers to “List<int>”.
I don’t like to use “var” when I have to go to some method definition to find out what variable type “var” represents or by having to rely on visual studio intel... | [
0.3140498995780945,
-0.04676959291100502,
0.1526869833469391,
-0.07833350449800491,
-0.1953151822090149,
-0.16104209423065186,
0.30271631479263306,
0.07907811552286148,
-0.0749085545539856,
-0.2374478280544281,
-0.13971319794654846,
0.8816662430763245,
-0.2508395314216614,
0.13973672688007... | |
situations. | [
-0.15143649280071259,
0.03987938165664673,
-0.09485893696546555,
0.14401480555534363,
0.27824926376342773,
0.018107229843735695,
0.18119288980960846,
-0.0690745860338211,
-0.22775399684906006,
-0.8579950928688049,
-0.4723145067691803,
0.35451605916023254,
-0.26458874344825745,
-0.148739308... | |
I've started fiddling with C to improve my programming skills, and decided to try and implement a Tetris game. Nothing too fancy, it'll run on the console.
I never implemented a game that keeps running despite user input, and didn't figure out I'd have to deal with this problem until I started thinking about the game... | [
0.4554102420806885,
0.03720071539282799,
0.06436921656131744,
0.20729008316993713,
0.2804999351501465,
-0.15804234147071838,
0.13279151916503906,
0.19223333895206451,
-0.016394272446632385,
-0.6139435768127441,
0.07657712697982788,
0.7642414569854736,
-0.2405790239572525,
0.263018250465393... | |
a sort of toolkit for writing console applications, and supports such input. It should also help you with your game's output, by providing ways to print characters at coordinates, and so on. | [
0.07466316968202591,
-0.14378030598163605,
0.2616237699985504,
0.4769648611545563,
0.11248020082712173,
-0.11434880644083023,
-0.39680197834968567,
-0.0066916788928210735,
0.17241953313350677,
-0.6120180487632751,
-0.1685686558485031,
0.19809487462043762,
0.2351858913898468,
-0.21897417306... | |
I have a UserControl that contains an UpdatePanel which wraps some other controls. The UserControl will be used on some pages that already have a ScriptManager and other pages that do not have a ScriptManager. I'd like the UserControl to automatically bring its own ScriptManager if one does not exist.
I have tried Scr... | [
0.15285955369472504,
-0.060373201966285706,
0.39653268456459045,
0.20855441689491272,
0.059266235679388046,
-0.22610054910182953,
0.3908268213272095,
-0.10228175669908524,
0.07022775709629059,
-0.8144128918647766,
-0.018877817317843437,
0.4830397665500641,
-0.3475289046764374,
0.0841844305... | |
page. The ScriptManager must appear before any controls that need it." every time i try loading the page. The places i've tried running my code are OnInit, CreateChildControls and PageLoad and they never get called because it dies before reaching them.
Where should I put this check?
I hate to come at this in another d... | [
0.5228486061096191,
0.16590869426727295,
0.5725422501564026,
0.16878558695316315,
0.0021240958012640476,
-0.2107677310705185,
0.38100361824035645,
-0.07478857040405273,
-0.3555450141429901,
-1.0250152349472046,
0.11735086888074875,
0.27204659581184387,
-0.2034061998128891,
0.30827528238296... | |
I've never used source control before (always used renaming files and other methods), so I was looking around for a relatively simple solution, to start me off with. I was looking for
* something simple
* with a GUI interface (along with a command line one)
* relatively used
* has books on the subject (most important)... | [
0.2061339020729065,
0.04745886102318764,
0.2602331042289734,
0.18216873705387115,
-0.007713408209383488,
0.19115008413791656,
0.016513677313923836,
0.47620683908462524,
-0.4085099995136261,
-0.4628778398036957,
-0.015052293427288532,
0.6854351162910461,
0.06745016574859619,
0.2185732722282... | |
I'm making this a community wiki, so it doesn't get closed in the first minute, and then I'll just probably delete it, so it doesn't create redundancy.
---
Related: [Source control system for single developer](https://stackoverflow.com/questions/45400/source-control-system-for-single-developer)
For your criteria, I d... | [
0.2814844846725464,
-0.11890296638011932,
0.22197255492210388,
0.19591957330703735,
-0.03431747481226921,
-0.06881731748580933,
0.35840097069740295,
0.349092572927475,
-0.29411575198173523,
-0.6081737279891968,
-0.015815872699022293,
0.6916537284851074,
-0.08146485686302185,
-0.00617806706... | |
for a distributed version control system, but if you want something simple it's probably better to start with a non-distributed system.
* **with a GUI interface (along with a command line one)**: Subversion has [TortoiseSVN](http://tortoisesvn.tigris.org/), [RapidSVN](http://rapidsvn.tigris.org/) which is more of a tra... | [
-0.15657493472099304,
-0.29277247190475464,
0.6248952150344849,
0.1441260278224945,
-0.22979982197284698,
0.012713790871202946,
0.13701201975345612,
0.18787837028503418,
-0.6323758363723755,
-0.554338812828064,
-0.28451675176620483,
0.5110979080200195,
-0.061439286917448044,
0.160787999629... | |
becoming more popular, especially in open source, but still trails Subversion. You probably can't go wrong with Subversion, git or Mercurial, as they have good followings.
* **has books on the subject (most important)**: There are online books for [Subversion](http://svnbook.red-bean.com/) and [Mercurial](http://www.se... | [
0.38880959153175354,
-0.25388699769973755,
0.4301473796367645,
0.13741545379161835,
-0.33193865418434143,
-0.328083336353302,
0.3363608121871948,
0.4937622547149658,
-0.6736049056053162,
-0.6038520336151123,
-0.0626552551984787,
0.2980339527130127,
0.21702367067337036,
0.0442214198410511,
... | |
I was wondering if anyone could explain to me how I could properly bind a group of radio buttons to a boolean variable in the model using JFace data binding.
Let me explain the situation first: I've created a class that represents a group of SWT buttons (with the style set to 'SWT.RADIO') that consists of three elemen... | [
0.05123365670442581,
-0.05687832832336426,
0.3517565429210663,
-0.05018533393740654,
-0.15350690484046936,
0.09288948029279709,
-0.07380779832601547,
-0.615384042263031,
-0.12312044948339462,
-0.3226476311683655,
0.07072995603084564,
0.5802628993988037,
-0.31907930970191956,
0.113117597997... | |
radio button the boolean is set to true, and when he/she selects the "no" button the boolean is set to false.
Here's the code of my class:
```
private class YesOrNoRadioButtonGroup {
private static final String YES = "yes";
private static final String NO = "no";
private Button m_yesButton;
private Button m_noButton;... | [
-0.08054827153682709,
-0.05666624754667282,
0.7571964263916016,
-0.15974459052085876,
0.22920545935630798,
0.11728294938802719,
0.19168581068515778,
-0.3312624394893646,
0.12871240079402924,
-0.1984652429819107,
-0.28081458806991577,
1.1788530349731445,
-0.2642376720905304,
0.2753085196018... | |
final IObservableValue p_modelProperty
final DataBindingContext p_dbContext)
{
Composite radioButtonGroupContainer = new Composite(p_parent, SWT.NONE);
radioButtonGroupContainer.setLayout(new GridLayout());
Label question = new Label(radioButtonGroupContainer, SWT.NONE);
questio... | [
-0.44602108001708984,
-0.24783489108085632,
0.8194577097892761,
-0.39765259623527527,
-0.1508304923772812,
0.33501219749450684,
0.48945167660713196,
-0.6346858739852905,
-0.19735579192638397,
-0.5508466362953186,
-0.4006570875644684,
0.5774333477020264,
-0.09850575029850006,
0.295107543468... | |
Button button = (Button) p_event.widget;
if (m_yesButton.equals(button)) {
m_yesButton.setSelection(true);
m_noButton.setSelection(false);
}
else {
m_yesButton.setSelection(false);
m_noButton.setSelection(true);
}
}
};
m_yesButton.addListener(SWT.Selecti... | [
-0.3532180190086365,
-0.3945595920085907,
0.7120829820632935,
-0.2201772928237915,
0.045833274722099304,
0.41186732053756714,
0.5204841494560242,
-0.33758994936943054,
-0.34261801838874817,
-0.6944130063056946,
-0.4880487322807312,
0.44469690322875977,
-0.4528546631336212,
0.19493961334228... | |
return m_yesButton;
}
public Button getNoButton() {
return m_noButton;
}
}
```
Now, as you can see, I'm binding my "yes" button to the boolean. Specifically, the value will be bound on the SWT.selection event. This is, it seems, the only valid event for the binding of a radio button. However, because of this,... | [
0.1184733435511589,
-0.10010354965925217,
0.7754331231117249,
-0.20424361526966095,
0.21598707139492035,
-0.398780882358551,
0.32416537404060364,
-0.2973906397819519,
-0.051146600395441055,
-0.40571996569633484,
-0.26391512155532837,
0.9044283628463745,
-0.3759029507637024,
0.5614022612571... | |
the boolean in the model based on which of the buttons the user selects?
Am I missing something obvious here?
Thanks!
It seems similar to [binding a POJO to a property](http://dev.eclipse.org/newslists/news.eclipse.platform.swt/msg44044.html).
That means you should have one object with your two buttons implementing an... | [
-0.023091884329915047,
-0.07874463498592377,
0.5454931855201721,
0.05841021612286568,
-0.3092247545719147,
0.1008867621421814,
-0.048651546239852905,
-0.26985421776771545,
-0.4013257622718811,
-0.4821425974369049,
0.1332058608531952,
0.5712094902992249,
-0.5109251737594604,
-0.094761788845... | |
I have an existing javascript/flash -interaction kludge that sucks terribly. Now I've decided it'd be better to write a flash app that does the specific thing without the need to interact with javascript.
Therefore I'd need to produce flash apps in linux, and I don't have money to throw at adobe right now (perhaps nev... | [
0.34409716725349426,
0.34555622935295105,
0.0680738165974617,
0.24816225469112396,
-0.019201410934329033,
0.030138326808810234,
0.07808209210634232,
0.274864137172699,
-0.20731481909751892,
-0.8078274726867676,
0.10813042521476746,
0.8731825351715088,
-0.05600327253341675,
-0.0630152598023... | |
developer tools. They produce SWF files. | [
0.6609026789665222,
0.12918120622634888,
-0.01669865846633911,
0.09744741767644882,
-0.07186271250247955,
-0.11691442131996155,
-0.06752660125494003,
-0.13163532316684723,
-0.08627982437610626,
-0.8248925805091858,
-0.3483664393424988,
0.49149924516677856,
0.08427505195140839,
-0.015704810... | |
I want to change my website's header only it if's not the homepage. Is there a *tal:condition* expression for that?
I've been reading [this](http://plone.org/documentation/tutorial/zpt) and can't find what I'm looking for...
thanks!
The best way is to use two really handy plone views that are intended just for this p... | [
0.36529794335365295,
0.10409409552812576,
0.5622146129608154,
-0.007327663712203503,
-0.051100458949804306,
-0.3042476773262024,
0.14169414341449738,
0.2267274409532547,
-0.386640340089798,
-0.8384803533554077,
0.06439726054668427,
0.43198078870773315,
0.010530714876949787,
0.0699167549610... | |
handle all sorts of weird edge cases. context/@@plone\_context\_state/canonical\_object\_url also returns the right, most basic, object's url even when you're viewing the default page in the portal root with a query string appended :-) | [
0.013620295561850071,
-0.033184267580509186,
0.5190328359603882,
0.5240546464920044,
-0.23373806476593018,
-0.2556852698326111,
0.3680034875869751,
0.2366008460521698,
0.031145263463258743,
-0.5795674920082092,
-0.0201705489307642,
0.20023037493228912,
-0.1761864721775055,
0.33438038825988... | |
How can you convert a pdf file which contains text to a file which I can search?
I remember having used [Apache Lucene](http://lucene.apache.org/java/docs/) some time ago to perform searches inside different type of documents from Java, among them PDF and Word files.
However, this question entirely depends on the prog... | [
0.2613706886768341,
-0.03590945154428482,
0.07394318282604218,
0.048800282180309296,
-0.04680649936199188,
-0.1160699799656868,
-0.04997854307293892,
-0.1500527560710907,
0.0012216486502438784,
-0.8013246655464172,
-0.12730516493320465,
0.4325025975704193,
0.158079132437706,
0.082550711929... | |
Why does Visual Studio 2008 automatically insert the following *using directives* into each new C# file I create?
```
using System;
using System.Collections.Generic;
using System.Text;
```
What's so special about these namespaces? Are these the most frequently used ones?
Yes, they're frequently used, that's all, s... | [
0.14271512627601624,
0.16088099777698517,
0.13837338984012604,
-0.0473271869122982,
-0.42740598320961,
-0.23423565924167633,
0.10862550884485245,
-0.10255391150712967,
-0.3002261519432068,
-0.3579710125923157,
-0.044467128813266754,
0.44632914662361145,
0.036058008670806885,
0.047420877963... | |
a Solution Explorer context menu item to do it for a whole project instead of just one file :) | [
-0.5555980801582336,
-0.4203014373779297,
0.19602930545806885,
0.2991907298564911,
0.16110947728157043,
0.05360621213912964,
0.30735093355178833,
-0.24886669218540192,
0.11801819503307343,
-0.906534731388092,
-0.5337002277374268,
0.37164655327796936,
-0.37060943245887756,
-0.08849381655454... | |
I'm trying to Mock the IUnityContainer using Moq 3.0
I'm getting a BadImageFormatException, but not when debugging. From the looks of it I'm not the only one that's ran into this problem.
[here](http://www.nabble.com/BadImageFormatException,-but-not-when-debugging-td18742529.html)
And its a registered issue for Moq
... | [
0.07983168959617615,
0.43213531374931335,
0.05838603898882866,
0.015053722076117992,
-0.3297145664691925,
0.15951699018478394,
0.5624004006385803,
0.0555361770093441,
-0.24914021790027618,
-0.6218761801719666,
0.33297327160835266,
0.5442304015159607,
-0.5129532217979431,
-0.047443587332963... | |
want to compose the entire object graph at the application's entry point, or [Composition Root](http://blog.ploeh.dk/2011/07/28/CompositionRoot/).
If you need to create instances on the fly, use [Automatic Factories](https://www.devtrends.co.uk/blog/using-unitys-automatic-factories-to-lazy-load-expensive-dependencies)... | [
0.1438179761171341,
0.2360890954732895,
-0.07685253024101257,
-0.028049275279045105,
-0.013484349474310875,
0.23291246592998505,
0.4673689305782318,
-0.2055436670780182,
-0.30518147349357605,
-0.5959765315055847,
0.04603709653019905,
0.2296147495508194,
-0.46699193120002747,
-0.17919999361... | |
Is it possible to have the same assemblies behave differently in different BizTalk 2006 applications?
For example, is it possible within an assembly to somehow have access to the BizTalk application Id or Name that is using that instance and then make it have different behaviours for different BizTalk applications?
O... | [
0.07698734849691391,
0.1867465376853943,
-0.16610625386238098,
0.12421385198831558,
-0.3210257589817047,
0.17491085827350616,
0.29626163840293884,
-0.42940542101860046,
-0.3560555577278137,
-0.21369045972824097,
0.3501444458961487,
0.4120190143585205,
-0.6257590651512146,
0.188087314367294... | |
instance. So it could interact with other pieces of software also replicated in the same machine and also external systems representing themselves the same environments and also different databases.
The problem was I had to use different conection strings to define different DBs, each one for each of the environments ... | [
0.17470207810401917,
0.23187969624996185,
0.06647437810897827,
-0.09723139554262161,
-0.23462535440921783,
0.07871289551258087,
0.38813820481300354,
-0.060534507036209106,
-0.2616302967071533,
-0.5298758149147034,
0.1876661628484726,
0.31092309951782227,
-0.7886778116226196,
0.394153654575... | |
compile and deploy multiple versions and change the name of the connection string to use and also the versions of the assemblies (using compilation symbols).
Thanks for your help. | [
0.5535489320755005,
0.10646982491016388,
-0.21470044553279877,
0.3868912160396576,
-0.08184902369976044,
-0.2698367238044739,
0.2984634041786194,
0.37882426381111145,
-0.288247287273407,
-0.821523129940033,
-0.07652793079614639,
0.4526599943637848,
-0.12829436361789703,
-0.0625047460198402... | |
```
cp -v -ur path/to/jsps/ /dest/path/
```
The above command copies all of the files that have been updated from the source directory to the destination, preserving the directory structure.
What I can't figure out is how to copy only \*.someExtention files. I know that you can use something like:
```
find -f -name... | [
0.3149811625480652,
0.41551509499549866,
0.5977112650871277,
0.1993430107831955,
0.1945592164993286,
-0.2682698369026184,
0.08423438668251038,
0.23240631818771362,
-0.2668606638908386,
-0.8778625130653381,
-0.14490924775600433,
0.797397255897522,
-0.18321822583675385,
0.20885594189167023,
... | |
rsync is probably the better tool. | [
-0.08838397264480591,
-0.18509912490844727,
0.5096455216407776,
0.12135964632034302,
-0.14715801179409027,
-0.4316781461238861,
-0.32774633169174194,
0.016098355874419212,
-0.30794036388397217,
-0.5301068425178528,
-0.11315319687128067,
0.5324282050132751,
-0.015696316957473755,
-0.1774016... | |
```
const int MIN_NUMBER = 4;
class Temp
{
public:
Temp(int x) : X(x)
{
}
bool getX() const
{
try
{
if( X < MIN_NUMBER)
{
//By mistake throwing any specific exception was missed out | [
0.24447429180145264,
0.005661806557327509,
-0.10751038044691086,
-0.056912291795015335,
0.03851066529750824,
-0.025660961866378784,
0.570085346698761,
-0.16525614261627197,
-0.12185852974653244,
-0.2502501904964447,
-0.5091333985328674,
0.4686132073402405,
-0.5431793928146362,
0.1968621611... | |
//Program terminated here
throw ;
}
}
catch (bool bTemp)
{
cout<<"catch(bool) exception";
}
catch(...) | [
0.12960076332092285,
-0.08065343648195267,
-0.11699731647968292,
-0.4330155849456787,
0.02844279073178768,
-0.07604855298995972,
0.41792285442352295,
-0.11474109441041946,
-0.16766811907291412,
-0.12408565729856491,
-0.4340072572231293,
0.2711852490901947,
-0.40970051288604736,
0.244893684... | |
{
cout<<"catch... exception";
}
return X;
}
private:
int X;
};
int main(int argc, char* argv[])
{
Temp *pTemp = NULL;
try
{
pTemp = new Temp(3);
int nX = pTemp->getX();
delete pTemp; | [
0.11905737221240997,
-0.27560511231422424,
0.36534708738327026,
-0.4064011573791504,
0.25932252407073975,
0.32828280329704285,
0.5631105303764343,
-0.29467934370040894,
-0.19109222292900085,
-0.24458788335323334,
-0.4420672059059143,
0.3517703413963318,
-0.559665858745575,
0.28465172648429... | |
}
catch(...)
{
cout<<"cought exception";
}
cout<<"success";
return 0;
}
```
In above code, **throw false** was intended in getX() method but due to a human error(!) **false** was missed out. The innocent looking code crashed the application.
My question is why does program gets terminat... | [
0.31350550055503845,
-0.04601370170712471,
0.14159207046031952,
-0.2927188575267792,
0.034137748181819916,
-0.23618459701538086,
0.5117148756980896,
-0.09974075853824615,
-0.4078091084957123,
-0.27282899618148804,
-0.2899725139141083,
0.4809045195579529,
-0.3899865746498108,
0.300266027450... | |
does compiler not raise flags during compilation?
This is expected behaviour. From the C++ standard:
> If no exception is presently being
> handled, executing a throw-expression
> with no operand calls
> terminate()(15.5.1).
As to why the compiler can't diagnose this, it would take some pretty sophisticated flow a... | [
0.29818427562713623,
0.2646655738353729,
-0.35261213779449463,
-0.13099321722984314,
-0.2801731824874878,
-0.45019957423210144,
0.6357778906822205,
-0.07148454338312149,
-0.2853502631187439,
-0.10706774890422821,
-0.30421555042266846,
0.30853766202926636,
-0.3873971998691559,
-0.0942706987... | |
I can run this fine:
```
$msbuild = "C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe"
start-process $msbuild -wait
```
But when I run this code (below) I get an error:
```
$msbuild = "C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe /v:q /nologo"
start-process $msbuild -wait
```
Is there a way I can pass... | [
0.05856399983167648,
0.15042530000209808,
0.3952074944972992,
-0.09174635261297226,
0.0908551886677742,
-0.0786767452955246,
0.4138750433921814,
-0.3191920816898346,
-0.27077022194862366,
-0.3756338357925415,
0.023077214136719704,
0.6630434393882751,
-0.537537693977356,
0.3009204864501953,... | |
separate parameter
```
$msbuild = "C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe"
$arguments = "/v:q /nologo"
start-process $msbuild $arguments
``` | [
-0.25203320384025574,
0.25517210364341736,
0.5245646238327026,
-0.1227860078215599,
0.2765819728374481,
0.0429113544523716,
-0.018333926796913147,
-0.17875660955905914,
-0.03683662787079811,
-0.282588928937912,
-0.4146743714809418,
0.6189998984336853,
-0.4795072376728058,
0.082255050539970... | |
I have a program that makes many log4net calls to the "myprogram" loggers. It also calls other code that makes log4net calls to other loggers. I want to capture all logs higher than INFO for "myprogram" and all logs higher than WARN for everything else. This way, I get the work-in-progress messages specific to the task... | [
0.43359631299972534,
0.3181971311569214,
0.34853875637054443,
-0.06426972895860672,
0.2682354152202606,
-0.2478773295879364,
0.1800268441438675,
0.03365784138441086,
-0.17472440004348755,
-0.7600116729736328,
-0.009836503304541111,
0.6165047883987427,
-0.2105512022972107,
0.141941100358963... | |
value="WARN" />
<appender-ref ref="Console" />
<appender-ref ref="LogFile" />
</root>
<logger name="myprogram">
<level value="INFO" />
<appender-ref ref="Console" />
<appender-ref ref="LogFile" />
</logger>
<appender name="Console" type="log4net.Appender.ConsoleAp... | [
0.00985631812363863,
-0.18161752820014954,
0.6513465046882629,
-0.27113258838653564,
0.12984630465507507,
0.18717838823795319,
0.30430060625076294,
-0.4063625633716583,
-0.013394732028245926,
-0.8255637288093567,
0.012308836914598942,
0.6629717946052551,
-0.2660161852836609,
-0.02054087258... | |
</layout>
<threshold value="INFO" />
</appender>
<appender name="LogFile" type="log4net.Appender.RollingFileAppender">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="- %utcdate %level %logger %ndc %thread %message%newline" />
</layout>
<appendT... | [
0.17606738209724426,
-0.28344565629959106,
0.6072424054145813,
-0.18009890615940094,
0.23616039752960205,
0.19459882378578186,
0.038405224680900574,
-0.09881574660539627,
-0.5637894868850708,
-0.6925082802772522,
0.048051316291093826,
0.528836190700531,
-0.11220292001962662,
0.340871363878... | |
<immediateFlush value="true" />
<threshold value="INFO" />
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
</appender>
</log4net>
```
This makes perfect sense to me: log >WARN for everything and >INFO for the specific "myprogram" logger.
The problem is that I'm getting INFO mess... | [
0.006446073297411203,
-0.20361188054084778,
0.6016570329666138,
-0.10937781631946564,
0.24561432003974915,
-0.11162234097719193,
0.412840336561203,
-0.25878313183784485,
-0.16307595372200012,
-0.8123560547828674,
0.08414892852306366,
0.9226732850074768,
-0.21273764967918396,
-0.17824392020... | |
entries (since myprogram matches both "root" and "myprogram"), but it's happening at INFO even though ROOT is (presumably) set to WARN.
Am I doing something wrong here, or is this a log4net bug/ambiguity?
You are getting duplicated because you are telling it to log messages twice. I wouldn't recommend using additivit... | [
0.17422810196876526,
0.16306261718273163,
0.6416934132575989,
-0.008651063777506351,
0.21965572237968445,
0.032326266169548035,
0.47456061840057373,
-0.09004926681518555,
-0.29862886667251587,
-0.7391224503517151,
0.031227994710206985,
0.45002326369285583,
-0.24928544461727142,
0.231464669... | |
inherit them from the root logger; if you specify them again it will log twice. | [
0.37821319699287415,
-0.061373528093099594,
-0.02475190907716751,
0.1214955747127533,
0.24470481276512146,
-0.1162153035402298,
-0.16258041560649872,
-0.09989704191684723,
-0.4532497525215149,
-0.6777505874633789,
-0.19262617826461792,
0.3112882375717163,
0.18619222939014435,
0.15989068150... | |
How can I achieve the following structure without using tables or JavaScript? The white borders represent edges of divs and aren't relevant to the question.

The size of the area in the middle is going to vary, but it will have exact pixel values and the whole struct... | [
0.3010101914405823,
-0.010274622589349747,
0.47742459177970886,
-0.08580974489450455,
-0.17053203284740448,
-0.19345484673976898,
-0.06139606609940529,
-0.3527384102344513,
-0.33683931827545166,
-0.7837459444999695,
-0.055524565279483795,
0.24686376750469208,
-0.3052130341529846,
-0.103300... | |
using tables or JavaScript. It's slightly different, but introduces new problems. I've been mainly using it in jQuery-based windowing system, but I'd like to keep the layout out of the script and only control the size of one element (the middle one).

You can use nest... | [
0.2749279737472534,
-0.10483497381210327,
0.3904064893722534,
-0.15001149475574493,
-0.17093311250209808,
0.004915088415145874,
0.03929242491722107,
-0.2898838222026825,
-0.3327459990978241,
-0.7856460809707642,
-0.07154624164104462,
0.6204176545143127,
-0.3003409802913666,
-0.327607274055... | |
putting images as left and right rounded corners, and a center image that repeats between them.
The HTML:
```
<div class="Header">
<div>
<div>This is the dynamic center area</div>
</div>
</div>
```
The CSS:
```
.Header {
background: url(left.gif) no-repeat;
padding-left: 30px;
}
.Header div {
... | [
-0.24016237258911133,
-0.2483271062374115,
0.689914882183075,
-0.008513807319104671,
-0.17178794741630554,
0.14846552908420563,
-0.15181536972522736,
0.03262591361999512,
-0.2807372808456421,
-0.7004705667495728,
-0.4241119623184204,
0.2113739550113678,
-0.2560056447982788,
0.0471498742699... | |
The localization saga continues...
So I'm trying to support collation of chinese text in my iPhone app, and after talking to a native chinese speaker, I think I understand how the chinese do it...
Lets say you had the string 巴拉克·奥巴马 and you wanted to figure out which section of the chinese phonebook to put it in (in ... | [
-0.07653139531612396,
-0.09192945063114166,
0.12114209681749344,
-0.34631744027137756,
-0.1861172914505005,
0.2947000563144684,
0.48591315746307373,
0.381313294172287,
-0.2070196121931076,
-0.45101919770240784,
-0.34678494930267334,
0.020643573254346848,
-0.08226708322763443,
0.02879540435... | |
to balake aobama using the iPhone SDK? It looks like the [ICU](http://site.icu-project.org/) library, which ships on the phone, can do this kind of transliteration, but I'm not sure if I can use it easily from my code, and even if I can, I don't know if the transliteration stuff is included in the build of ICU that com... | [
-0.01197068765759468,
0.20874188840389252,
0.18005938827991486,
-0.31158870458602905,
-0.1692928820848465,
0.2808103561401367,
0.38258472084999084,
0.136424720287323,
-0.1894736886024475,
-0.20486600697040558,
-0.3373817801475525,
0.1898452341556549,
-0.43582502007484436,
-0.11202009022235... | |
Is there a library that provides the ability to do SCP transfers in C#?
Have you tried [SharpSSH](https://sourceforge.net/projects/sharpssh/)? (last update was 2013) | [
-0.203843891620636,
-0.5046874284744263,
0.34512802958488464,
0.2411264330148697,
-0.045437246561050415,
-0.2568248510360718,
-0.011223495937883854,
0.059840597212314606,
-0.6113474369049072,
-0.16545429825782776,
-0.04372550547122955,
0.25639116764068604,
-0.16437260806560516,
-0.13150900... | |
What's the easiest way to generate random values according to a bimodal distribution in C or Python?
I could implement something like the Ziggurat algorithm or a Box-Muller transform, but if there's a ready-to-use library, or a simpler algorithm I don't know about, that'd be better.
Aren't you just picking values eith... | [
0.07059438526630402,
-0.2661997973918915,
-0.2792375683784485,
-0.008282938972115517,
-0.340131551027298,
0.13998137414455414,
-0.26561877131462097,
-0.3978356719017029,
-0.3941139876842499,
-0.419129341840744,
0.22123707830905914,
0.3757667541503906,
-0.736164927482605,
-0.114895187318325... | |
return random.triangular( low1, high1, mode1 )
else:
return random.triangular( low2, high2, mode2 )
```
This may do everything you need. | [
-0.20989182591438293,
-0.2564117908477783,
-0.165889710187912,
-0.031294550746679306,
-0.2554638683795929,
0.19815079867839813,
-0.005278861150145531,
-0.46974650025367737,
-0.07476306706666946,
-0.5472180247306824,
0.09060999751091003,
0.31878358125686646,
-0.24652062356472015,
-0.1797235... | |
I'm trying to write a regular expression to identify an if statement. The only problem I'm having is getting it capture if statements that have parentheses in their parenthesis. For example:
```
if (condition_function(params)) {
statements;
}
```
My expression to capture all if statements except these is:
```
... | [
-0.046719178557395935,
0.28146225214004517,
0.12118072062730789,
-0.11605135351419449,
0.01465564128011465,
-0.19355736672878265,
0.5025126338005066,
-0.07169203460216522,
-0.11001505702733994,
-0.48403409123420715,
-0.31257614493370056,
0.543165385723114,
-0.35217413306236267,
-0.13229635... | |
of that might break it and the only thing that it does not work on is one that contains a string with an unmatched parenthesis.
Update: I found an error with the above regular expression. It does not catch if statements that contains strings with unmatched parenthesis in their condition or statement sections. Like the... | [
-0.3689452111721039,
0.11874464899301529,
0.3703290522098541,
0.012212853878736496,
0.17650599777698517,
-0.2746028006076813,
0.6712498068809509,
-0.3101768493652344,
-0.23479126393795013,
-0.17547845840454102,
-0.5468123555183411,
0.3556755483150482,
-0.4134867787361145,
0.082309290766716... | |
that are attached to if statements. The only problem is that the capture groups it returns are the last else and the last else if in the if statement. Hopefully I'll figure out how to get around that as well.
```
if\s*\(((?:(?:(?:"(?:(?:\\")|[^"])*")|(?:'(?:(?:\\')|[^'])*'))|[^\(\)]|\((?1)\))*+)\)\s*{((?:(?:(?:"(?:(?:... | [
-0.33017492294311523,
-0.04038507863879204,
0.3508252501487732,
-0.14661094546318054,
0.14188027381896973,
-0.15788531303405762,
-0.0585235133767128,
-0.09916737675666809,
0.07619369029998779,
-0.3732947111129761,
-0.4746633768081665,
0.24460460245609283,
-0.542509913444519,
-0.13430951535... | |
I am new to Prism and I am trying to determine a best practice for deactivating a view in a Prism 2 application -- when a user clicks a button on the view I want to deactivate the view. The view is executing a command when the button is clicked.
The view model is receiving the command but the viewmodel does not have a... | [
0.29529571533203125,
0.020152179524302483,
0.5637721419334412,
-0.14518919587135315,
-0.2361992448568344,
-0.43747562170028687,
0.367423951625824,
-0.43341532349586487,
-0.13185882568359375,
-0.5003455281257629,
-0.07679479569196701,
0.4853854179382324,
-0.31563737988471985,
0.305722773075... | |
am using the MVVM pattern for the app.
I'm gonna go on a limb here and assume that you are using an itemscontrol or such for your region, because that's the most obvious use of a "button that removes a view".
In that case, you should have a Controller (or whatever you want to call it, but the Prism team seems to use t... | [
0.11479487270116806,
-0.23272882401943207,
0.7194092273712158,
0.34887540340423584,
-0.10670861601829529,
-0.19032476842403412,
0.051573872566223145,
0.046189457178115845,
-0.5439873933792114,
-0.5024531483650208,
-0.12476377934217453,
0.5419989824295044,
-0.21161872148513794,
0.0965219512... | |
to be the second one, and the controller should be responsible for managing the views. Your viewmodel should get a reference to that controller through Dependency Injection and ask it to remove it from the pool of active models/views.
The Controller itself receives the IRegionManager and finds the Region it is respons... | [
0.004010834731161594,
-0.5463865399360657,
0.5480446219444275,
0.20143169164657593,
-0.17116022109985352,
-0.041865818202495575,
-0.316800981760025,
0.1414078027009964,
-0.32295963168144226,
-0.7232375144958496,
-0.029786787927150726,
0.5725778341293335,
-0.40115606784820557,
0.24615298211... | |
Duplicate question to :
> [Should I always/ever/never initialize object fields to default values?](https://stackoverflow.com/questions/636102/should-i-always-ever-never-initialize-object-fields-to-default-values)
Environment: Visual Studio 2008 w/ Resharper 4.1 w/ 32bit .NET Framework 3.5
Resharper reports that
> ... | [
-0.09653011709451675,
0.2290811538696289,
-0.05453150346875191,
-0.021826311945915222,
-0.026934664696455002,
0.09331804513931274,
0.27151376008987427,
-0.043563343584537506,
-0.6709247827529907,
-0.33442622423171997,
0.08969907462596893,
0.5810369253158569,
-0.47571665048599243,
-0.129086... | |

It is redundant, but I would stay consistent. If you are always initializing fields, keep it that way regardless of the type. Also, as you pointed out in a comment, being required to think about default values for certain types is distracting... | [
0.1286761611700058,
-0.07315544784069061,
0.30404937267303467,
-0.24504409730434418,
-0.12939098477363586,
-0.07513078302145004,
0.4451807737350464,
-0.02150523103773594,
-0.29525887966156006,
-0.37815868854522705,
-0.16811248660087585,
0.6812442541122437,
-0.1933935582637787,
-0.007307396... | |
The stackpanel is not co-operating. We have a fixed width, and a variable number of items to lay out left-to-right inside it.
We have a an items control that lays them out with a stack panel:
```
<ItemsControl x:Name="testItems"
HorizontalAlignment="Left"
VerticalAlignment="Top">
<Item... | [
-0.3631337583065033,
-0.0751551017165184,
0.5303943157196045,
0.03063146024942398,
0.09824977815151215,
0.2940012514591217,
-0.31490516662597656,
-0.2424590140581131,
-0.4781641662120819,
-0.6383009552955627,
-0.170513316988945,
-0.07214158773422241,
0.2753811478614807,
-0.0644587203860282... | |
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Stacktest:ItemControl />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
```
But this doesn't size the items correctly. They are always the same... | [
-0.08525805175304413,
-0.015542409382760525,
0.21063314378261566,
0.20443178713321686,
-0.03449222072958946,
0.3255142271518707,
-0.06032893806695938,
-0.4419891834259033,
-0.4751758575439453,
-0.9085094332695007,
-0.1594296097755432,
-0.051667287945747375,
0.18273620307445526,
-0.00557347... | |
they are cut off on the right, rather than sized so that they all fit in. Any idea how to accomplish this? I'd use a grid if the number of items was constant, but it isn't. It's typically 1-4 items.
It would be nice if the ItemsPanelTemplate could be a grid with a variable number of columns. But I don't know if that (... | [
0.2997340261936188,
-0.08015631139278412,
0.3010827302932739,
0.17193780839443207,
-0.23944230377674103,
0.41872501373291016,
-0.016275668516755104,
-0.26012513041496277,
-0.6881122589111328,
-0.820401668548584,
0.05120816081762314,
0.1570899337530136,
0.0605657584965229,
0.089666575193405... | |
always initializing fields, keep it that way regardless of the type. Also, as you pointed out in a comment, being required to think about default values for certain types is distracting, so another reason to initialize first. | [
0.1604413539171219,
-0.20572499930858612,
-0.19943444430828094,
0.12278030812740326,
-0.2006475329399109,
-0.24928368628025055,
0.03554772958159447,
0.12220169603824615,
-0.05074739456176758,
-0.5034563541412354,
-0.04136114940047264,
0.5558167695999146,
-0.34924614429473877,
-0.1694595366... | |
I have a form which I would like to store the values of in a cookie so the user doesn't have to re-enter the form every visit. (The form is a few selects to filter search results.)
I would like for the cookie serialization to easily be readable from JavaScript (obviously to set the form `onLoad`), but I'd also like to... | [
0.6594362854957581,
0.007322279270738363,
0.2059311717748642,
0.2920340299606323,
-0.10122711956501007,
-0.2445964515209198,
0.008109384216368198,
-0.13148656487464905,
-0.13615767657756805,
-0.8438938856124878,
0.37157994508743286,
0.5062163472175598,
-0.16741612553596497,
0.1878865063190... | |
be easily readable in JavaScript and PHP?
Please don't preach about validation, I'm doing that correctly on the server-side.
If there's a smarter solution to my problem please let me know.
BTW: I'm using CodeIgniter on the server and Prototype/Scriptaculous JavaScript libraries.
**Solution:** Used Prototype's [`Obj... | [
0.49005815386772156,
0.20474836230278015,
0.06356184184551239,
0.01883080042898655,
-0.16909833252429962,
-0.02465357817709446,
0.4728688895702362,
-0.09962108731269836,
-0.018066730350255966,
-0.8882833123207092,
-0.050270501524209976,
0.43749505281448364,
-0.1436694711446762,
-0.19438526... | |
I recently had a security audit run against one of the sites I work on. This was done with the Acunetix Web Vulnerability Scanner. This came back with a bunch of results that I'm sorting through.
A lot of hits on XSS came up, but I'm not sure if they are false positives or not.
Code such as:
```
if(isset($_GET['vari... | [
0.07024701684713364,
0.1372595578432083,
0.3013756275177002,
0.0634985938668251,
-0.07389752566814423,
-0.10856954008340836,
0.3666418790817261,
-0.07390408962965012,
-0.34897783398628235,
-0.6382609009742737,
-0.08819939941167831,
0.5759584307670593,
-0.4371165633201599,
0.084194347262382... | |
help.
Acunetix is a decent tool but it is NOT a replacement for manual based App Penetration Testing. It doesn't have the logic to follow through potential exploits .....
It is certainly used in the banks and I've recommended it in Proposals (which have been approved) to conduct formal bits of work. If you have a fai... | [
0.30015549063682556,
-0.3123610019683838,
0.172649547457695,
0.7082996964454651,
0.1327049285173416,
-0.15379145741462708,
0.104622982442379,
0.13879869878292084,
0.0030413835775107145,
-0.5066414475440979,
0.11400274932384491,
0.8906062245368958,
-0.17156212031841278,
-0.2927109897136688,... | |
by manual means - whether this is manual testing or stepping through the code. This is where your Pen Test houses earn their stripes.
Clients simply don't have the resources to go through large App's thoroughly.
Oh, and bear in mind there's lots of false positives. | [
1.0526082515716553,
0.23976148664951324,
-0.09875234961509705,
0.4774990677833557,
0.24627383053302765,
0.02334624156355858,
0.26436173915863037,
-0.1082921102643013,
-0.2608586251735687,
-0.4324430525302887,
0.18263529241085052,
0.5805419087409973,
0.0846540555357933,
-0.28256040811538696... | |
Our system runs on SQL Server 2000, and we are in the process of preparing for an upgrade to SQL Server 2008. We have a lot of trigger code where we need to detect a change in a given column and then operate on that column if it has changed.
Obviously SQL Server provides the [UPDATE()](http://msdn.microsoft.com/en-us/... | [
-0.13555797934532166,
0.12744367122650146,
0.703833818435669,
0.0024469075724482536,
0.13670873641967773,
-0.12525026500225067,
0.003529781475663185,
0.11418303102254868,
-0.2573486268520355,
-0.5852381587028503,
0.1268186867237091,
0.49044227600097656,
-0.4137777090072632,
0.0319466628134... | |
SELECT @col1_changed = COUNT(*)
FROM Inserted i
INNER JOIN Deleted d ON i.Table_ID = d.Table_ID
WHERE ISNULL(i.Col1, '<unique null value>')
!= ISNULL(i.Col1, '<unique null value>')
```
This code needs to be repeated for every column you are interested in testing. You can then check the '... | [
0.16139738261699677,
-0.0790286734700203,
0.5427016615867615,
-0.18690460920333862,
0.16669122874736786,
0.13037531077861786,
0.20852750539779663,
-0.3835168480873108,
-0.19662858545780182,
-0.5694258809089661,
0.14992636442184448,
0.5676771998405457,
-0.35536789894104004,
0.17804042994976... | |
column has changed over all the rows that were modified.
You can test individual UPDATE statements with something like this:
```
UPDATE Table SET Col1 = CASE WHEN i.Col1 = d.Col1
THEN Col1
ELSE dbo.fnTransform(Col1) END
FROM Inserted i
INNER JOIN Deleted d ON i.Table_ID = d.Table_ID
```
..... | [
-0.1970863789319992,
0.1795843243598938,
0.7770271301269531,
-0.3455938398838043,
-0.10949902981519699,
0.26644468307495117,
0.10213718563318253,
-0.22076816856861115,
-0.22311118245124817,
-0.5294743180274963,
-0.054507993161678314,
0.4418507218360901,
-0.36408981680870056,
0.322531551122... | |
anyone has insight (or, better yet, hard data) as to what the best/cheapest approach is to the problem of predicating a database operation in a trigger on whether a particular column value in a modified row has actually changed or not. Neither of the methods above seem ideal, and I was wondering if a better method exis... | [
0.5319966077804565,
0.28213703632354736,
0.3591575026512146,
0.16234619915485382,
0.12850570678710938,
0.07221261411905289,
-0.06738798320293427,
-0.39891549944877625,
-0.10302574187517166,
-0.35134321451187134,
0.3666819930076599,
0.5000953674316406,
0.11458513140678406,
-0.05853021144866... | |
be forthcoming.
I set up a table that was effectively a narrower subset (9 columns) of one of our system's primary tables, and populated it with production data so that it was as deep as our production version of the table.
I then duplicated that table, and on the first one wrote a trigger that attempted to detect ev... | [
0.3139035403728485,
-0.0570160374045372,
0.4443722069263458,
0.05474529787898064,
0.407112717628479,
0.4250768721103668,
0.05642528831958771,
-0.35034361481666565,
0.1594594568014145,
-0.4477008879184723,
-0.10743696242570877,
0.6728363037109375,
-0.2997290790081024,
-0.16358262300491333,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.