text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
with each other. UITableView scrollers take precednce so whenever a scroll operation is performed, the action is sent to UITableView instead of UIWebView.
For some reason, when using UITextView with UITableView, scrollers work for both. | [
0.01294828113168478,
-0.3790135085582733,
0.6820006966590881,
0.14913441240787506,
-0.28637388348579407,
-0.0752619057893753,
0.13461947441101074,
-0.19046849012374878,
0.10947050899267197,
-0.803725004196167,
-0.19592471420764923,
0.6249026656150818,
-0.2618502676486969,
0.285580128431320... | |
How would I refactor this to get it to return a string not a dataset?
```
[WebMethod]
public DataSet GetPONumber(string Database)
{
SqlConnection sqlConn = new SqlConnection();
sqlConn.ConnectionString = GetConnString(Database);
// build query
string strSQL = @" A SELECT QUERY!!!!! ";
SqlDataAd... | [
-0.056707631796598434,
-0.2712719440460205,
0.4410508871078491,
0.20706748962402344,
0.08708207309246063,
-0.04411075636744499,
0.31018197536468506,
-0.48675045371055603,
-0.3505293130874634,
-0.6417355537414551,
-0.34466904401779175,
0.43422558903694153,
-0.39048200845718384,
0.1912951767... | |
{
//Create Object ready for Value
object po = "";
//Set Connection
SqlConnection Connection = new SqlConnection(GetConnString(Database));
//Open Connection
Connection.Open();
//Set Query to string
string Query = @" SQL QUERY GOES HERE!!!! ";
... | [
-0.17092564702033997,
-0.2324424684047699,
0.6042240858078003,
0.021614957600831985,
0.06234177201986313,
-0.017482174560427666,
0.07258129119873047,
-0.1640608310699463,
-0.28047171235084534,
-0.4031890332698822,
-0.3139435648918152,
0.32031315565109253,
-0.5849089026451111,
0.42099934816... | |
Query
SqlCommand Command = new SqlCommand(Query, Connection);
//Set Value from Query
try
{
po = Command.ExecuteScalar();
}
catch
{
//Error
} | [
-0.2195117324590683,
-0.38110414147377014,
0.2275267392396927,
-0.05888517200946808,
0.05891230329871178,
0.26558202505111694,
0.03666410967707634,
-0.4202495813369751,
-0.010753408074378967,
-0.29827889800071716,
0.007810759823769331,
0.3272024691104889,
-0.38430458307266235,
0.0386070981... | |
//Clean up sql
Command.Dispose();
Command = null;
//Clean up connection
Connection.Close();
Connection.Dispose();
Connection = null;
//Return Value
return po.ToString();
}
``` | [
0.1976204216480255,
0.10453478991985321,
0.44082772731781006,
-0.23984183371067047,
0.17479845881462097,
-0.13413098454475403,
0.24435743689537048,
-0.3560637831687927,
-0.27028313279151917,
-0.5275164246559143,
-0.3138214647769928,
0.4817374646663666,
-0.2514781057834625,
0.56329202651977... | |
My VB.NET application compiles, installs and works fine on the development PC.
However, when I take the install package elsewhere, it installs ok but crashes before any code is executed.
The error is " has encountered a problem and needs to close..."
I have removed all references to external files e.g. icon files et... | [
0.5132384300231934,
0.20786815881729126,
0.6731851100921631,
-0.11022931337356567,
-0.28391891717910767,
-0.20273631811141968,
0.7328245639801025,
0.04238082841038704,
-0.13297326862812042,
-0.8752108216285706,
-0.0270282831043005,
0.9659438133239746,
-0.4006638526916504,
0.226728200912475... | |
can look in the Event Log (start with "eventvwr" in the Run box) for more information. | [
0.442939430475235,
-0.2847273051738739,
-0.15162165462970734,
0.02186724543571472,
0.17911362648010254,
-0.5109333992004395,
0.39156073331832886,
0.21609245240688324,
-0.33709830045700073,
-0.14429207146167755,
-0.0975000262260437,
0.6705161929130554,
0.043585680425167084,
-0.1434048414230... | |
I have a map for my game, I have a script that on a click displays an alert of the mouse coordinates on the map.
The map scale is 1 map unit to 2.5 pixels and the map starts at -600, 600 and goes down to 600, 1700. Thus I can't simply throw out the pixels of the mouse.
I got it working (and was pretty happy about it)... | [
0.22978860139846802,
-0.05053392052650452,
0.9086751937866211,
-0.07777231931686401,
-0.15197741985321045,
0.12680141627788544,
0.26559770107269287,
-0.2581825852394104,
0.1475469321012497,
-1.1130495071411133,
0.42317888140678406,
0.5277636647224426,
0.12214365601539612,
0.229224428534507... | |
<http://woarl.com/map/ieMap.html>
```
tempX = event.clientX + document.body.scrollLeft;
tempY = event.clientY + document.body.scrollTop;
```
Thanks for any help
Try:
```
tempX = event.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft);
tempY = event.clientY + (document.documentElement.scrol... | [
0.06415029615163803,
-0.10809749364852905,
0.6064717769622803,
-0.03348689153790474,
-0.3280864655971527,
-0.1739855408668518,
0.18974651396274567,
-0.25093087553977966,
-0.23545943200588226,
-0.928706169128418,
-0.3631015717983246,
0.6916875243186951,
0.02552366815507412,
-0.1637066453695... | |
I'm using C# and have a windows form containing a property grid control.
I have assigned the SelectedObject of the propertygrid to a settings file, which displays and lets me edit the settings. However one of the settings is a password - and I'd like it to display asterisks in the field rather than the plain text val... | [
0.1944734752178192,
0.13281144201755524,
0.37691596150398254,
0.06890297681093216,
-0.0009824854787439108,
-0.12868522107601166,
0.058131974190473557,
-0.1947222799062729,
0.09156367927789688,
-0.6066650152206421,
-0.016559965908527374,
0.5576314330101013,
0.04797280207276344,
0.1616485714... | |
applied to the setting property to mark it as being a password?
Thanks.
Starting with .Net 2, you can use the [PasswordPropertyTextAttribute](http://msdn.microsoft.com/en-us/library/system.componentmodel.passwordpropertytextattribute.aspx) attached to your password property.
Hope this helps. | [
0.15473587810993195,
-0.12894576787948608,
0.4683545231819153,
0.10736438632011414,
0.06201663985848427,
-0.49761152267456055,
0.29411041736602783,
0.2603062093257904,
-0.2549743056297302,
-0.6912586092948914,
-0.276365727186203,
0.6676007509231567,
-0.08226955682039261,
0.0220241416245698... | |
In my Computer Science II class, the professor considers ++,--,\*=, etc. to be 2 operations. However, at the Assembly level this is not really two operations. Can someone explain or is this just for the sake of simplicity?
I'd actually consider it to be 3 operations: read, increment (or whatever), write. That's assumin... | [
-0.071382075548172,
0.028942590579390526,
0.032050102949142456,
-0.05421506613492966,
0.11107588559389114,
0.16401110589504242,
0.2345866858959198,
-0.06805317103862762,
-0.2634619176387787,
-0.6145709156990051,
-0.16013465821743011,
0.46429771184921265,
-0.23832696676254272,
-0.0060461345... | |
Typically, when I use lambdas, I just use "a, b, c, d..." as variable names as the types are easily inferred, and I find short names to be easier to read. Here is an example:
```
var someEnumerable = GetSomeEnumerable();
var somethingElseList = someEnumerable.Select(a => a.SomeProperty)
... | [
0.25299715995788574,
-0.3357453942298889,
-0.0384102500975132,
-0.2945052981376648,
-0.0332387238740921,
0.1304432451725006,
0.24334818124771118,
0.0036010700277984142,
-0.3014318645000458,
-0.3462837040424347,
-0.2206096053123474,
0.5825037956237793,
0.029243826866149902,
0.18087986111640... | |
a => a);
```
Some question this naming, and would prefer to see long typed out names, like this:
```
var someEnumerable = GetSomeEnumerable();
var somethingElseList = someEnumerable.Select(importantObj => importantObj.SomeProperty) | [
-0.17821940779685974,
-0.14183878898620605,
0.06482571363449097,
-0.3737699091434479,
-0.16569438576698303,
0.05369146168231964,
0.2948981821537018,
0.10056012123823166,
-0.22391486167907715,
-0.3228323757648468,
-0.23271548748016357,
0.32124486565589905,
-0.07439690083265305,
0.1028337180... | |
.OrderBy(objsInfo => objsInfo.SomePropertyField);
var someDictionary = somethingElseList.ToDictionary(theInfoId => new SomeClass(theInfoId.Prop1),
theInfoId2 => theInfoId2);
```
Since the scope is so narrow (between the parens), unless you're getting stupid and nest... | [
0.07691837102174759,
-0.06514174491167068,
0.21081283688545227,
-0.2924623191356659,
0.04636741057038307,
-0.011951816268265247,
0.48752832412719727,
0.05184061452746391,
-0.3131944239139557,
-0.6654484272003174,
-0.2645777463912964,
0.17348100244998932,
-0.16676947474479675,
0.27525007724... | |
what is the general consensus on Lambda variable names? To short name, or not to short name?
The way I usualy do it depends on the collection you're enumerating over. If the name of the collection implies what type the lambda parameter will be, then I just go with the single letter, however if the collection isn't as d... | [
0.22505466639995575,
0.03337478265166283,
0.34146708250045776,
-0.03447432070970535,
-0.22760547697544098,
0.04633157700300217,
-0.2523731291294098,
0.10486874729394913,
-0.2787722647190094,
-0.21734817326068878,
-0.2876475751399994,
0.36089444160461426,
-0.16301150619983673,
0.40024912357... | |
We have a collection of C# (.NET 2.0) applications that have custom dialog windows. When the user changes the default font size and resolution etc in Windows the edges of the form lose controls (they get pushed off the visible portion of the form) typically dropping off buttons from the bottom. This is problematic for ... | [
0.47819891571998596,
0.026355043053627014,
0.4368973672389984,
0.14684127271175385,
-0.05337928608059883,
0.042616602033376694,
0.10247334837913513,
-0.19683174788951874,
-0.1926569789648056,
-0.5447530150413513,
0.3239603042602539,
0.5086270570755005,
-0.5112777948379517,
-0.1167059019207... | |
entire application to be able to adjust itself with the Windows appearance changes?
WinForms have the AutoScaleMode property, which can be set to either Font, DPI, Inherit, or None. The default is "Font" which, in my experience, doesn't always scale things right. You might try one of the other options (maybe "None" if ... | [
-0.05956908315420151,
-0.2605404853820801,
0.39057645201683044,
-0.0025338875129818916,
0.13174857199192047,
0.023508738726377487,
0.15261662006378174,
-0.06950369477272034,
-0.1068354994058609,
-0.9160861968994141,
-0.11543579399585724,
0.7309282422065735,
-0.24333816766738892,
-0.0623549... | |
For my asp.net web applications against sql server(at least the ones that require a logon to access) I generally implement security as follows:
I generally roll my own user signup, user login pages and keep a userid and an encrypted password in an sql server and validate the login against that table - I also provide f... | [
0.28804999589920044,
0.2855331599712372,
0.3431894779205322,
-0.007672264706343412,
0.002384363440796733,
-0.16298629343509674,
0.29322290420532227,
-0.19013534486293793,
-0.3760867416858673,
-0.4588252604007721,
-0.12444159388542175,
0.6513623595237732,
-0.14229226112365723,
-0.1216333806... | |
talk to sql server, so in other words I only need to create a single logon id per application, and since 100% of all data access is done thru stored procedures, I need only grant access to a single user to execute stored procedures, and no other work is required on sql server. Each application has its own database, and... | [
0.7033202648162842,
0.3250158429145813,
0.4682486057281494,
0.29589349031448364,
0.00467081880196929,
-0.2205311805009842,
0.1488351821899414,
0.04499070718884468,
-0.28003764152526855,
-0.586388349533081,
0.1368093490600586,
0.4661017954349518,
-0.23969610035419464,
-0.08834101259708405,
... | |
userid and the procs that are being called, but since all users are 'talking' to the database thru a single database logon, this can't happen.
So, two part question:
1) Are there security models are you folks using that I should consider? Its easy to always do the same thing over and over, - especially since it works... | [
0.1831868588924408,
-0.00084541121032089,
0.3901995122432709,
0.26628032326698303,
0.06305524706840515,
-0.33456361293792725,
0.05972667038440704,
-0.03171753138303757,
-0.258159875869751,
-0.7552239894866943,
0.17350679636001587,
0.5841389298439026,
-0.3440069556236267,
-0.142539069056510... | |
Assuming I stick with my model, is there a way to allow for the application login id to be seen in the sql trace window? It would be nice to see the sp's being called and the user id of the person logged into the system (not the database login).
> Is it recommended practice that all
> database access from an asp.net a... | [
0.3771630525588989,
0.01784592494368553,
0.3168276846408844,
0.1558564007282257,
0.015978582203388214,
-0.4257471561431885,
0.2166643887758255,
-0.05451807752251625,
-0.46937838196754456,
-0.6377332210540771,
0.06116744503378868,
0.5515869855880737,
-0.22591134905815125,
-0.103968732059001... | |
What is the best way to convert a JSON code as this:
```
{
"data" :
{
"field1" : "value1",
"field2" : "value2"
}
}
```
in a Java Map in which one the keys are (field1, field2) and the values for those fields are (value1, value2).
Any ideas? Should I use Json-lib for that? Or better i... | [
-0.2646172344684601,
0.08527912199497223,
-0.09345244616270065,
-0.04545649513602257,
-0.04625728353857994,
-0.09963151812553406,
0.041658975183963776,
-0.051081590354442596,
-0.1423284262418747,
-0.7720399498939514,
-0.10872849822044373,
0.4689997136592865,
-0.35627609491348267,
-0.405661... | |
from <http://json.org> (section java) would work.
For one of them (Jackson <https://github.com/FasterXML/jackson-databind/#5-minute-tutorial-streaming-parser-generator>), you'd do:
```
Map<String,Object> result =
new ObjectMapper().readValue(JSON_SOURCE, HashMap.class);
```
(where JSON\_SOURCE is a File, inp... | [
-0.1868358999490738,
-0.3112000524997711,
0.12173736095428467,
-0.03194856271147728,
-0.10772199183702469,
0.01225742045789957,
0.014466444961726665,
-0.2919694185256958,
-0.19199351966381073,
-0.7901684641838074,
-0.39731740951538086,
0.21552850306034088,
-0.27996203303337097,
0.010193772... | |
I just finished listening to a very [eye-opening podcast on Hanselminutes](http://www.hanselminutes.com/default.aspx?ShowID=137) about the definition of "Done". So my question to everyone is "When do you consider a piece of software to be "Done"? Is it when it's fully unit tested? Is it when it's completely documented?... | [
0.9112810492515564,
0.20854076743125916,
0.16199137270450592,
0.022443220019340515,
0.1872216910123825,
-0.251736581325531,
0.020900070667266846,
-0.15960125625133514,
-0.1803128719329834,
-0.1724027842283249,
-0.01616314798593521,
0.44261986017227173,
0.4114479720592499,
0.129177182912826... | |
done.
If you don't know where you're going, how will you know when you get there? | [
0.6313252449035645,
0.18987655639648438,
0.24790991842746735,
0.09738127887248993,
0.41354721784591675,
-0.40002065896987915,
0.30612435936927795,
0.10628315806388855,
-0.03011639416217804,
0.029679831117391586,
0.0670652836561203,
0.08718015253543854,
0.3444839417934418,
0.011358674615621... | |
I am running a machine with SunOS and NO graphical enviroment. Does someone know how to change the keyboard layout from the console??
Thanks
Select your layout
==================
Type the following command to select your layout from a list:
```
kbd -s
```
If your language isn't in the list, have a look at this [bl... | [
-0.012817607261240482,
0.30640873312950134,
0.5627633929252625,
-0.13364657759666443,
0.1284674108028412,
-0.08505237102508545,
0.5170504450798035,
0.12066490203142166,
-0.19210289418697357,
-1.0197467803955078,
-0.1887637972831726,
0.5480457544326782,
-0.06973858177661896,
0.1358026266098... | |
an in-memory OS like SmartOS | [
-0.5006467700004578,
-0.1356959193944931,
-0.20329640805721283,
0.6547039151191711,
-0.11510816216468811,
-0.18517979979515076,
-0.4093272387981415,
0.5525744557380676,
0.121350958943367,
-0.5247581601142883,
-0.1806100606918335,
0.4589740037918091,
-0.1451030969619751,
-0.1400134414434433... | |
I'm looking to take the results of a report run (a PDF file from Crystal Reports), serialize it, stick it into a varbinary field, and then later be able to deserialize it and present it back to the user.
For now I have to just plain old ADO .NET (SqlClient, SqlCommand, etc.)
Are there any pitfalls to this? What is th... | [
0.3983228802680969,
0.09076976776123047,
0.48377689719200134,
0.04304003715515137,
-0.18915149569511414,
-0.29873695969581604,
0.32826584577560425,
0.0007931606378406286,
-0.1676413118839264,
-0.7949638962745667,
0.11432262510061264,
0.5448647737503052,
-0.3703474700450897,
0.3729612529277... | |
VARBINARY(MAX). (Hey I did not know that).
MY OLD ANSWER: *VARBINARY has a limit of 8 KB. Can be too small to store PDF's. You'd better use the IMAGE datatype.*
Use parameters to insert/select your data via the SqlCommand, and you can use just plain SQL like any ordinary field.
The data you pass into the image fiel... | [
0.24995207786560059,
-0.32842597365379333,
0.5360150337219238,
-0.10972714424133301,
-0.2538418173789978,
-0.0449087992310524,
0.09570514410734177,
-0.16712448000907898,
-0.1946071982383728,
-0.6020763516426086,
0.16443616151809692,
0.7831947207450867,
-0.33991527557373047,
0.2053478658199... | |
Running this code as a regular user throws HttpListenerException (access denied). Snippet runs ok as an administator
```
class Program
{
static void Main(string[] args)
{
HttpListener listener = new HttpListener();
listener.Prefixes.Add("http://myip:8080/app/");
listener.Start();
... | [
0.04713408276438713,
-0.142791286110878,
0.7106558084487915,
-0.15855997800827026,
-0.1322716772556305,
0.018834488466382027,
0.43185776472091675,
-0.1929338127374649,
-0.24806201457977295,
-0.5652683973312378,
-0.3051854372024536,
0.42780518531799316,
-0.6766493916511536,
0.29729500412940... | |
for other projects (they didn't use HttpListener though). I tried multiple port/application name combinations, nothing works.
Any ideas what might be the cause?
Running .Net 3.5 SP1 on Vista
I do not understand why but here it is. It seems that the cause is that my network card is configured with 2 IPs.
if in the co... | [
-0.011655326001346111,
0.017049243673682213,
0.3887557089328766,
-0.004681406542658806,
-0.2816503643989563,
-0.18824973702430725,
0.35679399967193604,
-0.21486477553844452,
-0.45080074667930603,
-0.9642938375473022,
0.014549652114510536,
0.19284579157829285,
-0.6605201959609985,
0.2631376... | |
urlacl url=http://+:8080/app user=domain\user
```
then there is no error and i can access my app from both ip. | [
-0.1543416827917099,
0.24440911412239075,
1.216465950012207,
-0.016381094232201576,
0.1830858439207077,
-0.0596499964594841,
0.1198454350233078,
0.17634505033493042,
-0.1704733967781067,
-0.6237783432006836,
-0.19517777860164642,
0.6611208915710449,
-0.2954789996147156,
0.1128937155008316,... | |
I am trying to get some xpath from xsl variable using xsl ver 1.0 .
That’s my variable:
```
<xsl:variable name ="myVar">
<RefData RefTag="test1" bbb="false" />
<RefData RefTag="test2" bbb="false" />
<RefData RefTag="test3" bbb="false" />
<RefData RefTag="test4" bbb="true" />
... | [
0.6763861179351807,
0.3262784481048584,
0.4723612666130066,
-0.383793443441391,
-0.2068590521812439,
0.1829579770565033,
0.7350529432296753,
-0.33892548084259033,
0.31318914890289307,
-0.6472324728965759,
-0.055212680250406265,
0.40650925040245056,
-0.3702545464038849,
-0.00911819934844970... | |
value:
```
<xsl:if test="$myVar/RefData[@RefTag = 'test3']/@bbb">
```
this is not working.
VS XSL Debugger returns an error:
"To use a result tree fragment in a path expression, first convert it to a node-set using the msxsl:node-set() function."
I don't understand how to use msxsl:node-set() function, and anyway ... | [
-0.08663785457611084,
-0.06661516427993774,
0.2903192341327667,
-0.04226180911064148,
-0.19052550196647644,
-0.2522967457771301,
0.521742045879364,
-0.3803434669971466,
-0.09202270954847336,
-0.7201948761940002,
-0.11479711532592773,
0.5181565284729004,
-0.2928798198699951,
0.0366795882582... | |
-->
<xsl:variable name ="myVar">
<RefData RefTag="test1" bbb="false" />
<RefData RefTag="test2" bbb="false" />
<RefData RefTag="test3" bbb="false" />
<RefData RefTag="test4" bbb="true" />
<RefData RefTag="test5" bbb="false" />
<RefData RefTag="test6" bbb="false" />
... | [
0.536966860294342,
0.0852394700050354,
0.2284672111272812,
-0.05344280228018761,
-0.16650743782520294,
0.14385955035686493,
0.6133866906166077,
-0.5368342399597168,
0.1559702306985855,
-0.4803803265094757,
-0.13895383477210999,
0.380068302154541,
-0.44317713379859924,
-0.15851527452468872,... | |
-->
<xsl:variable name="vrefVar" select=
"document('')/*/xsl:variable[@name='myVar']"
/>
<!-- -->
<xsl:template match="/">
<xsl:value-of | [
-0.056280381977558136,
-0.10251002013683319,
0.47334930300712585,
-0.08770763128995895,
-0.04102117940783501,
-0.18660692870616913,
0.0952068418264389,
-0.6979954838752747,
0.1805894374847412,
-0.5811646580696106,
-0.32332727313041687,
0.710123598575592,
-0.27927231788635254,
-0.0541448481... | |
select="$vrefVar/*[@RefTag='test3']/@bbb"/>
</xsl:template>
</xsl:stylesheet>
```
**When the above transformation is applied on any XML document (not used), the wanted result is produced**:
`false`
**Do note the use of the XSLT [`document()`](http://www.w3.org/TR/xslt#function-document) function** in order to a... | [
0.22544147074222565,
-0.2421312779188156,
0.4639664590358734,
-0.26604989171028137,
-0.009100263938307762,
-0.12623180449008942,
0.1680946797132492,
-0.682288646697998,
0.0033248141407966614,
-0.42957228422164917,
-0.5109608769416809,
0.5341683030128479,
-0.14962522685527802,
0.03085264004... | |
I was writing a toString() for a class in Java the other day by manually writing out each element of the class to a String and it occurred to me that using reflection it might be possible to create a generic toString() method that could work on ALL classes. I.E. it would figure out the field names and values and send t... | [
0.3064553737640381,
-0.1759008765220642,
-0.07626154273748398,
-0.1958518773317337,
0.05151166766881943,
-0.04284055531024933,
0.0420072041451931,
-0.39694055914878845,
0.021370816975831985,
-0.21809080243110657,
0.11871613562107086,
0.7888597249984741,
-0.45887425541877747,
0.121203623712... | |
c.getFields();
List<String> classFields = new ArrayList(field.length);
for (int i = 0; i < field.length; i++) {
String cf = field[i].toString();
classFields.add(cf.substring(cf.lastIndexOf(".") + 1));
}
return classFields;
}
```
Using a factory I could reduce the performance overhead... | [
0.44221600890159607,
-0.18653465807437897,
0.2520610988140106,
-0.30810123682022095,
0.04188365116715431,
0.12846234440803528,
0.22797636687755585,
-0.3536972999572754,
-0.1381344497203827,
-0.46242737770080566,
-0.048028673976659775,
0.7915117144584656,
-0.3006100654602051,
0.059506464749... | |
idea of reflection and how I can use it to improve my everyday programming.
Apache commons-lang [ReflectionToStringBuilder](http://commons.apache.org/proper/commons-lang//apidocs/org/apache/commons/lang3/builder/ReflectionToStringBuilder.html) does this for you.
```
import org.apache.commons.lang3.builder.ReflectionT... | [
0.4924475848674774,
-0.03036889247596264,
0.2806459367275238,
-0.10284591466188431,
-0.19530311226844788,
-0.0631948783993721,
0.4519592225551605,
-0.28344014286994934,
-0.10197696089744568,
-0.5091795325279236,
0.1324019432067871,
0.7301256060600281,
-0.056096650660037994,
0.0036723117809... | |
I have a large spreadsheet in Excel 2007 OpenXML format that I want to manipulate in xml programmatically. Excel saves it using the shared strings method which, while more efficient, complicates the process. Does anyone know if there is an option buried in Excel to save using inline strings, or maybe a utility already ... | [
0.13038842380046844,
0.22325333952903748,
0.08079209178686142,
0.07583397626876831,
-0.3311971127986908,
0.1905367523431778,
0.11878757923841476,
-0.016473159193992615,
-0.21660439670085907,
-0.6662356853485107,
0.049877967685461044,
0.6479023694992065,
-0.2766540050506592,
0.0266623888164... | |
I am doing something like this:
```
class Class(object):
def __init__(self):
self.var=#new instance name string#
```
How do I make the \_\_ init \_\_ method of my instance to use the instance name string for 'c'? Say in case:
```
c=Class()
```
I want c.var equal to 'c'.
Thanks for your replies, I ... | [
-0.052805185317993164,
0.4702906608581543,
0.29681915044784546,
-0.04191345348954201,
-0.17910973727703094,
-0.07870440930128098,
0.3187638223171234,
-0.078772634267807,
-0.2590721845626831,
-0.6896724700927734,
0.08263317495584488,
0.6778457760810852,
-0.14089329540729523,
0.3265624344348... | |
for your replies, I am implementing persistence and Class is persistent object's class. I want \_\_ init \_\_ to add an entry to the database when:
```
c=Class()
```
Then, suppose:
```
del c
```
Later on:
```
c=Class()
```
sholuld create an instance using data from database if there already is an entry 'c', ot... | [
-0.001980565255507827,
0.2901918590068817,
0.31292012333869934,
0.00013685929297935218,
-0.14076168835163116,
0.08462071418762207,
0.30793678760528564,
-0.16697001457214355,
-0.0796770229935646,
-0.6916905045509338,
-0.08668646216392517,
0.4918953776359558,
-0.5537102818489075,
0.446084976... | |
self.name = None
def get_by_id(self, id):
records = db.execute('select * from table where id=%s' % str(id))
if records:
self.id = records[0]['id']
self.name = records[0]['name']
def save(self):
db.execute('update table set name=%s where id=%s' % (self.name, str(... | [
0.168122336268425,
0.27856460213661194,
0.05123283341526985,
-0.5430173873901367,
-0.17857646942138672,
0.06893137842416763,
0.6239877939224243,
-0.4543134272098541,
0.031377993524074554,
-0.6446489095687866,
0.04391849413514137,
0.5566157698631287,
-0.30009886622428894,
0.1695180833339691... | |
insecure, its just there to illustrate how to persist using classes with a db. | [
0.0003949249512515962,
-0.06286315619945526,
-0.24616345763206482,
0.43012624979019165,
-0.24985244870185852,
-0.2681100070476532,
0.5791192650794983,
0.18918806314468384,
0.30397164821624756,
-0.31993427872657776,
0.06698859483003616,
0.34215009212493896,
-0.11080040782690048,
0.097778454... | |
I've got some code which draws data from an xml file but it seems to have randomly starting throwing;
```
Traceback (most recent call last):
File "C:\Users\mike\Documents\python\arl xml\turn 24 reader", line 52, in <module>
unitCount = getText(evoNode.getElementsByTagName("count")[0].childNodes)
IndexError: li... | [
0.25385284423828125,
0.24195365607738495,
0.4486508071422577,
-0.018504327163100243,
-0.06640511006116867,
0.1644423007965088,
0.3644755482673645,
-0.3514064848423004,
-0.1750527322292328,
-0.6026390790939331,
0.0676145851612091,
0.02537221647799015,
0.09301714599132538,
0.2977387607097626... | |
here's the code that it's complains about;
```
for unitNode in node.getElementsByTagName('unit'):
unitName = getText(evoNode.getElementsByTagName("type")[0].childNodes)
unitId = getText(evoNode.getElementsByTagName("typeid")[0].childNodes)
unitCount = getText(evoNode.getElementsByTagNam... | [
0.023237481713294983,
-0.15106342732906342,
0.6565427780151367,
-0.013633890077471733,
0.03079269267618656,
0.1739167422056198,
0.16136518120765686,
-0.09090027958154678,
0.16942672431468964,
-0.8590937256813049,
-0.16479334235191345,
0.2165321409702301,
0.018811995163559914,
0.45583114027... | |
set of code from which that was cloned and editted.
Anyone know what I can do or can suggest ways to refine the question?
A simple idea: check if `evoNode.getElementsByTagName("count")` returns a non-empty list:
```
counts = evoNode.getElementsByTagName("count")
if counts:
unitCount = getText(counts[0].childNodes... | [
0.3616897761821747,
-0.14288675785064697,
0.40440526604652405,
0.038238879293203354,
0.22760602831840515,
0.06914316117763519,
0.16964682936668396,
-0.2200411856174469,
-0.21319130063056946,
-0.8288286924362183,
0.11241528391838074,
0.5805030465126038,
-0.13528425991535187,
0.1020364388823... | |
As I am a programmer,and not an artist or animator and I am failing at showing off the best features of WPF in my application. Although I have samples for simple animations for buttons like growing, or having the color fade into something brighter on click but what I am looking for is some showcase button animations an... | [
0.5809431076049805,
-0.09382188320159912,
0.11772698909044266,
0.13191907107830048,
-0.1732930988073349,
0.03593448922038078,
0.12339727580547333,
0.015331048518419266,
0.07740438729524612,
-0.7708646655082703,
0.31582948565483093,
0.4800037145614624,
-0.08147918432950974,
-0.1231608018279... | |
technology.
Can anyone point me at some button samples and/or panel changing (switching from one panel to the next in a navigation) that really shows of WPF and has that **wow** factor.
**EDIT**
Please don't point to <http://codeproject.com> or the microsoft samples, as I have already perused those at great detail. ... | [
0.7259736657142639,
-0.13966985046863556,
0.2844275236129761,
0.3858969807624817,
-0.1413717120885849,
0.149021178483963,
-0.22132277488708496,
-0.05587795749306679,
-0.31900039315223694,
-0.6968010663986206,
-0.18599721789360046,
0.5342763066291809,
-0.0229718666523695,
-0.125807687640190... | |
I think the best way to learn is to use an animation tool. If you have access to Expression Blend you can use it to learn a lot about how WPF animations are setup in Xaml. There are many nuances to animation, like keyframe easing, that are just hard to understand and get right by plucking away at IntelliSense in Visual... | [
0.7097855806350708,
-0.381143182516098,
0.2157648801803589,
0.35591480135917664,
0.32815083861351013,
-0.38446876406669617,
-0.06469941139221191,
0.2732888162136078,
-0.04298030957579613,
-0.7861249446868896,
0.009463576599955559,
0.735876202583313,
0.050296373665332794,
-0.013938310556113... | |
it through the [BizSpark](http://www.microsoft.com/BizSpark/) program.
At any rate, if you’re interested in learning animations through Expression Blend, these starter videos on Channel 9 are a decent place to start:
[Animation Using Expression Blend: How to create an animation](http://channel9.msdn.com/posts/jennmar... | [
0.35482221841812134,
-0.5116075873374939,
0.6977171301841736,
0.17615024745464325,
-0.28442487120628357,
-0.08847230672836304,
0.11821424216032028,
0.3657873570919037,
-0.27162525057792664,
-0.6564791202545166,
-0.39260202646255493,
0.26203519105911255,
0.29016417264938354,
-0.088334038853... | |
Are there any guidelines on writing database tests so that you can refactor database "without fear" while doing evolutionary database design?
What aspects of database should be put to test while developing it? Any example would be great..
I write tests that call my dal code and after I check if the inserts/updates/del... | [
0.6676179766654968,
0.15359055995941162,
-0.23057511448860168,
0.09285742789506912,
0.0558769516646862,
-0.011195743456482887,
0.046289268881082535,
-0.3656689524650574,
-0.08054210990667343,
-0.6349558234214783,
0.3298651874065399,
0.3510577380657196,
0.0049510858952999115,
0.018601143732... | |
What conventions (if any) do you use for indenting XSL code?
* how do you deal with really long, complicated XPaths
* can you plug them into your XML editor of choice?
* is there some open source code that does the job well?
For some background, I use nxml-mode in Emacs. For the most part its OK and you can configure... | [
0.596034586429596,
0.030085379257798195,
0.2120743989944458,
0.20846904814243317,
-0.2677280306816101,
-0.16599777340888977,
0.17735745012760162,
0.23792535066604614,
-0.1820531040430069,
-0.5714018940925598,
0.0813458189368248,
0.5788745880126953,
-0.171896293759346,
0.08701455593109131,
... | |
it look something like this...
```
<xsl:for-each select="/some
/very[@test = 'whatever']
/long[@another-test = perhaps | [
0.4168248474597931,
-0.11042094230651855,
0.5761232376098633,
0.05235560983419418,
0.2668571174144745,
-0.05047759413719177,
-0.07393825054168701,
0.06097214296460152,
0.1642022430896759,
-0.4313497245311737,
0.05116629600524902,
0.3261988162994385,
-0.08364450931549072,
-0.121501363813877... | |
/another
/long | [
0.4030437171459198,
-0.2368811070919037,
-0.2170032411813736,
0.039886463433504105,
-0.1568925529718399,
-0.26517173647880554,
0.01921004056930542,
0.1356225162744522,
-0.018972739577293396,
-0.39665013551712036,
0.16593103110790253,
0.5393665432929993,
0.36913901567459106,
-0.013937386684... | |
/xpath[@goes='here']]
/xpath"
```
However, I currently have to do that manually as nxml will just align it all up with the "/some.."
I write tests that call my dal code and after I check if the inserts/updates/deletes actually occurred, so called state tests. These are pr definition not Units... | [
0.6154418587684631,
0.1492108255624771,
0.4160690903663635,
-0.05798819661140442,
0.03582872450351715,
0.012049897573888302,
0.06770333647727966,
-0.16994065046310425,
-0.09112945944070816,
-0.6590445041656494,
0.16552963852882385,
0.40736469626426697,
-0.0689752995967865,
0.14192773401737... | |
go rather seamlessly. | [
0.2945057153701782,
-0.12179464101791382,
0.05805807188153267,
0.2231079787015915,
0.026335598900914192,
0.19957460463047028,
0.2279302030801773,
0.2689830958843231,
-0.18537376821041107,
-0.7860305309295654,
-0.3825491964817047,
0.21325787901878357,
-0.11508296430110931,
0.075085893273353... | |
I'm developing a Django application that contains a model with a date/time field. On my local copy of the application, the admin page for that particular model shows this for the date/time field:
[alt text http://www.cs.wm.edu/~mpd/images/bugs/django-date-local.png](http://www.cs.wm.edu/~mpd/images/bugs/django-date-lo... | [
0.04709397628903389,
0.4136146605014801,
0.4115433096885681,
-0.3082197308540344,
-0.35863032937049866,
-0.09417563676834106,
0.04964317008852959,
0.0706976130604744,
-0.31163373589515686,
-0.502569854259491,
0.19973832368850708,
0.34890031814575195,
-0.398332804441452,
0.10485772043466568... | |
issue seems localized to Safari. The "Today" and "Now" buttons appear when the admin site is accessed via Firefox. It looks like Safari can't download some of the JavaScript files necessary to show these widgets (strange that Firefox can, though).
* I noticed that Safari is receiving a "304 Not Modified" code for the f... | [
0.2772524356842041,
0.389453262090683,
0.5510995388031006,
-0.06778568029403687,
0.05180453509092331,
-0.22996994853019714,
0.2219114601612091,
0.13666026294231415,
-0.4243899881839752,
-0.5085654854774475,
-0.19192098081111908,
0.6470944285392761,
-0.4022575318813324,
0.17863893508911133,... | |
the top of my head:
* One could be configured to use a proxy (messing with the trafic) the other not. Make sure the configuration is the same in both.
* Safari could have cached the error clear the cache before testing again.
* Try to access the gif files directly from the browser (by inputting the full url of the ima... | [
0.6117659211158752,
-0.14565348625183105,
0.2155424952507019,
0.3690391480922699,
-0.2737254500389099,
-0.2389954924583435,
0.2765669822692871,
0.09658374637365341,
-0.4294300973415375,
-0.7000571489334106,
0.2504538595676422,
0.4646708071231842,
-0.09769454598426819,
-0.07041854411363602,... | |
That's pretty much the whole question. I've installed Visual C# 2008 Express on a clean Windows XP Pro SP3 machine, started a new Windows Forms project, double-clicked the form to create a Form1\_Load method, then typed:
```
StringBuilder SB;
SB = new StringBuilder("test");
SB.Chars
```
but Chars doesn't appear on t... | [
-0.07192589342594147,
0.22845371067523956,
0.2873513698577881,
-0.3307935297489166,
-0.28294244408607483,
-0.004296833649277687,
0.46714892983436584,
-0.2323048710823059,
-0.13515615463256836,
-0.40448734164237976,
-0.030084947124123573,
0.5331590175628662,
-0.5549461841583252,
-0.13015703... | |
but just occasionally I wish it supported named indexers fully... | [
0.3641400933265686,
0.3090362250804901,
0.08789028972387314,
0.1298668384552002,
-0.26157110929489136,
-0.1775476336479187,
0.22265762090682983,
0.29201459884643555,
-0.2894567847251892,
-0.2926017642021179,
-0.011104121804237366,
0.16243602335453033,
-0.04264445975422859,
0.23951746523380... | |
I would like to start learning SQL Server 2005 on my own. Can anyone recommend good books or websites that will be a good start for me?
**Books:**
[Inside Microsoft SQL Server 2005: T-SQL Querying](https://rads.stackoverflow.com/amzn/click/com/0735623139)
[Inside Microsoft SQL Server 2005: The Storage Engine](https:... | [
0.2125246226787567,
0.2732061743736267,
-0.012584426440298557,
0.05740312486886978,
-0.33443132042884827,
-0.40408825874328613,
0.44581007957458496,
-0.1504570096731186,
0.025104885920882225,
-0.48968011140823364,
0.3940029740333557,
0.762310802936554,
0.20448771119117737,
0.14349547028541... | |
I'd like to parse rss feeds and download [podcasts](https://blog.stackoverflow.com/category/podcasts/) on my ReadyNas which is running 24/7 anyway.
So I'm thinking about having a shell script checking periodically the feeds and spawning wget to download the files.
What is the best way to do the parsing?
Thanks!
Some... | [
0.4470694959163666,
0.20586764812469482,
0.3184182643890381,
-0.04711327329277992,
-0.034015338867902756,
-0.31795263290405273,
-0.06564388424158096,
0.11234360933303833,
-0.3782443404197693,
-0.6937099099159241,
-0.19060926139354706,
1.0298434495925903,
-0.2550717294216156,
-0.05514474585... | |
We're having great results with the Phusion stack ([Passenger](http://www.modrails.com/) and [Ruby Enterprise Edition](http://www.rubyenterpriseedition.com/index.html)) in house, but I haven't been able to find much in the way of data on their use in the wild, particularly REE. I'd love something akin to WWR's [High Pr... | [
0.29421913623809814,
-0.010939912870526314,
0.026963619515299797,
-0.019457880407571793,
-0.06254229694604874,
0.07203411310911179,
0.2909418046474457,
-0.12228094786405563,
-0.3373683989048004,
0.08060400187969208,
-0.09458666294813156,
0.090987429022789,
0.03297816589474678,
0.3382591009... | |
are using it. | [
0.9383793473243713,
0.5196300148963928,
0.05025504529476166,
0.14566004276275635,
0.28877413272857666,
-0.3221196234226227,
-0.05621541664004326,
0.0001998218649532646,
-0.10728718340396881,
-0.8191962838172913,
-0.0644809827208519,
0.36947518587112427,
0.047636978328228,
-0.09293628484010... | |
I need a Regex Statement (run in c#) that will take a string containing a Sql Update statement as input, and will return a list of columns to be updated. It should be able to handle columns surrounded by brackets or not.
```
// Example Sql Statement
Update Employees
Set FirstName = 'Jim', [LastName] = 'Smith', CodeNu... | [
0.27288341522216797,
0.3247593343257904,
0.4078338146209717,
-0.11042851209640503,
0.1001841202378273,
-0.027688954025506973,
0.1481323540210724,
-0.29058021306991577,
-0.06645326316356659,
-0.6593531370162964,
0.09627983719110489,
0.5068762302398682,
-0.27127957344055176,
0.15336173772811... | |
it is given. The purpose of extracting the column names in my case is to validate that the user has permission to update the columns included in the query.
You're doing it backwards. Store the data in a broken out form, with the table to be updated, the column names, and the expressions to generate the new values all s... | [
0.2899676263332367,
0.19987569749355316,
0.5980296730995178,
0.2674656808376312,
-0.20348426699638367,
-0.08466867357492447,
-0.015362231992185116,
-0.5626298189163208,
-0.04955406114459038,
-0.30347293615341187,
-0.03707270696759224,
0.6926841139793396,
-0.18357734382152557,
0.16684564948... | |
expressions are the correct way to go. For example, in the general case you may need to skip over new value expressions that contain arbitrarily nested parenthesis. You will probably want a full SQL parser. The book *Lex & Yacc* by Levine, Mason, and Brown has a chapter on parsing SQL.
Response to update:
You are in f... | [
0.33204302191734314,
0.1866847574710846,
-0.025651715695858,
0.28375568985939026,
-0.2940797507762909,
-0.14797738194465637,
0.5673662424087524,
0.006840631365776062,
0.05730012059211731,
-0.37248724699020386,
-0.17643752694129944,
0.8929821252822876,
-0.2477223128080368,
-0.44734174013137... | |
another way to do whatever it is that you are doing. Maybe break out the modifiable fields into a separate table and use access controls? Maybe come up with another interface for them to use in specifying what they want done? Whatever it is that you're doing, there is almost certainly a better way to do it. Down that p... | [
0.5401858687400818,
-0.10357317328453064,
-0.28228792548179626,
0.4523824453353882,
-0.4633488953113556,
-0.017478516325354576,
-0.12534745037555695,
0.05096729099750519,
-0.5447789430618286,
-0.43365246057510376,
0.08551537990570068,
0.5530034899711609,
-0.08844786137342453,
-0.2042206525... | |
Our Dev team had been developing enterprise web page more than 2 years ago. We are curious to know what is the best way to write a contract for CSS usage. For example, if we have a COMP, how we agree on a contract so our developers and our designers agree and we don't have to go back.
Is there a tool that is availabl... | [
0.9032503962516785,
0.12566082179546356,
0.18202921748161316,
0.2288086861371994,
-0.2509205937385559,
-0.26750069856643677,
-0.045322075486183167,
-0.021807167679071426,
-0.054064374417066574,
-0.7391484379768372,
0.3700280785560608,
0.6267648935317993,
0.042891595512628555,
0.08065070211... | |
The general opinion is that everything that is style should go in a CSS and all else in the html.
Thanks for your input.
Well, if a webpage has very specific CSS just for itself, I guess there is an argument for defining the CSS in the page, otherwise I would always have the CSS in an external file.
Try to avoid or a... | [
0.7910920977592468,
0.23667873442173004,
0.036841414868831635,
0.201650008559227,
-0.5085521936416626,
-0.2670895755290985,
0.09144261479377747,
0.3560889959335327,
-0.3424827456474304,
-0.543267011642456,
-0.014783430844545364,
0.5002066493034363,
-0.23854731023311615,
-0.1138772219419479... | |
files.
One thing you might want to think about are the number of CSS files - some people suggest that you should minimise this to just one file site-wide or per-template (or area of the site) to minimise HTTP requests to the server and avoid delayed CSS loading and funny looking styling up until that point.
So this "... | [
0.9813739657402039,
0.11791560053825378,
0.4147385060787201,
0.23486563563346863,
-0.02055053599178791,
-0.43592071533203125,
0.19965267181396484,
-0.014221731573343277,
-0.5011536478996277,
-0.5598721504211426,
-0.041021887212991714,
0.2040901929140091,
-0.21116569638252258,
-0.2277675718... | |
I've been using javascript for a while, but have never learned the language past the basics. I am reading John Resig's "Pro Javascript Techniques" - I'm coming up with some questions, but I'm not finding the answers to them in the book or on google, etc.
John gives this example in his book:
**Function #1**
```
fun... | [
0.30759140849113464,
0.5181971788406372,
0.2041042447090149,
-0.45520874857902527,
0.2837754786014557,
0.35313674807548523,
0.49205049872398376,
-0.17848727107048035,
-0.1803705245256424,
-0.8816372752189636,
0.024906015023589134,
0.23191599547863007,
-0.09376690536737442,
0.39773896336555... | |
user.getAge());
```
I'm still learning about the *prototype* property, so I tried writing something similar:
**Function #2**
```
function User (name, age ) {
this.name = name;
this.age = age;
this.getName = function() {
return this.name;
};
this.getAge = function() {
return this.age;
};
}
var ... | [
0.16781862080097198,
0.3019348084926605,
0.3535459041595459,
-0.5906898975372314,
0.4989747107028961,
0.22452406585216522,
0.3124542534351349,
-0.25077563524246216,
-0.25239628553390503,
-0.7530470490455627,
-0.09666310250759125,
0.47064363956451416,
-0.24131396412849426,
0.535188674926757... | |
#3**
```
var User = {
name: "",
age: 0,
setName: function(name) {
this.name = name;
},
setAge: function(age) {
this.age = age;
},
getName: function() {
return this.name;
},
getAge: function() {
return this.age;
}
};
User.setName("Bob");
User.setAge(44);
console.log("User: " + User.g... | [
0.14024771749973297,
0.2736698091030121,
0.511995792388916,
-0.5737472772598267,
0.19744373857975006,
0.2288472205400467,
0.34914833307266235,
-0.7002020478248596,
-0.17192380130290985,
-0.3399868309497833,
-0.25398725271224976,
0.6427270770072937,
-0.2701781988143921,
0.17948739230632782,... | |
the prototype property, and is Function #2 doing anything incorrectly, because it seems more straight forward to code #2 instead of #1 (although I'm sure #1 is doing it better seeing as John created it).
**Question #2** - How could I modify function #3 to not use the setName and setAge methods, but still keep the {...... | [
0.127359539270401,
0.13235606253147125,
-0.1198170855641365,
0.12881633639335632,
-0.1524762660264969,
0.029853448271751404,
0.3694712221622467,
-0.16692698001861572,
-0.12615258991718292,
-0.6374717354774475,
0.29876184463500977,
0.14842236042022705,
-0.22478988766670227,
0.20689477026462... | |
like:
```
var user = new User("Bob", 44);
```
Just like in Function #1 - or is that not possible?
**EDIT #2**
Wow! Thanks everyone for the awesome answers. That really makes it a lot more clear to me. So if I understand correctly, the difference between #1 and #2 aren't too much. If I only ever create one "User" ob... | [
0.36651870608329773,
0.37717512249946594,
0.19275745749473572,
0.23797984421253204,
-0.20890448987483978,
-0.055664051324129105,
0.3586236536502838,
0.060293711721897125,
-0.49213603138923645,
-0.5672644376754761,
-0.038343172520399094,
0.6679248809814453,
-0.15292146801948547,
0.071824714... | |
function() {} is evaluated, it creates a new function object. Therefore, in #1 all of the User objects are sharing the same getName and getAge functions, but in #2 and #3, each object has its own copy of getName and getAge. All of the different getName functions all behave exactly the same, so you can't see any differe... | [
-0.049793973565101624,
-0.2133723497390747,
0.2752149701118469,
-0.1875222772359848,
-0.2711707353591919,
0.1567787528038025,
0.1545092612504959,
-0.16302719712257385,
0.03192013502120972,
-0.5573908686637878,
-0.1155330017209053,
0.43043163418769836,
-0.5749568939208984,
0.235419988632202... | |
User, but they are of different types.
Response to comment:
You can't, directly. You could make a function that creates a new object as per #3. For example:
```
function make_user(name, age) {
return {
name: name,
age: age,
getName: function() { return name; },
getAge: function() ... | [
0.4208722710609436,
0.10628338903188705,
0.42469874024391174,
-0.36578619480133057,
0.3430379033088684,
0.27183598279953003,
0.38479435443878174,
-0.1781964898109436,
-0.1930321604013443,
-0.8025354146957397,
-0.22474555671215057,
0.5675601959228516,
-0.38994938135147095,
0.524946510791778... | |
The following C# class is used in a multithreaded enviroment. I removed very much of the actual code. The problem occurs when calling MethodA and MethodB almost simultaneously. The order of the lock in the IsDepleted property doesn't solves the problem. Removing lock(WaitingQueue) from the IsDepleted property solves th... | [
-0.04300270602107048,
-0.22398728132247925,
0.19568561017513275,
-0.047357890754938126,
-0.09496080875396729,
0.11311736702919006,
0.3009880781173706,
-0.2876903712749481,
-0.36572709679603577,
-0.296062707901001,
-0.08255968987941742,
0.3002437353134155,
-0.508142352104187,
0.406908988952... | |
{
lock (Processing)
{
lock (WaitingQueue)
{
return WaitingQueue.Count == 0
&& Processing.Count == 0;
} | [
-0.06389664858579636,
-0.6222115159034729,
0.43902045488357544,
-0.09927448630332947,
0.5961169600486755,
0.30244868993759155,
-0.022305874153971672,
-0.16440798342227936,
-0.4955916702747345,
-0.10363198816776276,
-0.201802596449852,
0.5664963126182556,
-0.4882924258708954,
0.334520787000... | |
}
}
}
private readonly List<object> Processing = new List<object>();
private readonly Queue<object> WaitingQueue = new Queue<object>();
public void MethodA(object item)
{
lock (WaitingQueue)
{
if (WaitingQueue.Count > 0)
{ | [
-0.09408126026391983,
-0.6402823328971863,
0.32106032967567444,
-0.050225015729665756,
0.42149192094802856,
0.37346285581588745,
-0.0021952693350613117,
-0.21879857778549194,
-0.5261287689208984,
-0.16104933619499207,
-0.15938180685043335,
0.42150506377220154,
-0.5589541792869568,
0.347295... | |
if (StartItem(WaitingQueue.Peek()))
{
WaitingQueue.Dequeue();
}
}
}
}
public void MethodB(object identifier) | [
-0.2739684283733368,
-0.5524595379829407,
0.006960555911064148,
-0.19095538556575775,
0.42746779322624207,
0.2044922262430191,
0.2866096794605255,
0.08667155355215073,
-0.1865154504776001,
-0.32460230588912964,
-0.44419756531715393,
0.10902510583400726,
-0.48256203532218933,
0.241624578833... | |
{
lock (Processing)
{
Processing.Remove(identifier);
if (!IsDepleted)
{
return;
}
}
//Do something... | [
0.021391458809375763,
-0.281831294298172,
0.1307971179485321,
-0.040938545018434525,
0.32179462909698486,
-0.12789510190486908,
0.08602066338062286,
-0.4245277941226959,
-0.3370477855205536,
-0.03444879129528999,
-0.29680755734443665,
0.23416370153427124,
-0.45135316252708435,
0.3587492108... | |
}
bool StartItem(object item)
{
//Do something and return a value
}
}
```
It depends if you want a quick fix or a rigorous fix.
A quick fix would be just to use one lock object in all cases.
e.g. `private readonly object _lock = new object();`
And then just lock on that. However, depending on y... | [
-0.03626029193401337,
0.017452359199523926,
0.13673052191734314,
-0.17587509751319885,
0.09105443209409714,
-0.1551896631717682,
0.38961613178253174,
-0.1965632438659668,
-0.38227543234825134,
-0.39748913049697876,
-0.2989061772823334,
0.5647116303443909,
-0.5531783699989319,
0.17372007668... | |
{
get
{
lock (_lock)
{
return WaitingQueue.Count == 0
&& Processing.Count == 0;
} | [
-0.07678904384374619,
-0.5813651084899902,
0.46224626898765564,
0.01549991499632597,
0.5672426223754883,
0.17799311876296997,
0.3273891508579254,
-0.17765413224697113,
-0.372830331325531,
-0.20260263979434967,
-0.47084569931030273,
0.628429114818573,
-0.380001425743103,
0.14356601238250732... | |
}
}
private readonly List<object> Processing = new List<object>();
private readonly Queue<object> WaitingQueue = new Queue<object>();
public void MethodA(object item)
{
lock (_lock)
{
if (WaitingQueue.Count > 0)
{
if (StartItem(WaitingQueue.P... | [
-0.20503276586532593,
-0.7451841235160828,
0.3183818459510803,
-0.1416110098361969,
0.3867044150829315,
0.31985726952552795,
0.1648930013179779,
-0.05264297500252724,
-0.5097275376319885,
-0.36360469460487366,
-0.21744182705879211,
0.3811991512775421,
-0.5634046792984009,
0.199649736285209... | |
{
WaitingQueue.Dequeue();
}
}
}
}
public void MethodB(object identifier)
{
lock (_lock) | [
-0.018982527777552605,
-0.4671558737754822,
0.16169509291648865,
-0.07534580677747726,
0.6129382252693176,
0.18365247547626495,
0.16111329197883606,
-0.0957130566239357,
-0.30977898836135864,
-0.10354921221733093,
-0.33660030364990234,
0.3579356074333191,
-0.49691078066825867,
0.3776006698... | |
{
Processing.Remove(identifier);
if (!IsDepleted)
{
return;
}
}
//Do something...
}
bool StartItem(object item)
{ | [
-0.19705913960933685,
-0.26539289951324463,
0.04226759076118469,
-0.1986328810453415,
-0.061046943068504333,
0.10961563140153885,
0.24600765109062195,
-0.20318472385406494,
-0.35098031163215637,
-0.18467645347118378,
-0.4547654986381531,
0.1565345972776413,
-0.40645429491996765,
0.35751727... | |
//Do something and return a value
}
}
``` | [
0.2719383239746094,
0.34769901633262634,
-0.09949188679456711,
-0.05127106234431267,
0.21938546001911163,
-0.14567866921424866,
0.31983482837677,
0.21962296962738037,
0.15816104412078857,
-0.42142289876937866,
-0.32897689938545227,
0.5454035997390747,
-0.220819890499115,
0.2416520863771438... | |
Can I tell, using javascript, whether a user has clicked on the "X" icon on a browser dialog, or the "OK"/"Cancel" buttons? I have code I need to run when the window closes, but it will only run when OK or Cancel are clicked.
I currently capture the onunload event of the window. How can i accomplish this?
```
window.... | [
0.4707343280315399,
-0.05756622180342674,
0.4573248326778412,
0.009771723300218582,
0.19239458441734314,
-0.28364160656929016,
0.3628300130367279,
-0.10371241718530655,
-0.08984218537807465,
-0.7539117932319641,
-0.09080923348665237,
0.5748885273933411,
-0.2974170744419098,
0.0422260388731... | |
catch that event in all cases. You cannot prevent the user from closing the browser or guarantee that your code will execute when they do. You can make it slightly annoying for them, but they can disable javascript, or kill the process, or reboot the computer. Using the unload function is the closest you can come to ha... | [
0.4818570613861084,
-0.3436323404312134,
0.21098554134368896,
0.1712835282087326,
0.057215992361307144,
-0.3828108608722687,
0.6507807374000549,
0.241832435131073,
-0.2976703345775604,
-0.49580350518226624,
-0.2323017418384552,
0.3414703607559204,
-0.30468711256980896,
-0.00308520300313830... | |
In Unix, I need to be able to archive log files into monthly folders, labelled accordingly. How do I do this in Perl?
Let's provide an actual Perl idea, since that's what was asked for:
```
use File::Path qw<mkpath>;
use File::Spec;
use POSIX qw<strftime>;
use Smart::Comments;
my $directory
= File::Spec->catfil... | [
0.2240869104862213,
-0.18637403845787048,
0.7929888367652893,
-0.15647080540657043,
-0.09852045029401779,
-0.10748626291751862,
-0.16300132870674133,
0.14542770385742188,
-0.2372945249080658,
-0.39651963114738464,
-0.018072552978992462,
0.6904556155204773,
-0.04489059001207352,
0.035957690... | |
$log_file_path = File::Spec->catfile( $directory, 'system.log' );
### $log_file_path
```
Output is
```
### $directory: '/my/base/directory/2009-January'
### $log_file_path: '/my/base/directory/2009-January/system.log'
```
Notes
1. Install `Smart::Comments`, or comment it out.
2. The constant `$BASE_LOG_DIRECTORY... | [
0.15316975116729736,
0.0027422704733908176,
0.6267075538635254,
-0.17469185590744019,
-0.02029864490032196,
-0.23932616412639618,
-0.001406108494848013,
-0.07095477730035782,
-0.30632320046424866,
-0.5142565369606018,
-0.329923152923584,
0.5065675973892212,
-0.36689117550849915,
-0.2686073... | |
I am able to send emails using the typical C# SMTP code across Exchange 2007 as long as both the from and to addresses are within my domain.
As soon as I try to send emails outside the domain I get:
Exception Details: System.Net.Mail.SmtpFailedRecipientException: Mailbox unavailable. The server response was: 5.7.1 Un... | [
0.011156965047121048,
-0.10834535211324692,
0.5891119837760925,
-0.16997376084327698,
-0.4229445159435272,
0.02686844952404499,
0.2830992639064789,
-0.09926104545593262,
-0.4247664511203766,
-0.3925897479057312,
0.04488496854901314,
-0.02282298542559147,
-0.6294342875480652,
0.424663990736... | |
to connect to the server or waiting for a reply. Plus I think it skips the whole relay issue.
Configure youur SmtpClient like so:
```
SmtpClient srv = new SmtpClient("exchsrv2007", 25) {
DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory,
PickupDirectoryLocation = "\\exchsrv2007\PickupFolder"
}
...
... | [
-0.209555521607399,
-0.3991085886955261,
0.696402370929718,
0.0035240426659584045,
-0.15232813358306885,
-0.026366084814071655,
0.3968281149864197,
0.05451621860265732,
-0.5051888823509216,
-0.3822736442089081,
-0.3051226735115051,
0.021013814955949783,
-0.2947924733161926,
0.2551586329936... | |
The Asp.Net membership provider has some clear uses in a web app. I am thinking about trying to leverage some of the features in a windows application (more specifically WPF). Does anyone know if it is possible to use the core features in a windows app? I am mostly just looking for it to create my database tables, and ... | [
0.5701326131820679,
-0.2598015367984772,
0.44121211767196655,
0.24947229027748108,
-0.030495233833789825,
-0.20003648102283478,
0.06686120480298996,
0.21931415796279907,
-0.3903835713863373,
-0.6736375689506531,
0.11752252280712128,
0.5280624032020569,
-0.01936393231153488,
-0.121084734797... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.