text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
Dispose();
}
private DateTime NextEvent {
get {
lock(events)
return events.Keys[0];
}
}
private void executeEvents() {
while (active) {
// Process all events that are due | [
0.355127215385437,
-0.5959670543670654,
0.3030488193035126,
-0.1830122023820877,
0.4653165340423584,
-0.05575360730290413,
0.34063637256622314,
-0.03683150187134743,
-0.25491103529930115,
-0.40635013580322266,
-0.23062604665756226,
0.459634006023407,
-0.0956626757979393,
0.2137942016124725... | |
while (events.Count > 0 && NextEvent <= DateTime.Now) {
lock(events) {
events.Values[0]();
events.RemoveAt(0);
} | [
0.05072087422013283,
-0.45432454347610474,
0.31607261300086975,
-0.2884558439254761,
0.7341272234916687,
0.1314830183982849,
0.3431268632411957,
-0.08149845153093338,
-0.2970786988735199,
-0.18268494307994843,
-0.2675219774246216,
0.4729457199573517,
-0.22733134031295776,
0.451970696449279... | |
}
// Wait for the next event, or until one is scheduled
if (events.Count > 0)
wakeup.WaitOne((int)(NextEvent - DateTime.Now).TotalMilliseconds);
else
wakeup.WaitOne();
}
} | [
0.20884183049201965,
-0.5883760452270508,
0.41809216141700745,
-0.22011198103427887,
0.5724045634269714,
-0.011047661304473877,
0.28436174988746643,
-0.04809340462088585,
-0.33946463465690613,
-0.33130621910095215,
-0.19657528400421143,
0.5966288447380066,
-0.13228213787078857,
0.336135625... | |
internal void Stop() {
active = false;
wakeup.Set();
}
public void Dispose() {
Stop();
}
}
```
I don't think it is unreasonable to require clients to Stop() the thread for shutdown at all. There are ways you can create threads whose continued execution will not stop the application... | [
0.5381293296813965,
-0.05880015715956688,
0.2185756266117096,
-0.28139495849609375,
0.21335354447364807,
-0.24830718338489532,
0.5691553950309753,
0.06983792036771774,
-0.5197560787200928,
-0.30772486329078674,
-0.3650340735912323,
0.6455219388008118,
-0.6115300059318542,
0.349346369504928... | |
is not too much of a burden for the client. | [
0.20873433351516724,
0.15574167668819427,
0.24856536090373993,
0.07063072174787521,
0.40820372104644775,
0.07548130303621292,
0.04998444393277168,
0.2638615071773529,
-0.04635436460375786,
-0.5608987212181091,
0.0336085744202137,
0.5293273329734802,
0.417044460773468,
-0.1799663007259369,
... | |
Suppose I have a function attached to one of my Excel sheets:
```
Public Function foo(bar As Integer) as integer
foo = 42
End Function
```
How can I get the results of `foo` returned to a cell on my sheet? I've tried `"=foo(10)"`, but all it gives me is `"#NAME?"`
I've also tried `=[filename]!foo(10) and [sheet... | [
-0.15002141892910004,
0.3126171827316284,
0.4521341919898987,
-0.4444945156574249,
0.017725570127367973,
0.13258561491966248,
0.06900939345359802,
-0.4778690040111542,
-0.18242762982845306,
-0.6445294618606567,
-0.11397773027420044,
0.3991434872150421,
-0.2807697355747223,
-0.1595620810985... | |
* 2
End Function
```
and on a sheet putting `"=TimesTwo(100)"` into a cell gives me `200`. | [
0.19957536458969116,
0.2772592604160309,
0.3520186245441437,
-0.5867153406143188,
0.05380801111459732,
-0.12872622907161713,
0.11629897356033325,
-0.6067860722541809,
-0.03677989915013313,
-0.6234009861946106,
-0.0008807911654002964,
0.060152579098939896,
-0.09866302460432053,
-0.014677406... | |
I have a bunch of simple lookup tables cached in my asp.net application since the source data is on a seperate server from our main web architecture and it changes infrequently. I've been following answers here and various documentation and I have my initial load function call the following:
```
HttpContext.Current.Ca... | [
0.2174178510904312,
-0.035844266414642334,
0.5564782619476318,
-0.12226753681898117,
0.2848101556301117,
0.14509235322475433,
0.1971314400434494,
0.11346911638975143,
-0.1862575113773346,
-0.7461894750595093,
-0.08337695151567459,
0.09013035893440247,
-0.000621890474576503,
0.2521890997886... | |
System.Web.Caching.Cache.NoSlidingExpiration, _
CacheItemPriority.Normal, _
New CacheItemRemovedCallback(AddressOf CheckLocationsExpired))
```
For my cache expired callback, I have the following code.
```
Public | [
-0.06194944679737091,
0.3126973509788513,
0.18829357624053955,
0.06069878488779068,
0.3788255751132965,
-0.06378936022520065,
0.5441804528236389,
0.09058406203985214,
-0.14423207938671112,
-0.6811434030532837,
0.06899530440568924,
0.4434314966201782,
-0.3860046863555908,
0.4502154588699341... | |
Shared Sub CheckLocationsExpired(ByVal key As String, ByVal value As Object, ByVal reason As CacheItemRemovedReason)
Dim dtCheckLocation As New ReferenceSchema.CheckLocationDataTable
dtCheckLocation = GetAllCheckLocations()
HttpContext.Current.Cache.Insert("CheckLocations", dtCheckLocation, Nothing, _
... | [
-0.05715907737612724,
0.02143906056880951,
0.36762765049934387,
0.030655978247523308,
0.11686322093009949,
0.01757379248738289,
0.6510608196258545,
-0.05346224457025528,
-0.06327056884765625,
-0.5875289440155029,
-0.14629356563091278,
0.1145528107881546,
-0.14761531352996826,
0.66166663169... | |
System.Web.Caching.Cache.NoSlidingExpiration, _
CacheItemPriority.Normal, _
New CacheItemRemovedCallback(AddressOf CheckLocationsExpired))
End Sub
```
For the record, the GetAllCheckLocations method simply calls a web service and parses the resu... | [
-0.05733487382531166,
0.13953839242458344,
0.41401615738868713,
0.13276375830173492,
0.4464704096317291,
-0.21357879042625427,
0.4734223186969757,
-0.1380334198474884,
-0.1964408904314041,
-0.5484740734100342,
-0.3333694636821747,
0.2894444167613983,
-0.3077501058578491,
0.4583291411399841... | |
data table being stored.
Now when I recompile the application for local testing, everything still functions fine, but I find the following exception message in my log file:
> System.NullReferenceException: Object reference not set to an instance of an
> object. at EAF.CacheMethods.CheckLocationsExpired(String key, O... | [
-0.03836369514465332,
0.13319042325019836,
0.48537740111351013,
0.14033740758895874,
0.28905296325683594,
-0.0502556674182415,
0.5831403136253357,
-0.12209374457597733,
-0.5523236989974976,
-0.6130164265632629,
-0.036369070410728455,
0.3694409132003784,
-0.11338405311107635,
0.123770780861... | |
like the Reponse.Redirect issue where terminating the processing technically throws a thread abort exception?
Does it still exception out when you don't give it a callback function? Seems more like the delegated function is having issues with null objects. | [
0.1169876828789711,
-0.36485302448272705,
0.0407257117331028,
0.15612968802452087,
-0.24528871476650238,
-0.30458998680114746,
0.22114969789981842,
0.07287800312042236,
-0.6454269289970398,
-0.1702502965927124,
-0.11856459826231003,
0.27086541056632996,
-0.37182655930519104,
0.333847343921... | |
I want any request to <http://example.com/>\* to be redirected to <http://www.example.com/>\*.
Where \* is any arbitrary path.
Use Apache's [mod\_alias](http://httpd.apache.org/docs/1.3/mod/mod_alias.html) module to do a permanent redirect like:
```
RedirectPermanent / "http://www.example.com/"
```
Place the redire... | [
0.18893671035766602,
-0.11174684017896652,
0.7551333904266357,
0.013862201012670994,
-0.01601010374724865,
-0.1348239779472351,
0.11161301285028458,
-0.11707745492458344,
-0.18617874383926392,
-0.7192686200141907,
-0.34975606203079224,
0.3984847366809845,
-0.34270381927490234,
0.2209034711... | |
I am debugging a problem in Django with **Pydev**.
I **can set breakpoint** in my django **project code** with out a problem.
However I **can't set breakpoints** in the **Django library source code** (in site-packages).
The PyDev debugger user interface in this case **simply does nothing when I click** to set t... | [
0.1772211194038391,
0.4231208264827728,
0.06919319182634354,
-0.27037665247917175,
-0.2561597228050232,
-0.32095029950141907,
0.3989320993423462,
0.12359604239463806,
-0.48338350653648376,
-0.4667222499847412,
-0.16769284009933472,
0.5349647402763367,
-0.49350905418395996,
0.10090894252061... | |
have the **site-packages** configured in PyDev to be in my **PYTHONPATH**
I am using Eclipse on Max OS X if that helps.
Thanks
Have you imported the Django source as a project? To do that you just create a new PyDev project and set it's location to the Django source folder. | [
0.6492793560028076,
0.01814589835703373,
-0.12550964951515198,
0.06424612551927567,
-0.39058956503868103,
-0.28782975673675537,
0.04624595865607262,
0.3782169222831726,
-0.300091952085495,
-0.8273642659187317,
0.12349533289670944,
0.46309414505958557,
-0.19646717607975006,
-0.0466822683811... | |
I am interested in writing a very minimalistic compiler.
I want to write a small piece of software (in C/C++) that fulfills the following criteria:
* output in ELF format (\*nix)
* input is a single textfile
* C-like grammar and syntax
* no linker
* no preprocessor
* very small (max. 1-2 KLOC)
Language features:
* ... | [
0.11353302001953125,
0.20652921497821808,
-0.08079565316438675,
-0.003087881486862898,
-0.20064420998096466,
0.01728738658130169,
0.23082485795021057,
0.14989612996578217,
0.11829441785812378,
-0.46824169158935547,
-0.16801562905311584,
0.37726137042045593,
-0.1836942583322525,
-0.41617086... | |
(at least not in the sense that I just could start right off the shelf) and how to program them. Thank you for your ideas.
Firstly, you need to decide whether you are going to make a compiler or an interpreter. A compiler translates your code into something that can be run either directly on hardware, in an interpreter... | [
0.7364149689674377,
0.06025123596191406,
-0.4410994052886963,
0.3095915913581848,
-0.03719482198357582,
0.11493537575006485,
0.09233446419239044,
0.2507907748222351,
-0.22509659826755524,
-0.7733362913131714,
-0.10988737642765045,
0.597094714641571,
-0.19280900061130524,
-0.061719443649053... | |
or Java bytecode, as it gives you a very optimized interpreter to run on as well as a lot of standard libraries.
Once you made your decision there are some common steps to follow
1. **Language definition** Firstly, you have to define how your language should look syntactically.
2. **Lexer** The second step is to crea... | [
0.20418040454387665,
0.047146134078502655,
-0.2175433337688446,
0.08386477082967758,
-0.18819206953048706,
-0.06089068949222565,
0.15474222600460052,
-0.10969866067171097,
-0.14877133071422577,
-0.7602010369300842,
-0.030137566849589348,
0.29552900791168213,
-0.32012543082237244,
-0.396993... | |
grammar. A number of tools can be fed with one of these grammars and create the parser for you. Usually, the parsed tokens are organized into a parse tree. A parse tree is the representation of your grammar as a data structure which you can move around in.
4. **Compiling or Interpreting** The last step is to run some l... | [
0.26693838834762573,
0.25434932112693787,
-0.23422688245773315,
0.08893251419067383,
-0.38666215538978577,
-0.13506659865379333,
0.6317813396453857,
-0.12381669878959656,
-0.20003625750541687,
-0.6919586062431335,
-0.07523451745510101,
0.3007652759552002,
-0.4122733473777771,
-0.2786161005... | |
language you can insert the logic of how to translate the code in the nodes instead.
Wikipedia is great for learning more, you might want to start [here](http://en.wikipedia.org/wiki/Lexing).
Concerning real-world reading material I would suggest "Programming language processors in JAVA" by David A Watt & Deryck F Br... | [
0.04306010529398918,
0.22724910080432892,
-0.3400603234767914,
-0.2903713285923004,
0.0015946200583130121,
0.5936127305030823,
0.5269197225570679,
0.1366548091173172,
-0.20436081290245056,
-0.4627004861831665,
-0.09185049682855606,
0.5121129155158997,
-0.412921667098999,
-0.738107025623321... | |
After programming in C for several years, I realized that I have been ignoring the C convention of returning zero from a function to indicate success. The convention seems semantically wrong to me, as zero is of course false. The problem is I like to name functions like `is_valid_foobar()`, and in order to accomodate t... | [
-0.031500983983278275,
0.4580298364162445,
-0.030348310247063637,
-0.3506002426147461,
-0.0710488110780716,
-0.30283576250076294,
0.5784698724746704,
-0.26292064785957336,
0.06575100868940353,
-0.11537908762693405,
-0.23452183604240417,
0.6661804914474487,
-0.26002633571624756,
0.133384808... | |
{
if ( foobar < MAX_ALLOWED ) {
return TRUE;
}
return FALSE;
}
```
I haven't actually caught any flak for this in code reviews. So I'm thinking it's not such a terrible habit, but it is 'unconventional'. I'm curious what people think.
I'm very careful about the choices I make for function ... | [
0.4459289610385895,
0.21622952818870544,
-0.031232869252562523,
-0.34315013885498047,
-0.029840536415576935,
-0.39097195863723755,
0.29115182161331177,
0.14740951359272003,
-0.023931875824928284,
-0.11869978159666061,
-0.21952417492866516,
0.6536557674407959,
-0.3082945644855499,
0.0942282... | |
extra `!` at the front of the function call. But what sayest thou, oh mighty ones of S.O?
I'd say both are correct, for different purposes:
If you're performing a simple go/no-go validation, e.g. is\_numeric(), then true and false work nicely.
For something more elaborate, the 0==success paradigm is helpful in that i... | [
0.1799735128879547,
0.046518076211214066,
0.08325804769992828,
0.029877448454499245,
-0.13831283152103424,
0.17784938216209412,
0.562075138092041,
-0.23147571086883545,
-0.14388945698738098,
-0.23898550868034363,
-0.4651855230331421,
0.8444214463233948,
0.024019725620746613,
-0.10196173191... | |
I am having a hard time tracking down a lock issue, so I would like to log every method call's entry and exit. I've done this before with C++ without having to add code to every method. Is this possible with C#?
Probably your best bet would be to use an AOP (aspect oriented programming) framework to automatically call ... | [
0.5576880574226379,
-0.27773526310920715,
0.3215208053588867,
0.22845472395420074,
0.09734170138835907,
-0.30629101395606995,
0.05700288712978363,
-0.10006317496299744,
-0.3695142865180969,
-0.35097718238830566,
0.07980895787477493,
0.3222751021385193,
-0.2040729522705078,
-0.0666897520422... | |
I'm developing an app with a Flex-based front end and a Spring/Hibernate back-end.
To get Facebook integration working in the way I've got it currently, I need to read the cookies set in javascript on the front end on the back-end and do some validation during login to see whether the user is attempting to spoof his F... | [
0.3605058491230011,
-0.3877109885215759,
0.1210644394159317,
-0.06217707321047783,
-0.1308850646018982,
0.1671837717294693,
0.09252327680587769,
-0.08081929385662079,
-0.30174052715301514,
-0.542019248008728,
0.13188698887825012,
0.49985530972480774,
-0.09411109983921051,
-0.40580543875694... | |
looked at.)
I'm not using Spring MVC or Spring WebFlow or anything like that. I can get the ServletContext, but I haven't yet figured out how to get the request.
Any help?
If FlexContext is not available:
Solution 1: inside method (>= Spring 2.0 required)
```
HttpServletRequest request =
((ServletRequestAt... | [
-0.06857289373874664,
0.006710502319037914,
0.6545273065567017,
-0.12471621483564377,
-0.34967344999313354,
-0.0863327905535698,
0.3666713237762451,
-0.4361473619937897,
-0.2901611626148224,
-0.699932336807251,
-0.20226286351680756,
0.419185996055603,
-0.39812222123146057,
0.05200006812810... | |
I work in a mixed source control environment. We are still mostly on CVS, but newer projects are in SVN. However, I am finding it hard to get buy-in for SVN because TortoiseSVN doesn't work like TortoiseCVS.
The 3 way merge has a lot of cognitive dissonance and while TortoiseCVS seems to always get the merges right, ... | [
0.09561696648597717,
0.22801634669303894,
0.3910987377166748,
-0.17927296459674835,
0.02299167960882187,
-0.19986963272094727,
0.6146019101142883,
-0.039693836122751236,
-0.3864794671535492,
-0.5200393199920654,
-0.14742818474769592,
0.8151392936706543,
-0.052642881870269775,
0.06341557949... | |
three way merge, if possible, I would like to do a two way merge like TortoiseCVS does. I know that the resulting file is the same in CVS and SVN, for example a Visual Studio project file has two different Versions. This will always end in a conflict in TortoiseSVN and never in a conflict in TortoiseCVS.
SVN looks lik... | [
-0.24217215180397034,
-0.14482267200946808,
0.6960514783859253,
-0.32140299677848816,
-0.22240957617759705,
0.11731196194887161,
0.2891390323638916,
-0.43385469913482666,
-0.26133230328559875,
-0.8460670709609985,
-0.00402315566316247,
0.9568212628364563,
-0.056026991456747055,
0.146493420... | |
has conflicts when updating if two people work on the same file, even though they are working in different locations, TortoiseCVS doesn't have this problem. I assume TortoiseSVN is being more conservative and forcing you to check the merge TortoiseCVS is assuming CVS got it right. I was wondering if there where some op... | [
0.27617594599723816,
-0.43542173504829407,
0.3052912652492523,
0.07994978874921799,
-0.05282202363014221,
-0.18794773519039154,
0.32559794187545776,
-0.014486214146018028,
-0.2550548315048218,
-0.32237935066223145,
0.12330646067857742,
0.7535455822944641,
-0.1890258938074112,
0.05542156100... | |
Merge](http://www.araxis.com/merge/). They offer instructions on integrating them into TortoiseSVN as custom merge/diff tools. | [
0.3372991979122162,
-0.2446669638156891,
0.5414481163024902,
-0.11073838174343109,
0.3491753041744232,
0.32994601130485535,
0.07874561101198196,
-0.23907583951950073,
-0.3415510356426239,
-0.34250935912132263,
-0.1005643680691719,
0.31915345788002014,
-0.06182584911584854,
-0.0271860156208... | |
I am trying to display a 'Software Release' table in an asp.net dynamic data site. The Release table has a build number stored as three int fields (Major, Minor, Build). I'm using EntityFramework, so I have an EF model bound to my database schema. In my dynamic data site, I want the build number to show up as a single ... | [
0.08023393154144287,
0.19925116002559662,
0.36434754729270935,
-0.1571340262889862,
-0.12119972705841064,
0.13471966981887817,
0.04878811538219452,
0.07877036929130554,
-0.2832671105861664,
-0.6249589920043945,
-0.1696917712688446,
0.38490092754364014,
-0.16656695306301117,
0.4053020775318... | |
the Dynamic-Data to recognize or display it. I can add a property to the Release object (since it is a partial class generated by EF), but Dynamic-Data won't recognize it, because it isn't a 'column'. I want to edit the Release as three separate fields (major, minor, build), but when it is displayed, I want it to show ... | [
-0.011606377549469471,
-0.22388990223407745,
0.6270036697387695,
-0.01552853174507618,
-0.1854398250579834,
-0.027629077434539795,
0.044373977929353714,
-0.08887667953968048,
-0.1543780267238617,
-0.40953245759010315,
-0.17101827263832092,
0.8127208352088928,
-0.511802077293396,
0.18374447... | |
not sure if you are binding to a DataTable/DataSet returned from the database, or if you are binding to a Release object itself. Nor which kind of control.
If you are binding to a DataSet/DataTable, simply change your SQL to return the version as one field:
```
SELECT table1.Major + '.' + table1.Minor + '.' + table1.... | [
0.04155146703124046,
0.07934695482254028,
0.8090211153030396,
-0.1968890130519867,
0.03292239457368851,
-0.31175681948661804,
0.12481223046779633,
-0.04698362573981285,
-0.3074953258037567,
-0.45248860120773315,
-0.3164088726043701,
0.5609831213951111,
-0.4754883348941803,
0.51796245574951... | |
& '.' & _build.ToString
End Sub
``` | [
0.08637415617704391,
0.4954627454280853,
0.7738550901412964,
-0.15814103186130524,
0.3724754750728607,
-0.11443959921598434,
0.42660239338874817,
-0.09955164045095444,
-0.02973184920847416,
-0.27877965569496155,
-0.3664622902870178,
0.3547149896621704,
-0.22158494591712952,
0.4249031543731... | |
I'm just trying to do some simple validation in MVC RC and am getting an error. For the purposes of this question, I am **not using the UpdateModel**.
Here is the code in the form:
```
<%= Html.TextBox("UserId")%>
<%= Html.ValidationMessage("UserId") %>
```
If I add the following line in the controller, I will get ... | [
0.11043785512447357,
-0.043578967452049255,
0.7003974914550781,
-0.11645597964525223,
-0.033930130302906036,
-0.17879968881607056,
0.3266804814338684,
-0.3413565158843994,
-0.16672207415103912,
-0.46126601099967957,
0.18971505761146545,
0.6278619766235352,
-0.31241464614868164,
0.047427885... | |
just not familiar enough with binding.
It looks like Im not the only one who has seen this. Per request, here is the controller code:
```
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Create(FormCollection collection)
{
AppUser newUser = new AppUser();
try
{
newUser.Us... | [
0.03218990936875343,
-0.2551771402359009,
0.6619928479194641,
-0.10008403658866882,
-0.18133455514907837,
-0.05274901166558266,
0.4839824140071869,
-0.6535302996635437,
-0.2755545973777771,
-0.4761996269226074,
-0.33222752809524536,
0.414701908826828,
-0.6326061487197876,
0.210861593484878... | |
return RedirectToAction("Index");
}
catch (Exception ex)
{
ViewData["ReturnMessage"] = ex.Message;
ModelState.AddModelError("UserId", "*");
ModelState.SetModelValue("UserId", ValueProvider["UserId"]);
return View(newUser);
}
```
Call thi... | [
-0.17546167969703674,
-0.37478625774383545,
0.7793306708335876,
-0.44266313314437866,
0.10576482117176056,
0.22397731244564056,
0.23204320669174194,
-0.501507043838501,
-0.3154596984386444,
-0.5572332739830017,
-0.41344746947288513,
0.6962868571281433,
-0.43095019459724426,
0.2865026295185... | |
static void AddModelError (this ModelStateDictionary modelState, string key, string errorMessage, string attemptedValue) {
modelState.AddModelError (key, errorMessage);
modelState.SetModelValue (key, new ValueProviderResult (attemptedValue, attemptedValue, null));
}
```
From: [Issues with AddModel... | [
-0.19738413393497467,
-0.11451983451843262,
0.6808350086212158,
-0.24357368052005768,
0.16330063343048096,
0.2198973298072815,
0.5100584626197815,
-0.41006577014923096,
-0.327197790145874,
-0.09213768690824509,
-0.3624470829963684,
0.6054727435112,
-0.45278915762901306,
0.315824955701828,
... | |
I'm looking for a thread pool library in .NET
* I should able to push about 100.000 tasks, therefore should provide support for "blocking" . (*obviously I can't push so many tasks at once, so should support some blocking while adding new tasks, and should block the thread until a new slot is available*)
* Not overly c... | [
0.3924676775932312,
-0.012251276522874832,
0.12985344231128693,
0.12750494480133057,
0.026820525527000427,
-0.18155941367149353,
0.3027668595314026,
0.17934970557689667,
-0.269893616437912,
-0.7865128517150879,
0.23608046770095825,
0.33597031235694885,
-0.16800126433372498,
0.0685589537024... | |
will be mainly used for HTTP Requests, so less CPU more response wait. That means 100 concurrent thread is acceptable.
Thanks for the all replies, after going through other libraries I noticed them all of are quite over-complicated for what I was looking.
I stick with my own implementation which is basically a blockin... | [
0.16676394641399384,
-0.19886116683483124,
0.5061317086219788,
0.26906612515449524,
-0.14989852905273438,
-0.13520678877830505,
0.3104865849018097,
0.07435406744480133,
-0.2776409387588501,
-0.9119206070899963,
0.09391357749700546,
0.30029332637786865,
-0.3309860825538635,
0.18598830699920... | |
Take the example here:
```
public static IEnumerable<BigInt> EvenNumbers(IEnumerable<BigInt> numbers)
{
foreach (BigInt number in numbers)
{
if (number % 2 == 0)
{
yield return number;
}
}
}
```
This will return only | [
-0.3541959822177887,
-0.09999019652605057,
0.35937824845314026,
-0.15252812206745148,
-0.054127052426338196,
-0.13372892141342163,
0.10606984794139862,
-0.19240131974220276,
-0.2914431095123291,
-0.393406480550766,
-0.2818313539028168,
0.541247546672821,
-0.34460318088531494,
0.05985849350... | |
the values which match the criteria (n % 2 == 0). But what is the difference between yield return number; and return number;?
If I say yield return number, will it return each number to the calling function and so on? Where can I find some details on what goes on behind the scenes?
Thanks
"return" simply won't work h... | [
0.07489405572414398,
-0.23279820382595062,
0.16145659983158112,
0.0760904923081398,
-0.0986529216170311,
-0.2453463077545166,
0.3035871684551239,
-0.428838312625885,
0.0388374850153923,
-0.3271369934082031,
-0.02498715929687023,
0.6562309861183167,
-0.18669159710407257,
-0.1354220956563949... | |
is worth it ;-p).
---
edit - here's a **very rough** version of what you would have to do in order to write this yourself; note that it doesn't quite do the same, but achieves the goal. I think you'll agree that the `yield return` version is easier!
```
using System;
using System.Collections;
using System.Collection... | [
0.3151034712791443,
-0.30777695775032043,
0.7818493843078613,
-0.06435980647802353,
0.24423210322856903,
0.11036104708909988,
0.17785410583019257,
-0.48715758323669434,
-0.09459111839532852,
-0.3031410276889801,
0.02063644677400589,
0.902169942855835,
0.031046252697706223,
0.06140779703855... | |
{
Console.WriteLine(value);
}
}
public static IEnumerable<int> EvenNumbers(IEnumerable<int> numbers)
{
return new EvenEnumerable(numbers);
}
class EvenEnumerable : IEnumerable<int>
{
private readonly IEnumerable<int> numbers;
public EvenEnumerable(IEn... | [
-0.45306941866874695,
-0.23403602838516235,
0.41088083386421204,
0.04536116123199463,
0.3512493371963501,
0.17807434499263763,
0.06021953374147415,
0.06033232808113098,
-0.11373846232891083,
-0.5172677636146545,
-0.22725260257720947,
0.5025599002838135,
-0.05946841835975647,
0.017758155241... | |
this.numbers = numbers;
}
public IEnumerator<int> GetEnumerator()
{
return new EvenEnumerator(numbers);
}
IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); }
}
class EvenEnumerator : IEnumerator<int>
{
private readonly IEnumerable<i... | [
-0.49775534868240356,
-0.34027421474456787,
0.13763263821601868,
0.0792984813451767,
0.24091622233390808,
0.2907935678958893,
0.21981272101402283,
-0.05147884786128998,
-0.2979845702648163,
-0.674838125705719,
-0.18394894897937775,
0.3266341984272003,
-0.4066990315914154,
-0.19035692512989... | |
{
this.numbers = numbers;
}
private int current;
void IEnumerator.Reset() { throw new NotSupportedException(); }
public int Current { get { return current; } }
object IEnumerator.Current { get { return Current; } }
IEnumerator<int> iter; | [
0.10169200599193573,
-0.4083842933177948,
0.41986846923828125,
-0.2703079283237457,
0.34348732233047485,
0.08612515777349472,
0.1744615137577057,
-0.24931791424751282,
-0.219828262925148,
-0.36878830194473267,
-0.3216046392917633,
0.5807465314865112,
-0.18022851645946503,
0.317047089338302... | |
public bool MoveNext()
{
if (iter == null) iter = numbers.GetEnumerator();
while (iter.MoveNext())
{
int tmp = iter.Current;
if (tmp % 2 == 0) | [
-0.0868583545088768,
-0.3577004373073578,
0.26967379450798035,
-0.4412131905555725,
0.12766534090042114,
0.14227156341075897,
0.3487328886985779,
-0.337493360042572,
-0.215470552444458,
-0.21982704102993011,
-0.32276517152786255,
0.4190252125263214,
-0.48862582445144653,
0.1796673685312271... | |
{
current = tmp;
return true;
}
}
return false; | [
-0.024775639176368713,
-0.4249584376811981,
0.4815347492694855,
-0.4203892648220062,
0.18744269013404846,
0.24894924461841583,
0.46680203080177307,
0.08174142241477966,
-0.3489425778388977,
0.1608739048242569,
-0.18039973080158234,
0.7330895066261292,
-0.40260812640190125,
0.35510957241058... | |
}
public void Dispose()
{
if (iter != null)
{
iter.Dispose();
iter = null;
} | [
0.25246354937553406,
-0.25927734375,
-0.3405812680721283,
-0.11787661164999008,
0.3242496848106384,
-0.24176350235939026,
0.31698349118232727,
-0.21318474411964417,
-0.1984589546918869,
-0.3714010715484619,
-0.3144363760948181,
0.6078560948371887,
-0.3940586745738983,
0.29554876685142517,
... | |
}
}
}
``` | [
0.033695679157972336,
0.4034728407859802,
0.1949702352285385,
-0.15257494151592255,
0.4299153685569763,
-0.20141436159610748,
0.07711705565452576,
0.4467844069004059,
0.3091506361961365,
-0.5090379118919373,
-0.3048633635044098,
0.5600791573524475,
-0.33611243963241577,
0.3141762912273407,... | |
I want to populate form fields with values from a database immediately after the user enters a value in the #sid field. Here is my jQuery/HTML example:
```
<script src="jquery-1.3.1.min.js"></script>
<script type="text/JavaScript">
$(document).ready(function()
{
$('#sid').bind("change", function(){
$.getJSON("te... | [
0.36279019713401794,
-0.25273004174232483,
0.836935818195343,
-0.09033627808094025,
0.21574094891548157,
0.008617707528173923,
0.16577966511249542,
-0.3997255265712738,
-0.05363059416413307,
-0.6976678967475891,
-0.05157089605927467,
0.20233750343322754,
-0.42035359144210815,
0.17020578682... | |
}
else if (item.field == "sfirst")
{
$("#sfirst").val(item.value);
}
});
});
});
});
</script>
```
Here is my processing script (test.php which gets called by the .getJSON method)
```
<?
require_once("db_pers.inc");
$ssql = "SELECT * FROM contacts_mview WHERE sem... | [
-0.19675172865390778,
-0.18332067131996155,
0.8379240036010742,
-0.24691148102283478,
0.13254569470882416,
0.22323542833328247,
0.3404739499092102,
-0.3450004756450653,
-0.25006720423698425,
-0.46421781182289124,
-0.2951986789703369,
0.517701268196106,
-0.37562069296836853,
0.2932904660701... | |
'value' => $ares['saffil']),
array('field' => 'sfirst',
'value' => $ares['sfirst']));
echo json_encode($json);
?>
```
According to firebug the GET param is passed just fine to test.php and the JSON object comes back just fine:
```
[{"field":"saffil","value":"Admin"},{"field":"sfirst","value... | [
-0.1314021348953247,
-0.048420701175928116,
0.8502099514007568,
0.15284600853919983,
-0.1783033162355423,
0.021359363570809364,
0.8949108123779297,
-0.40023794770240784,
-0.2866124212741852,
-0.4462859630584717,
-0.44647878408432007,
0.7787867784500122,
-0.1108362004160881,
-0.173145011067... | |
much appreciated!
Thanks,
* Nicholas
Nice little injection attack waiting to happen there ;)
Try changing
```
$.each(data.items,
```
to:
```
$.each(data,
```
*Edit*: to answer your comment, I like to name my fields the same as the data key:
```
<input type="text" name="saffil" value="" />
<input type="text" n... | [
0.19143988192081451,
-0.12309250235557556,
0.7860075831413269,
-0.2077805995941162,
-0.11777259409427643,
0.2041149139404297,
0.3099798560142517,
-0.20168161392211914,
-0.193017840385437,
-0.5220648646354675,
-0.4225406050682068,
0.6582692861557007,
-0.5595000982284546,
-0.0165071375668048... | |
I am new to regular expressions.
Is it possible to match everything before a word that meets a certain criteria:
E.g.
THIS IS A TEST - - +++ This is a test
I would like it to encounter a word that begins with an uppercase and the next character is lower case. This constitutes a proper word. I would then like to del... | [
0.1470128446817398,
0.17454589903354645,
0.1982211172580719,
0.033326033502817154,
-0.12498202919960022,
-0.1343620866537094,
0.41999223828315735,
-0.12545378506183624,
0.00905238650739193,
-0.5938485264778137,
-0.11344440281391144,
0.3540029227733612,
-0.12253884971141815,
-0.081995934247... | |
(Unicode, other languages), different strategies apply.
Explanation
```
.*? Everything, until
(?= followed by
[A-Z] one of A .. Z and
[a-z] one of a .. z
)
```
The Java Unicode-enabled variant would be this:
```
^.*?(?=\p{Lu}\p{Ll})
``` | [
-0.20932570099830627,
-0.09184332937002182,
0.15415595471858978,
-0.3168565630912781,
-0.01025072205811739,
0.08336255699396133,
0.10517945140600204,
-0.09340455383062363,
-0.1268208771944046,
-0.5567730069160461,
-0.605329155921936,
0.2841530442237854,
-0.4717237055301666,
-0.291666507720... | |
I have created a dialog box (cMyDialog). I am planning to duplicate cMyDialog and call it cMyDialog2. How can I do inheritance in MFC? I want cMyDialog2 to inherit all the IDDs from cMyDialog1 so that I do not have to copy and paste the code from cMyDialog1 to cMyDialog2. The purpose of cMyDialog2 is to inherit all the... | [
0.2237270176410675,
-0.0809071958065033,
0.27718162536621094,
0.05581849440932274,
-0.2917795479297638,
0.05683451518416405,
0.06559888273477554,
0.07266426831483841,
-0.11618929356336594,
-0.8712370991706848,
0.13231676816940308,
0.2858636975288391,
-0.5745884776115417,
0.1263505965471267... | |
if I misunderstood the macro?
```
// cMyDialog1.cpp : implementation file
cMyDialog1::cMyDialog1(void * pMsgData, CWnd* pParent /*=NULL*/): CDialog(cMyDialog1::IDD, pParent)
{ //codes....
}
BOOL cMyDialog1::OnInitDialog()
{
CDialog::OnInitDialog();
...
}
//cMyDialog2.cpp
cMyDialog2::cMyDialog2(void * pMsgDa... | [
0.19547304511070251,
-0.19513672590255737,
0.4589179456233978,
-0.03528767451643944,
0.5249807834625244,
0.4440174698829651,
0.24381503462791443,
0.02125082165002823,
-0.20456631481647491,
-0.7129239439964294,
-0.21615318953990936,
0.3882879614830017,
-0.4658917784690857,
0.003661702387034... | |
because CMyDialog1 is an inherited dialog from CMyDialog and hence, I can't add in new functions? How can I add new functions in the inherited dialog box?
Yes you can inherit from a CDialog-derived class. You just need to add a few macros like DECLARE\_DYNAMIC and a few others to satisfy MFC. Here is an example. You ca... | [
-0.1954209804534912,
-0.31911128759384155,
0.5236997008323669,
-0.023781999945640564,
0.21271120011806488,
0.004438465926796198,
-0.06314649432897568,
0.06688503175973892,
-0.5083751678466797,
-0.7917237877845764,
-0.3049662411212921,
0.5234959125518799,
-0.5641589760780334,
0.032177165150... | |
self.close() is working fine in IE but not in Mozilla. Does anyone know what is the issue and how can I solve it?
Did you open the window using `window.open`? [According to the docs on window.close](https://developer.mozilla.org/En/DOM/Window.close):
> This method is only allowed to be called for windows that were ope... | [
0.13242408633232117,
0.20618809759616852,
0.3770372271537781,
-0.486842542886734,
-0.24029625952243805,
-0.3945126235485077,
0.62921142578125,
-0.20659464597702026,
0.10411655157804489,
-0.7980594635009766,
0.07327272742986679,
0.9324917197227478,
-0.1997801810503006,
0.11363693326711655,
... | |
How can I match a space character in a PHP regular expression?
I mean like "gavin schulz", the space in between the two words. I am using a regular expression to make sure that I only allow letters, number and a space. But I'm not sure how to find the space. This is what I have right now:
```
$newtag = preg_replace("... | [
0.014536983333528042,
0.3291343152523041,
0.43422168493270874,
0.17687633633613586,
-0.1818183958530426,
0.12019840627908707,
0.10505437850952148,
0.024059075862169266,
0.001423230511136353,
-0.5464893579483032,
-0.10173118859529495,
0.2673405408859253,
-0.20560072362422943,
-0.17261433601... | |
spacing, use `"[ X]"` or `"[ X][ X]*"` or `"[ X]+"` where `X` is the physical tab character (and each is preceded by a single space in all those examples).
These will work in *every*\* regex engine I've ever seen (some of which don't even have the one-or-more `"+"` character, ugh).
If you know you'll be using one of ... | [
-0.0747104212641716,
0.002548953052610159,
0.3030662536621094,
-0.022389473393559456,
-0.3964511752128601,
0.13554517924785614,
0.0031785701867192984,
-0.07518971711397171,
-0.06472871452569962,
-0.49554499983787537,
-0.19925141334533691,
0.22835707664489746,
0.03585811331868172,
-0.188471... | |
specifically, [this page](http://www.wellho.net/regex/php.html) may help.
From your edit, it appears you want to remove all non valid characters The start of this is (note the space inside the regex):
```
$newtag = preg_replace ("/[^a-zA-Z0-9 ]/", "", $tag);
# ^ space here
```
If ... | [
-0.06360139697790146,
0.1417090743780136,
0.4141942262649536,
-0.1700291931629181,
-0.06269855797290802,
0.18501031398773193,
0.3015412390232086,
0.10065178573131561,
-0.020866746082901955,
-0.4879477322101593,
-0.4028725028038025,
0.3753032684326172,
-0.20450682938098907,
-0.1905445307493... | |
question) but the basic idea would be:
```
$newtag = preg_replace ("/ +/", " ", $tag); # convert all multispaces to space
$newtag = preg_replace ("/^ /", "", $tag); # remove space from start
$newtag = preg_replace ("/ $/", "", $tag); # and end
``` | [
-0.10296037793159485,
0.04064221307635307,
0.2635018825531006,
-0.10880737006664276,
0.00017368412227369845,
0.19980348646640778,
0.08087176084518433,
-0.4149676263332367,
-0.07774396985769272,
-0.5904427766799927,
-0.6100661754608154,
0.4094260632991791,
-0.36602893471717834,
-0.157273113... | |
Afternoon,
Lets say I have gather a random selection of users:
User.find(:all, :limit => 10, :order => "rand()")
Now from these results, I want to see if the user with the ID of 3 was included in the results, what would be the best way of finding this out?
I thought about Array.include? but that seems to be a dead ... | [
0.07108654826879501,
0.09663703292608261,
0.2208186388015747,
0.014973287470638752,
-0.08297532051801682,
0.02517019398510456,
-0.01574232243001461,
-0.3782654106616974,
-0.425739049911499,
-0.6475182175636292,
-0.0010935903992503881,
0.6484025120735168,
-0.28377237915992737,
-0.0218613836... | |
When you long press on something in Android, a context menu comes up. I want to add something to this context menu for all `TextViews` in the system.
For example, the system does this with Copy and Paste. I would want to add my own, and have it appear in every application.
Currently Android does not support this, you... | [
0.40018293261528015,
0.1432824432849884,
0.5340122580528259,
-0.1591864973306656,
0.10206172615289688,
0.12212324142456055,
0.01831759512424469,
-0.15141135454177856,
0.00028139102505519986,
-0.5164330005645752,
-0.08858317881822586,
1.0096104145050049,
-0.4145871102809906,
-0.025466142222... | |
the base system applications and obviously all applications prior to yours would not be without updating the app to consume.
Basically as it stands, this is not possible.
What exactly are you trying to accomplish with this global context menu, some sort of global "Search For" or "Send To" functionality that runs thro... | [
0.25385549664497375,
0.052289243787527084,
0.2368575781583786,
0.36070501804351807,
0.15918275713920593,
-0.12730306386947632,
0.21729205548763275,
0.2436555176973343,
-0.29650646448135376,
-0.46849748492240906,
0.06028193235397339,
0.6267833709716797,
-0.4272457957267761,
0.23641656339168... | |
Is there any easy LINQ expression to concatenate my entire `List<string>` collection items to a single `string` with a delimiter character?
What if the collection is of custom objects instead of `string`? Imagine I need to concatenate on `object.Name`.
Warning - Serious Performance Issues
-----------------------------... | [
-0.10946281254291534,
0.1417696624994278,
0.42274853587150574,
-0.030710330232977867,
0.12366978824138641,
0.004884738475084305,
0.13377313315868378,
-0.3539595603942871,
-0.1656036376953125,
-0.1703995317220688,
-0.32690733671188354,
0.6295931935310364,
-0.35751408338546753,
-0.1112169027... | |
Boo { get; set; }
}
```
Usage:
```
class Program
{
static void Main(string[] args)
{
string delimiter = ",";
List<Foo> items = new List<Foo>() { new Foo { Boo = "ABC" }, new Foo { Boo = "DEF" },
new Foo { Boo = "GHI" }, new Foo { Boo = "JKL" } };
Console.WriteLine(items.A... | [
-0.06185135245323181,
-0.008728518150746822,
0.4289790689945221,
-0.415258526802063,
0.032047338783741,
0.16593943536281586,
0.3553292751312256,
-0.32303130626678467,
-0.18894144892692566,
-0.521331787109375,
-0.5320523381233215,
0.6780306100845337,
-0.6018497943878174,
0.31758174300193787... | |
Console.ReadKey();
}
}
```
And here is my best :)
```
items.Select(i => i.Boo).Aggregate((i, j) => i + delimiter + j)
``` | [
-0.46765419840812683,
-0.00433943560346961,
0.43277665972709656,
-0.1470412313938141,
0.2040969431400299,
0.1108773946762085,
0.12356214225292206,
-0.20241917669773102,
0.13584044575691223,
-0.9416189789772034,
-0.028188122436404228,
0.8273524641990662,
-0.14380185306072235,
0.045033697038... | |
Stylecop is telling me to use /// instead of // when I´m commenting. What is the semantic difference for those two and when should I use which one?
// denotes your own personal comments, where /// denote comments that can contain special data, e.g. markup for interpretation by Visual Studio - like:
```
/// <summary>
/... | [
0.7062365412712097,
0.05358507111668587,
0.3342338800430298,
-0.1347998082637787,
-0.2811456024646759,
-0.23224636912345886,
-0.14932850003242493,
0.03845060244202614,
-0.2975078821182251,
-0.6057685017585754,
0.28942617774009705,
0.7476643919944763,
-0.1599997878074646,
-0.173457786440849... | |
I have a method to add an XML node structure to the currently selected tree node.
This appends the xml, and opens the parent node to display the newly added node.
I then select the node by setting the selectedItem of the tree.
I have an editing form that updates its values on the tree change event. When I set the ... | [
-0.14097262918949127,
0.06504366546869278,
0.5399665832519531,
0.08900436013936996,
-0.0021270911674946547,
0.08820096403360367,
0.09716439992189407,
-0.38396644592285156,
0.12362144887447357,
-0.5477750897407532,
0.023923374712467194,
0.17345362901687622,
-0.2017924040555954,
0.0580973736... | |
the tree to dispatch a change event at this point?
```
public function addSelected(node:XML):void{
tree_expandItem(false);
var selectedItem:XML = tree.selectedItem as XML;
selectedItem.appendChild(node);
tree_expandItem(true);
callLater(func... | [
-0.142691969871521,
-0.3096473217010498,
0.40358617901802063,
-0.14132551848888397,
0.24806229770183563,
0.1541668027639389,
-0.024854421615600586,
-0.30478304624557495,
-0.3429737687110901,
-0.5503817200660706,
-0.4381280541419983,
0.3387148976325989,
-0.5559167861938477,
0.15647190809249... | |
}
```
To extend this question in a general sort of way - I would have thought that changing the selectedItem of the tree would result in a change event anyway? Or is a change only considered a change if the user makes it?
You could move the logic that is currently in your change event handler to a separate function, ... | [
0.1075286716222763,
-0.12170711159706116,
0.41054201126098633,
-0.2437693029642105,
0.4451456367969513,
-0.027413617819547653,
-0.11934109777212143,
-0.4787164628505707,
-0.17521540820598602,
-0.4183087944984436,
-0.42236027121543884,
0.5936978459358215,
-0.591934323310852,
-0.037760578095... | |
var selectedItem:XML = tree.selectedItem as XML;
selectedItem.appendChild(node);
tree_expandItem(true);
callLater(function():void { tree.selectedItem = node; } );
doChangeLogic();
}
``` | [
-0.15669980645179749,
-0.3605732023715973,
0.18930628895759583,
-0.07334042340517044,
0.3037490248680115,
0.27899599075317383,
0.10675860196352005,
-0.4046511948108673,
-0.19471490383148193,
-0.3650236427783966,
-0.4722529649734497,
0.3191806674003601,
-0.3567616641521454,
0.24850119650363... | |
Every time I download SQLite, I come across the fact that they provide several different versions of their source code, which is something I've actually never seen any other project do. And more so they provide Amalgamations of Source, that kind of merge all their files into just 3 files. What's the reason for this? Is... | [
0.3764567971229553,
0.446835994720459,
-0.059042006731033325,
0.19147245585918427,
-0.020217351615428925,
-0.043967701494693756,
0.04341607913374901,
-0.023599645122885704,
-0.6129510998725891,
-0.6036684513092041,
0.3305901885032654,
-0.03993937000632286,
-0.41855835914611816,
0.372426718... | |
run faster. Many compilers are able to do additional optimizations on code when it is contained with in a single translation unit such as it is in the amalgamation. We have measured performance improvements of between 5 and 10% when we use the amalgamation to compile SQLite rather than individual source files. The down... | [
0.3346334993839264,
0.2649536430835724,
0.11878262460231781,
0.20276303589344025,
-0.11054770648479462,
0.08785908669233322,
0.5057438015937805,
-0.06642281264066696,
-0.22683434188365936,
-0.6420341730117798,
0.01887895166873932,
0.5798718929290771,
-0.349622905254364,
-0.2223048210144043... | |
build script mess and whatever else follows from having a large collection of source files. | [
0.7215169668197632,
0.6279217600822449,
-0.055207155644893646,
0.1499272584915161,
0.0582188181579113,
-0.09739173948764801,
0.11874134838581085,
0.10490032285451889,
0.18735533952713013,
-0.7346781492233276,
-0.1702735871076584,
0.4959370791912079,
0.1085163950920105,
0.08995512872934341,... | |
### The App
I need to implement a web app that will be used by different users. Each user has different privileges on various tables, e.g.
- User A can see fields 'name' and 'address' from the table `Student`
- User B can see fields 'name' and 'phone number', but not 'address' from the table `Student`
- User C can... | [
0.224909245967865,
0.216972216963768,
0.7714740037918091,
0.1298801302909851,
-0.1676918864250183,
-0.012499911710619926,
0.0432543084025383,
-0.09404727816581726,
-0.10158989578485489,
-0.5402005910873413,
-0.2917347550392151,
0.4473327398300171,
-0.5131935477256775,
-0.2544146478176117,
... | |
(at a database level maybe?) just to ensure data security.
---
### The Problem
I am using Hibernate, JBoss, DB2 and Struts for my app. I think I should use a JBoss LoginModule of some sort, which authenticates the user against a database with user/password/roles (but I may be wrong(?)). I have done some research an... | [
0.2929290235042572,
0.25508543848991394,
0.3309333026409149,
0.23268237709999084,
-0.2966559827327728,
-0.1939651221036911,
0.4229695200920105,
0.0943966656923294,
-0.15154750645160675,
-0.6485348343849182,
0.032671838998794556,
0.4932631254196167,
-0.17987558245658875,
0.04417959600687027... | |
`hibernate.cfg.xml` with JACC event listeners. This can set "insert" "update" "read" permissions on all hibernate entities. However, what if I need finer controls? I need to set permissions on certain fields instead of the entire object. <http://www.hibernate.org/hib_docs/v3/reference/en-US/html/objectstate-decl-securi... | [
0.22083832323551178,
0.09681788086891174,
0.6095328330993652,
-0.19420258700847626,
-0.3407624363899231,
-0.45580393075942993,
0.547521710395813,
-0.6325732469558716,
-0.05519988760352135,
-0.5545558929443359,
-0.3278760015964508,
0.45995962619781494,
-0.3806684613227844,
-0.07805703580379... | |
logged in user can perform the action or not.
4. Use 'interceptor' and 'events' in Hibernate. Define specific "onLoad", "onSaveorUpdate" etc. events and interceptors for each class. Can I specify permission level for individual fields in this case? <http://www.hibernate.org/hib_docs/v3/reference/en-US/html/objectstate-... | [
0.2891761064529419,
-0.25781574845314026,
0.5205569863319397,
0.15946784615516663,
-0.23783162236213684,
-0.2965126037597656,
0.4028080999851227,
-0.34130391478538513,
-0.14661598205566406,
-0.4749937951564789,
-0.0787285640835762,
0.6929042935371399,
-0.44832056760787964,
-0.3467375040054... | |
Add a security key to your entities, create a table for permissions and link user with permission with entitytype and also with security key with role. This way you can say things like: Admin\_role can access Student (Entitiy type) and do read (Operation in Permission) and Write (Operation) while Student\_role can acce... | [
0.050078198313713074,
0.016315557062625885,
0.474412202835083,
0.3021268844604492,
0.16234102845191956,
-0.08899983763694763,
-0.16653268039226532,
-0.31333938241004944,
-0.07514696568250656,
-0.5230584144592285,
-0.1899864822626114,
0.3760135769844055,
-0.1897672712802887,
0.3902056515216... | |
a flag in a dictionary (entity+property)-hash to flag, the closed world-assumption being that reads are not allowed by default. Then of course you don't get any writes-permissions etc.
3. You can define views in your database and assign rights to them using the database authentication system. This is probably the most... | [
0.2062082439661026,
-0.025914082303643227,
0.14676296710968018,
0.0484071783721447,
-0.20168213546276093,
-0.33721455931663513,
0.51226806640625,
0.09837193787097931,
0.004731651395559311,
-0.5576077699661255,
0.014240062795579433,
0.4767283499240875,
-0.02626073732972145,
0.08324240148067... | |
depends on how movable/portable your code needs to be, I guess.
4. Use an aspect around your generic dao (IRepository) which rewrites the queries based on your permissions; this implies you have the permission-based security in code of course.
The edit-button hiding in the gui can really only be done if you first por... | [
0.3199796676635742,
0.16796256601810455,
0.12433706223964691,
0.26524969935417175,
0.09183407574892044,
-0.38244420289993286,
0.26314690709114075,
-0.19991138577461243,
-0.10203427821397781,
-0.5092949867248535,
-0.09661378711462021,
0.7635020017623901,
-0.026954075321555138,
-0.1280682086... | |
Consider the following `main()` method which you would find most iPhone applications:
```
int main(int argc, char *argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, nil);
[pool release];
return retVal;
}
```
In every iPhone app that I... | [
0.14037078619003296,
-0.047519031912088394,
0.40363216400146484,
-0.09370654076337814,
0.21943266689777374,
-0.016122838482260704,
0.6013668179512024,
-0.14418518543243408,
-0.30014604330062866,
-0.30272066593170166,
-0.21092067658901215,
0.7523214221000671,
-0.3720182776451111,
0.00796993... | |
stops an application (by hitting the "Home" button, for example), the resulting stack trace shows that `[UIApplication _terminateWithStatus:]` is eventually called. This function calls your application delegate's `applicationWillTerminate:` method. Once that finishes, `[UIApplication _terminateWithStatus:]` seems to ki... | [
0.07522788643836975,
0.07940879464149475,
0.41291794180870056,
-0.1613273173570633,
0.45204639434814453,
-0.00934532843530178,
0.5669919848442078,
-0.03405974432826042,
-0.13095374405384064,
-0.08726076036691666,
-0.547387957572937,
0.19170227646827698,
-0.3102854788303375,
0.1825052350759... | |
do the same tests, I have confirmed that UIApplicationMain never returns. When the user terminates an application normally by hitting the Home button, The program ultimately terminates inside an unpublished UIApplication method called \_terminateWithStatus. This method calls exit(0).
This behavior matches that of the ... | [
-0.0547211654484272,
0.24362526834011078,
0.5531927943229675,
-0.21805495023727417,
0.3764260411262512,
-0.12368261814117432,
0.8377572894096375,
0.21655598282814026,
0.005586619954556227,
-0.5004746317863464,
-0.40577268600463867,
0.3684726357460022,
-0.23484840989112854,
0.61030787229537... | |
docs are misleading.
***Thanks to everyone for all the input and brainstorming!*** | [
0.5393441319465637,
0.5533890128135681,
0.44058865308761597,
0.19204269349575043,
-0.10141541063785553,
-0.3416071832180023,
0.41717302799224854,
0.2338402420282364,
-0.16063426434993744,
-0.9204109311103821,
-0.15577584505081177,
0.8635177612304688,
0.460839182138443,
0.06735064834356308,... | |
I hope this isn't a duplicate...
What is the most solidly designed and implemented software system/framework/application that you've come across?
It seems like TDD, SOLID principles, OO design patterns, and things like that can be easily theorized on podcasts and blogs using really simple examples, but it's hard to i... | [
0.6059218645095825,
0.3029133379459381,
-0.21286988258361816,
0.3659559488296509,
0.05514562502503395,
-0.1893381029367447,
0.32967329025268555,
0.25991734862327576,
-0.3677087724208832,
-0.46899139881134033,
0.03131948411464691,
0.4968401789665222,
0.0851547122001648,
0.07673719525337219,... | |
like. Thanks.
The **Space Shuttle** software?
[They Write the Right Stuff](http://www.fastcompany.com/magazine/06/writestuff.html)
> But how much work the software does is
> not what makes it remarkable. What
> makes it remarkable is how well the
> software works. This software never
> crashes. It never needs to ... | [
0.4066679775714874,
0.4255252182483673,
-0.10403066873550415,
0.5203481912612915,
0.028225664049386978,
0.011972987093031406,
0.5123006701469421,
0.32541194558143616,
-0.2803991436958313,
-0.6949202418327332,
-0.25216174125671387,
0.26215994358062744,
-0.0809665247797966,
-0.08093027025461... | |
errors. Commercial programs of
> equivalent complexity would have 5,000
> errors. | [
0.15978792309761047,
0.6285544037818909,
-0.078583262860775,
0.35433754324913025,
0.057513024657964706,
0.29979100823402405,
0.3395852744579315,
0.058312855660915375,
-0.1720583736896515,
-0.8783575296401978,
-0.1453086882829666,
0.5466364622116089,
-0.4703831374645233,
-0.0804678052663803... | |
**Background**
I have an abstract class, something like
```
class IConverter{
public:
virtual void DoConvertion() = 0;
};
```
There will be many concrete classes which just implements *DoConvertion* method.
```
class TextConverter : public IConverter{
public:
virtual void DoConvertion(){
/... | [
0.27933409810066223,
-0.03258445858955383,
0.6098200678825378,
-0.13184131681919098,
0.08726474642753601,
0.32973286509513855,
0.10030696541070938,
0.09086454659700394,
-0.3898806869983673,
-0.9083693027496338,
0.14149919152259827,
0.869335412979126,
-0.5499411821365356,
-0.296614348888397... | |
this. I have created a header file say, *CharacterConverter.h* which has the abstract class *IConverter*.
**Question**
Since my concrete classes just implement the *DoConvertion* method, is it required to create separate header files for each concrete class? I mean is it required to create *ImageConverter.h*, *TextCo... | [
0.7349877953529358,
0.02141539566218853,
0.10812191665172577,
0.030464638024568558,
-0.14642030000686646,
0.14598649740219116,
-0.06636977195739746,
0.13204939663410187,
-0.3824026882648468,
-0.6908119916915894,
0.2630194127559662,
0.5247074365615845,
-0.4570039212703705,
-0.17565560340881... | |
constructs the appropriate subclass and returns it as an IConverter\*. With this, you can expose only the abstract definition in the header file, and have all the concrete class definitions and implementations in a single .cpp file along with the super class implementation. This gets a bit unwieldy if your subclass are... | [
0.05376659706234932,
-0.10563565045595169,
0.24074430763721466,
0.22390179336071014,
-0.07433140277862549,
0.11816471815109253,
0.30811649560928345,
-0.31204360723495483,
-0.33856523036956787,
-0.7690948843955994,
-0.23401452600955963,
0.41787517070770264,
-0.23799480497837067,
0.001776585... | |
increase dependency analysis. But there's no requirement that every header file have a matching cpp and vice verse.
Based on the comments, I'd recommend a structure like this:
IConverter.h ==> definition of IConverter
Converters.h ==> definitions of all subclasses
IConverter.cpp ==> include IConverter.h and Con... | [
0.42338213324546814,
-0.036013804376125336,
0.5924345850944519,
-0.004481217823922634,
-0.3340761661529541,
0.1277185082435608,
-0.031468670815229416,
-0.19527040421962738,
-0.5077962875366211,
-0.6816495656967163,
-0.06236493960022926,
0.41028475761413574,
-0.5791223645210266,
-0.02206632... | |
allows you to consolidate if they're all basically the same. Separate cpp files allow you to take advantage of the compiler benefits mentioned by Brian. You could inline the subclass definitions in header files as mentioned, but that doesn't really buy you anything. Your compiler is usually smarter than you are when it... | [
0.15810087323188782,
-0.055055171251297,
-0.25812700390815735,
0.45474711060523987,
-0.05547310411930084,
-0.052865348756313324,
0.08968149870634079,
0.15524893999099731,
-0.44495800137519836,
-0.44875916838645935,
0.26091304421424866,
0.5468697547912598,
-0.11545760929584503,
-0.253795027... | |
Let's say I have a function that accepts a `void (*)(void*)` function pointer for use as a callback:
```
void do_stuff(void (*callback_fp)(void*), void* callback_arg);
```
Now, if I have a function like this:
```
void my_callback_function(struct my_struct* arg);
```
Can I do this safely?
```
do_stuff((void (*)(v... | [
0.21180486679077148,
0.19349895417690277,
0.27847355604171753,
-0.12860234081745148,
0.25909751653671265,
-0.425857275724411,
0.22850868105888367,
-0.30449268221855164,
-0.05407239869236946,
-0.2679402232170105,
-0.2745392620563507,
0.6522440314292908,
-0.28536519408226013,
0.1257702410221... | |
See Annex J.2 (informative):
> The behavior is undefined in the following circumstances:
>
>
> * A pointer is used to call a function whose type is not compatible with the pointed-to
> type (6.3.2.3).
Section 6.3.2.3, paragraph 8 reads:
> A pointer to a function of one type may be converted to a pointer to a fun... | [
-0.10271434485912323,
0.09245605021715164,
0.45817798376083374,
-0.04093960300087929,
-0.05810686573386192,
-0.009671165607869625,
0.15934498608112335,
-0.4409954249858856,
0.033090777695178986,
-0.5132349729537964,
-0.21378104388713837,
0.6310005187988281,
-0.5266004800796509,
0.074710331... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.