text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
we go about doing that? Available languages being Ruby, Groovy, Java, Perl, or PowerShell (since I'd be writing it).
You might want to take a look at [PolyMon](http://www.codeplex.com/polymon), which is an open source systems monitoring solution. It allows you to write custom monitors in any .NET language, and allows y... | [
1.000898838043213,
-0.1747930347919464,
0.4439115524291992,
0.35608571767807007,
0.2259598672389984,
-0.06413755565881729,
0.12872134149074554,
0.02750186249613762,
-0.2892061173915863,
-0.6736648678779602,
0.1627599000930786,
0.7179571390151978,
-0.42198190093040466,
-0.001027058227919042... | |
ForEach-Object {$size += $_.length; $count += 1}
```
In reply to Scott's comment:
Sure. you could wrap it in a while loop
```
$ESCkey = 27
Write-Host "Press the ESC key to stop sniffing" -foregroundcolor "CYAN"
$Running=$true
While ($Running)
{
if ($host.ui.RawUi.KeyAvailable) {
$key = $hos... | [
0.13718843460083008,
0.043554194271564484,
0.47829675674438477,
-0.23179060220718384,
0.25325244665145874,
-0.16675466299057007,
0.5809343457221985,
-0.28881320357322693,
0.14257103204727173,
-0.3164912760257721,
-0.1201808750629425,
0.31891515851020813,
-0.4287740886211395,
0.105648584663... | |
}
#rest of function here
}
```
I would not do that for a PowerShell monitor, which you can schedule to run periodically, but for a script to run in the background, the above would work. You could even add some database access code to log the results to a database, or log it to a file.. what ever yo... | [
0.39807024598121643,
0.12382674962282181,
0.30684342980384827,
0.07716137915849686,
0.2056138664484024,
-0.21318906545639038,
0.06773997098207474,
0.31406688690185547,
0.010977963916957378,
-0.8338971734046936,
-0.16598445177078247,
0.8555082678794861,
-0.37164267897605896,
0.1700690686702... | |
I want to copy text files and only text files from `src/` to `dst/`
```
groovy:000> "cp src/*.txt dst/".execute().text
===>
groovy:000>
```
You can see the command executes w/out error but the file `src/test.txt` does not get copied to `dst/`
This also fails:
```
groovy:000> "cp src/* dst/".execute().t... | [
0.4257810115814209,
0.19876782596111298,
0.4060778021812439,
-0.03620219603180885,
0.43710967898368835,
-0.23502099514007568,
0.15277539193630219,
-0.22577720880508423,
-0.16845709085464478,
-0.47164076566696167,
-0.04131707176566124,
0.6978570222854614,
-0.4821997284889221,
0.312474995851... | |
your command "sh -c 'cp ...'" | [
0.26549217104911804,
0.4543502926826477,
0.3950609266757965,
-0.041795581579208374,
0.277605265378952,
-0.11877620965242386,
0.4773109257221222,
-0.14900805056095123,
-0.2123252898454666,
-0.2309267669916153,
-0.33048638701438904,
0.5211027264595032,
-0.1925702840089798,
0.0544254556298255... | |
Passing an undimensioned array to the VB6's Ubound function will cause an error, so I want to check if it has been dimensioned yet before attempting to check its upper bound. How do I do this?
Here's what I went with. This is similar to GSerg's [answer](https://stackoverflow.com/questions/183353/how-do-i-determine-if-a... | [
0.007303191814571619,
-0.15806685388088226,
0.40938064455986023,
0.05998966470360756,
-0.3327053189277649,
-0.14550332725048065,
0.18608716130256653,
-0.4022108316421509,
-0.1812199354171753,
-0.4053441286087036,
-0.0281980000436306,
0.554992139339447,
-0.3548721373081207,
-0.0122528895735... | |
you throw at it, but I'll leave the error checking as an exercise for the reader.
```
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _
(pDst As Any, pSrc As Any, ByVal ByteLen As Long)
Public Function ArrayIsInitialized(arr) As Boolean
Dim memVal As Long
CopyMemory memVal, ByVal VarPtr(ar... | [
-0.1720026731491089,
0.12586051225662231,
0.43758365511894226,
-0.29168757796287537,
0.06036330759525299,
0.0166193637996912,
0.3764236569404602,
-0.171392560005188,
-0.1869502067565918,
-0.24279677867889404,
-0.2630247473716736,
0.9237550497055054,
-0.22230416536331177,
0.2623509168624878... | |
I have a project where I am taking some particularly ugly "live" HTML and forcing it into a formal XML DOM with the HTML Agility Pack. What I would like to be able to do is then query over this with Linq to XML so that I can scrape out the bits I need. I'm using the method described [here](http://vijay.screamingpens.co... | [
0.06933322548866272,
0.32455214858055115,
0.20811393857002258,
-0.08752141147851944,
-0.45075199007987976,
-0.18863189220428467,
0.11143123358488083,
-0.3432289659976959,
0.040257979184389114,
-0.3885006010532379,
0.17493866384029388,
0.6104251146316528,
-0.42826223373413086,
0.10563413053... | |
to query from this document it seems that the namespace attribute is preventing me from doing something like:
```
var x = xDoc.Descendants("div");
// returns null
```
Apparently for those "div" tags only the LocalName is "div", but the proper tag name is the namespace plus "div". I have tried to do some research on ... | [
0.07763440161943436,
0.2084822803735733,
0.5070202946662903,
-0.025121331214904785,
-0.09136470407247543,
-0.10795322805643082,
0.28645744919776917,
-0.3105970323085785,
-0.04600944742560387,
-0.5499497652053833,
-0.16136068105697632,
0.3418547511100769,
-0.31397348642349243,
0.34603559970... | |
and does not properly address the namespace issue. As I understand it a proper XML document can contain multiple namespaces and therefore the proper way to handle it should be to parse out the namespaces I'm querying under. Has anyone else ever had to do this? Am I just making it way to complicated? I know that I could... | [
0.1741999238729477,
0.3291751742362976,
0.2216261625289917,
0.05335813760757446,
-0.2839926481246948,
-0.3905932605266571,
0.1235150545835495,
0.12755002081394196,
-0.2751426100730896,
-0.4965466856956482,
0.10652383416891098,
0.3783188462257385,
-0.19884665310382843,
0.04374130442738533,
... | |
issues down the road.
What is the proper way to deal with namespaces in this situation?
Using `LocalName` should be okay. I wouldn't consider it a hack at all if you don't care what namespace it's in.
If you know the namespace you want and you want to specify it, you can:
```
var ns = "{http://www.w3.org/1999/xhtml... | [
-0.19975173473358154,
0.05301594361662865,
0.45227089524269104,
0.1666879951953888,
0.028850633651018143,
-0.08085475862026215,
0.18440745770931244,
0.046932466328144073,
-0.307761013507843,
-0.7318760752677917,
-0.15162265300750732,
0.3696965277194977,
-0.03248084709048271,
0.355573505163... | |
could use that to do this but it's not really any less of a hack:
```
var x = namespaces.SelectMany(ns=>xDoc.Root.Descendants(ns+"div"));
``` | [
0.03056996501982212,
-0.1786145120859146,
0.1358340084552765,
0.09353373944759369,
0.37676718831062317,
-0.08345750719308853,
0.29494529962539673,
0.030000969767570496,
-0.05869411304593086,
-0.6295841336250305,
0.06871834397315979,
0.3102109134197235,
-0.13367091119289398,
0.3389346897602... | |
Let's say I have a java program that makes an HTTP request on a server using HTTP 1.1 and doesn't close the connection. I make one request, and read all data returned from the input stream I have bound to the socket. However, upon making a second request, I get no response from the server (or there's a problem with the... | [
0.38994884490966797,
0.01763072982430458,
0.06908932328224182,
0.12918047606945038,
-0.20097267627716064,
0.04351690039038658,
0.21144333481788635,
-0.1725613921880722,
-0.0877634659409523,
-0.7011950612068176,
0.05618424713611603,
0.38214731216430664,
-0.20171453058719635,
0.2920534312725... | |
follow). No matter what I do, the second read loop's isr\_reader.read() only ever returns -1.
```
try{
connection = new Socket("SomeServer", port);
con_out = connection.getOutputStream();
con_in = connection.getInputStream();
PrintWriter out_writer = new PrintWriter(con_out, false);
... | [
0.033422648906707764,
0.08121704310178757,
0.7315579056739807,
-0.3400825560092926,
0.19910812377929688,
-0.08936310559511185,
0.4756086468696594,
-0.004823235794901848,
-0.08127094060182571,
-0.7306129336357117,
-0.31070196628570557,
0.4809552729129791,
-0.5098876953125,
0.282369643449783... | |
out_writer.flush();
// If we were not interpreting this data as a character stream, we might need to adjust byte ordering here.
InputStreamReader isr_reader = new InputStreamReader(con_in);
char[] streamBuf = new char[8192];
int amountRead;
StringBuilder receivedData = new Strin... | [
-0.20395027101039886,
-0.2626745104789734,
0.6551497578620911,
-0.4649375081062317,
0.11730488389730453,
0.43434250354766846,
0.22076845169067383,
-0.3633445203304291,
-0.34424611926078796,
-0.5179606676101685,
-0.16265331208705902,
0.3621489703655243,
-0.311391681432724,
0.133587926626205... | |
receivedData.append(streamBuf, 0, amountRead);
}
// Response is processed here.
if(connection != null && !connection.isClosed()){
//System.out.println("Connection Still Open...");
out_writer.print("GET http://someSite2\r\n");
out_writer.print("Host: somehost\r\n");
... | [
-0.2848691940307617,
-0.30117347836494446,
0.7801350355148315,
-0.16414803266525269,
0.09575310349464417,
0.1039469763636589,
0.3570765554904938,
-0.09839463979005814,
-0.2775491774082184,
-0.5950363874435425,
-0.4143969416618347,
0.22349153459072113,
-0.3532485067844391,
0.551092445850372... | |
amountRead = 0;
receivedData.setLength(0);
while((amountRead = isr_reader.read(streamBuf)) > 0 || amountRead < 1){
if (amountRead > 0)
receivedData.append(streamBuf, 0, amountRead);
}
}
// Process response here
}
```
Responses to questions:
Yes, I'm rece... | [
0.13274523615837097,
-0.31029677391052246,
0.4844725728034973,
-0.06448651105165482,
-0.15804597735404968,
0.22696103155612946,
0.17941837012767792,
-0.4529953896999359,
-0.2178107053041458,
-0.6387832760810852,
-0.14014673233032227,
0.4808562695980072,
-0.1176307275891304,
0.1966636031866... | |
outside restriction.
Apologies for the mess of code - I was rewriting it from memory and seem to have introduced a few bugs.
So the consensus is I have to either do (request, request, read) and let the server close the stream once I hit the end, or, if I do (request, read, request, read) stop before I hit the end of ... | [
0.5187932848930359,
-0.023985644802451134,
0.5921012163162231,
0.10928948223590851,
-0.06944809854030609,
-0.19683058559894562,
0.40485745668411255,
-0.10233260691165924,
-0.3882850408554077,
-0.3015838861465454,
-0.26849988102912903,
0.4331628978252411,
-0.1492227464914322,
0.279263615608... | |
first request.
The reason for that is that your code that is supposed to read only the first response
```
while((amountRead = isr_reader.read(streamBuf)) > 0) {
receivedData.append(streamBuf, 0, amountRead);
}
```
will block until the server closes the output stream (i.e., when `read` returns `-1`) or until the r... | [
0.010821312665939331,
-0.40401843190193176,
0.5939669013023376,
-0.11745006591081619,
-0.42658284306526184,
0.06032177060842514,
0.2524126470088959,
-0.2601931691169739,
-0.31569650769233704,
-0.78386390209198,
-0.24132713675498962,
0.3054604232311249,
-0.22510235011577606,
0.1641954183578... | |
deal for HTTP 1.0 responses, because the server simply closes the connection after the response thus enabling you to obtain the response (status line + headers + body) by simply reading everything until the end of the stream.
With HTTP 1.1 persistent connections you can no longer simply read everything until the end o... | [
0.383774071931839,
-0.5198109149932861,
0.7618361711502075,
-0.046771541237831116,
-0.25684401392936707,
-0.23586362600326538,
0.0024986995849758387,
-0.4467606842517853,
-0.47211092710494995,
-0.6707357168197632,
-0.39629581570625305,
0.6801770329475403,
-0.45974937081336975,
-0.086218416... | |
do the above properly, your read operations will complete before the connection is closed or a timeout happens, and you will have read exactly the response the server sent. This will enable you to send the next request and then read the second response in exactly the same manner as the first one.
P.S. Request, request... | [
0.12929722666740417,
-0.08676118403673172,
0.5880938172340393,
0.16891025006771088,
0.06620506197214127,
0.1823292374610901,
-0.07372883707284927,
-0.2760171592235565,
-0.33954647183418274,
-0.7531588673591614,
-0.28296610713005066,
0.5377508401870728,
-0.038896434009075165,
-0.17014367878... | |
depending on your system encoding, the request line and headers of your HTTP requests might be malformed (wrong encoding). | [
0.373844712972641,
-0.039466485381126404,
-0.09681814908981323,
0.32822713255882263,
0.05958864092826843,
0.08341459929943085,
0.6954305171966553,
0.2195095717906952,
-0.11004454642534256,
-0.7902204394340515,
-0.11572229862213135,
0.10736443102359772,
-0.0578705295920372,
0.34818634390830... | |
A table row is generated using an asp:Repeater:
```
<asp:repeater ID="announcementsRepeater" OnItemDataBound="announcementsRepeater_ItemDataBound" runat="Server">
<itemtemplate>
<tr id="announcementRow" class="announcementItem" runat="server">...</tr>
</itemtemplate>
</asp:repeater>
```
Now in the data-b... | [
-0.07548199594020844,
0.09057009965181351,
0.6389296650886536,
-0.09142887592315674,
-0.3183393180370331,
0.24237649142742157,
-0.16645391285419464,
-0.08808516710996628,
-0.052161429077386856,
-0.4003926217556,
-0.4309736490249634,
0.2910356819629669,
-0.24049949645996094,
0.3390578031539... | |
if (row != null)
row.CssClass = row.CssClass + " announcementItemUnread";
}
```
except the cast fails at runtime:
```
System.InvalidCastException occurred
Message="Unable to cast object of type 'System.Web.UI.HtmlControls.HtmlTableRow' to type 'System.Web.UI.WebControls.WebControl'."
```
It turns out t... | [
-0.1939094215631485,
0.16539980471134186,
0.4622271955013275,
-0.2561779320240021,
-0.37941789627075195,
-0.05615759268403053,
0.2323593646287918,
-0.18245144188404083,
-0.05811186879873276,
-0.5510480999946594,
-0.42560699582099915,
0.18621017038822174,
-0.5385561585426331,
0.482120037078... | |
row.CssClass = row.CssClass + " announcementItemUnread";
```
But `Control` doesn't contain a definition for `CssClass`:
```
'System.Web.UI.Control' does not contain a definition for 'CssClass'
```
so how do i set the css class name for a `<TR>` element during DataBind?
```
HtmlControl htmlRow = (HtmlControl... | [
-0.01050835195928812,
0.08440982550382614,
0.6193503737449646,
-0.16043439507484436,
-0.31179752945899963,
-0.08748211711645126,
-0.09213410317897797,
-0.04135856404900551,
-0.34051305055618286,
-0.5478003025054932,
-0.45242738723754883,
0.1946008801460266,
-0.2709934413433075,
0.359366953... | |
By default, cocoa progress bars are slightly fat and I want something a little slimmer, like the progress bars seen in the Finder copy dialog. However, Interface Builder locks the `NSProgressIndicator` control height to 20 pixels and my programmatic attempts to slim down aren't working, as calls to
```
[progressBar se... | [
-0.025424912571907043,
-0.035278983414173126,
0.6011201739311218,
0.04202064499258995,
-0.11756757646799088,
0.15614548325538635,
0.03269832581281662,
-0.012638919986784458,
-0.2506178319454193,
-0.8036432266235352,
0.015820564702153206,
0.5489040017127991,
-0.2347899228334427,
-0.03984833... | |
size selector that offers "Regular" and "Small" sizes. | [
0.08055675774812698,
-0.3256244957447052,
0.0005514182848855853,
-0.05291037634015083,
-0.08161468058824539,
0.24265865981578827,
-0.3785914182662964,
-0.4111559987068176,
-0.4184143841266632,
-0.6815107464790344,
-0.19934357702732086,
0.4576268792152405,
0.20717521011829376,
0.15391899645... | |
i need to compress my css as part of my ant build. i noticed that csstidy does this, but it would not be easy to include this in my ant build because i would need to use a different binary on different platforms.
so, is there a java css compressor that people use?
Check out the [Yahoo YUI compressor](http://developer.... | [
0.2710414230823517,
0.06302744895219803,
0.10308940708637238,
-0.08183343708515167,
-0.37826254963874817,
0.17577654123306274,
0.019744353368878365,
0.004217950161546469,
-0.14260300993919373,
-0.9822165966033936,
0.1797536313533783,
0.3938121497631073,
-0.3270408511161804,
0.0854843631386... | |
Is there any way to determine a removable drive speed in Windows without actually reading in a file. And if I do have to read in a file, how much needs to be read to get a semi accurate speed (e.g. determine whether a device is USB2 or USB1)?
**EDIT**: Just to clarify, USB2 and USB1 were an example. These could be Com... | [
0.2792518436908722,
-0.053717780858278275,
0.39894115924835205,
0.36759456992149353,
-0.00440684100612998,
-0.20329678058624268,
-0.13583295047283173,
0.08241691440343857,
-0.463904470205307,
-0.6915152668952942,
-0.06775359809398651,
0.8625580072402954,
0.03831132501363754,
-0.05431187525... | |
be done programatically. It will probably be done in C++.
**EDIT**: Boost answer is kind of what I was looking for (though I haven't written any WMI in C++). But I need to know what properties I have to check to determine relative speed. I don't need exact speed (like I said about the difference in speed between USB1 ... | [
0.37318772077560425,
0.06762375682592392,
0.6482939720153809,
0.2868618071079254,
-0.07962685823440552,
-0.33293455839157104,
0.003003074089065194,
-0.10622665286064148,
-0.43365103006362915,
-0.46734920144081116,
-0.04321068152785301,
0.8570730090141296,
0.1642041653394699,
-0.18453308939... | |
particular manufacturers and models to speeds, which is not as simple a solution as you may have hoped for. | [
0.0940495952963829,
-0.02587774768471718,
0.30524006485939026,
0.5676108598709106,
0.07420667260885239,
0.06711771339178085,
-0.04291214793920517,
-0.05383709818124771,
-0.34912535548210144,
-0.6300580501556396,
-0.09614602476358414,
0.47593826055526733,
0.18495279550552368,
0.002490351442... | |
I would like to ask for some simple examples showing the uses of `<div>` and `<span>`. I've seen them both used to mark a section of a page with an `id` or `class`, but I'm interested in knowing if there are times when one is preferred over the other.
* `div` is a [block element](https://en.wikipedia.org/wiki/HTML_elem... | [
0.2566848695278168,
0.05758460611104965,
0.41416430473327637,
0.1308446228504181,
-0.5115898847579956,
-0.09650556743144989,
-0.20100486278533936,
-0.32606008648872375,
-0.32020261883735657,
-0.6055347919464111,
-0.3602803349494934,
0.1711873859167099,
-0.1306934654712677,
0.13855963945388... | |
Note that it is illegal to place a block-level element within an inline element, so:
```
<div>Some <span>text that <div>I want</div> to mark</span> up</div>
```
...is illegal.
---
EDIT: As of HTML5, some block elements can be placed inside of some inline elements. See the MDN reference [here](https://developer.moz... | [
0.4875699579715729,
0.2097005397081375,
0.30464181303977966,
-0.057422440499067307,
-0.325908362865448,
0.006392377428710461,
-0.12814588844776154,
-0.377481073141098,
-0.49642643332481384,
-0.18686924874782562,
0.22162842750549316,
-0.013174615800380707,
-0.4723970293998718,
0.17096960544... | |
href="https://www.bowlsk.com/_ah/logout?...">Sign out</a>
</div>
<h1><a href="/">Bowl<span class="sk">SK</span></a></h1>
</div>
```
Ok, what's going on?
--------------------
At the top of my page, I have a logical section, the "header". Since this is a section, I use a div (with an appropriate id). Within tha... | [
0.21305210888385773,
0.3293367028236389,
1.1466779708862305,
-0.08535657078027725,
-0.5507023334503174,
0.060149479657411575,
0.008231931366026402,
-0.11659342050552368,
-0.12824663519859314,
-0.6334822177886963,
-0.30911633372306824,
-0.043415918946266174,
0.011560346931219101,
0.12457032... | |
the title - this allows me to change their color in my stylesheet.
Also note that HTML5 includes a broad new set of elements that define common page structures, such as article, section, nav, etc.
Section 4.4 of the [HTML 5 working draft](https://dev.w3.org/html5/spec/Overview.html) lists them and gives hints as to ... | [
0.5008196234703064,
0.045662134885787964,
0.48042282462120056,
0.35661405324935913,
-0.17388908565044403,
-0.2517838478088379,
0.02855043113231659,
-0.06520336121320724,
-0.28986185789108276,
-0.5117976069450378,
-0.19305725395679474,
0.45220720767974854,
0.29983949661254883,
0.16071172058... | |
You need to create one of each element using `document.createElement` before any of those elements are specified in your source. There are a bunch of libraries that will take care of this for you - a quick Google search turned up [html5shiv](https://code.google.com/p/html5shiv/). | [
0.5625463128089905,
0.15420524775981903,
0.08436180651187897,
0.155424565076828,
0.07773648947477341,
-0.10624870657920837,
0.1619579941034317,
-0.14809264242649078,
-0.062159474939107895,
-0.5843415856361389,
-0.005803327076137066,
0.0716891661286354,
-0.052530717104673386,
-0.01106632128... | |
I have a User class which may or may not have an associated Department. This is referenced through the foreign key DepartmentId, and the relevant field in the User table is set to allow nulls.
When I set up my "Create User" form and select no Department, I get a conflict error on SubmitChanges():
```
The INSERT state... | [
-0.08090143650770187,
0.3622404634952545,
0.42483535408973694,
-0.17939259111881256,
-0.018013302236795425,
0.1099434345960617,
0.25882765650749207,
-0.16983908414840698,
-0.1234729140996933,
-0.29899242520332336,
-0.2306249588727951,
0.3101736605167389,
-0.3998563289642334,
0.241555675864... | |
does this? I am currently using "None" because using null or "" cause no "blank option" to be displayed, and I suspect that this may be contributing to the problem. Thanks for any assistance.
I have found a less-than-desirable solution by putting the following in my `UsersController.Create` method:
```
// Snipped Upda... | [
0.22341158986091614,
0.12029501795768738,
0.6446611285209656,
0.004563499707728624,
0.19559630751609802,
-0.18947143852710724,
0.32309725880622864,
0.11129017174243927,
-0.41995084285736084,
-0.7751210927963257,
-0.11276782304048538,
0.5438952445983887,
-0.17764542996883392,
0.209210753440... | |
I'm moving DB from MySQL (used ODBC) to MS SQL and I want to "translate" SQL queries to LINQ. Can someone help me with this (it should SUM Charge column for every location and group result by months):
```
SELECT
sum(case when Location="Location1" then Charge else 0 end) as Location1,
sum(case when Location="Location2"... | [
0.06449908763170242,
0.2126893550157547,
0.7057952880859375,
-0.25537461042404175,
-0.3621550500392914,
0.1334572732448578,
0.08918054401874542,
-0.7275235056877136,
0.14972463250160217,
-0.37769854068756104,
0.03496314212679863,
0.1502879112958908,
-0.01979919523000717,
0.4250420331954956... | |
= context.log_sales
.GroupBy(c => c.OrderTime)
.Select(g => new
{ | [
-0.029336929321289062,
-0.16076023876667023,
0.4061720669269562,
-0.27175602316856384,
0.14558923244476318,
0.10942988842725754,
0.08623246103525162,
-0.4478068947792053,
-0.2858223021030426,
-0.2722497880458832,
-0.4516599178314209,
0.6481056213378906,
-0.31660452485084534,
0.400031536817... | |
Date = g.Key,
Location1 = g.Where(c => c.Location == "Location1").Sum(c => c.Charge) ?? 0,
Location2 = g.Where(c | [
-0.007251516915857792,
-0.24984093010425568,
0.5549330115318298,
0.1462036371231079,
0.3017478287220001,
0.11520148813724518,
-0.28917592763900757,
-0.09031451493501663,
-0.20070157945156097,
0.00350388721562922,
-0.30836179852485657,
-0.1580580323934555,
-0.07281047850847244,
0.3761168122... | |
=> c.Location == "Location2").Sum(c => c.Charge) ?? 0
}).ToList();
```
and it is almost what I need. There should be grouping by year too and I don't know how to do this.
This might help.
```
context.log_sales
.GroupBy(s => new {Year = OrderTime.Year, Month = OrderTime.Month})
.Select
( g... | [
0.11587496846914291,
-0.11903557926416397,
0.7223913073539734,
-0.06581004709005356,
0.34454572200775146,
0.12167594581842422,
-0.16915637254714966,
-0.5282480120658875,
-0.4851965308189392,
-0.2718959450721741,
-0.26180094480514526,
0.2992249131202698,
0.0009039968135766685,
0.43044739961... | |
= g.Where(s => s.Location == "Location3").Sum(s => s.Charge),
}
)
.OrderBy(x => x.Date);
``` | [
0.01913081482052803,
-0.1726590096950531,
0.6472541689872742,
-0.28345969319343567,
0.2627023458480835,
0.04014189913868904,
-0.03513937070965767,
-0.46480029821395874,
-0.24568402767181396,
-0.15887008607387543,
-0.5606465935707092,
0.16569854319095612,
-0.5335443615913391,
0.682337403297... | |
What tool is there for generating C# classes from NHibernate mappings files?
On the [NHibernate resources page](http://nhibernate.info/doc/nh/en/index.html#toolsetguide-s2) under 'Helpful tools', there are a few code generators listed:
[http://nhibernate.info/doc/nh/en/index.html](http://nhibernate.info/doc/nh/en/index... | [
-0.08124794065952301,
0.1302584707736969,
-0.1506546288728714,
-0.08976970613002777,
-0.4411434531211853,
0.15084291994571686,
0.10541943460702896,
-0.2458128184080124,
-0.27552932500839233,
-0.49598321318626404,
-0.03863947466015816,
0.22917668521404266,
-0.15714074671268463,
0.2832433581... | |
In the [Google C++ Style Guide](http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml), the [section on Operator Overloading](http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Operator_Overloading) recommends against overloading *any* operators ("except in rare, special circumstances"). Specifical... | [
-0.1135677918791771,
0.030685164034366608,
-0.04043686389923096,
0.09073025733232498,
0.013786807656288147,
-0.3563651144504547,
0.23642562329769135,
-0.11211297661066055,
0.004745057318359613,
-0.38293227553367615,
-0.3066439628601074,
0.5191495418548584,
-0.6152186393737793,
0.0039826584... | |
function, be simpler? Is there any advantage to using one over the other?
Except for the more fundamental types, the less-than operation isn't always trivial, and even equality may vary from situation to situation.
Imagine the situation of an airline that wants to assign all passengers a boarding number. This number r... | [
-0.1529623568058014,
-0.572643518447876,
0.4003719985485077,
0.4442165791988373,
0.1847381293773651,
0.22088932991027832,
-0.1071416437625885,
-0.05444148927927017,
-0.2794189155101776,
-0.543718159198761,
0.061623573303222656,
0.7004792094230652,
-0.47254443168640137,
-0.09354760497808456... | |
compare ticket prices.
… and so on. All in all, it's just not meaningful to define an `operator <` on the `Passenger` class although it may be required to have passengers in a sorted container. I think that's what Google warns against. | [
0.21410730481147766,
-0.040479861199855804,
0.20015279948711395,
0.5506487488746643,
0.14485660195350647,
-0.21323104202747345,
-0.04247729107737541,
0.3309154808521271,
-0.19901390373706818,
-0.5467347502708435,
0.21235282719135284,
0.30212104320526123,
-0.1905175745487213,
0.167335659265... | |
It seems like most examples of JPA/Hibernate entity bean classes I've seen do no explicit synchronization. Yet, it is possible to call getters/setters on those objects in the context of building up a transaction. And it's possible for those methods to be called across multiple threads (although maybe that's unusual and... | [
0.17954087257385254,
0.0007656524539925158,
-0.012122229672968388,
0.2540833652019501,
-0.31790897250175476,
-0.3360968828201294,
0.3071467876434326,
0.24074187874794006,
-0.20131462812423706,
-0.4624374210834503,
0.06755141168832779,
0.4506171643733978,
-0.28502389788627625,
0.20284880697... | |
class Ninja {
@Id @GeneratedValue
private Long id;
@Column
private String name;
@Column
private int throwingStars;
public Ninja() {}
public int getThrowingStars() { return throwingStars; }
public void addThrowingStar() { throwingStars += 1; }
}
```
Do the throwing star methods need synchronizat... | [
0.3959783911705017,
-0.3490634560585022,
-0.34197068214416504,
0.15149758756160736,
-0.4074628949165344,
-0.0685504600405693,
0.8229284882545471,
-0.48248013854026794,
-0.05790983512997627,
-0.3279901146888733,
0.00940378475934267,
0.7744693160057068,
-0.17255744338035583,
0.24986381828784... | |
objects for each get(), unless they are in the session).
As for your stars question, it's the same when two persons fetch the same row from a DB, the DB 'ACID' properties will make sure that each operation is atomic, so if you remove a star from a ninja in Thread t1 and **commit**, Thread t2 will read the committed va... | [
-0.13968388736248016,
-0.4013306498527527,
0.045707374811172485,
0.1271398365497589,
-0.23036478459835052,
0.06810324639081955,
0.6781046986579895,
-0.5355400443077087,
-0.21655942499637604,
-0.29588794708251953,
0.04224324971437454,
0.4872255027294159,
-0.13699059188365936,
0.172153502702... | |
I have this code that performs an ajax call and loads the results into two duplicate divs every time a dropdown is changed. I want the results to be faded into the div, to give a more obvious indication that something has changed, as its so seamless its sometimes hard to notice the change!
```
print("$('.ajaxdropdown'... | [
0.5341493487358093,
-0.24345701932907104,
0.5225035548210144,
-0.07503122091293335,
0.12068092823028564,
-0.14265884459018707,
0.17283906042575836,
-0.01111169159412384,
-0.07406257838010788,
-0.5952489376068115,
-0.03627869114279747,
0.611284077167511,
-0.35513100028038025,
-0.15069890022... | |
"c_name="+escape($(this).val()),
success: function(html){
$("#charges-gsm").html(html);
//i want to fade result into these 2 divs...
$("#charges-gsm-faq").html(html); | [
0.1324242204427719,
0.2988564968109131,
0.7470317482948303,
-0.2431773841381073,
0.46444883942604065,
-0.15031860768795013,
0.3797924518585205,
-0.46916988492012024,
-0.3208230435848236,
-0.19007018208503723,
-0.3900679051876068,
0.7410629987716675,
-0.33650466799736023,
0.0746354833245277... | |
$("#charges-gsm-prices").html(html);
}
});
});");
```
I've tried appending the fadein method and a few other things, but no joy.
You'll have to `hide()` it before you can use `fadeIn()`.
**UPDATE:** Here's how you'd do this by chaining:
```
$("#charges-gsm-faq").hide().html(html).fadeIn();
$... | [
0.6444551944732666,
0.11764581501483917,
0.675270140171051,
-0.03220587968826294,
-0.06542248278856277,
-0.2734576165676117,
-0.007229439448565245,
-0.37154969573020935,
-0.1952911615371704,
0.014634817838668823,
-0.2929477095603943,
0.8533837199211121,
-0.604468822479248,
0.03362242504954... | |
Whenever I restore a backup of my database in SQL Server I am presented with the following error:
```
Msg 3101, Level 16, State 1, Line 1
Exclusive access could not be obtained because the database is in use.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.
```
Usually to get around th... | [
0.07754669338464737,
0.22855789959430695,
0.5192288756370544,
-0.04610532522201538,
0.21114583313465118,
-0.2797192633152008,
0.7177924513816833,
0.2942056953907013,
-0.478099524974823,
-0.35415002703666687,
-0.18052007257938385,
0.3416629433631897,
-0.38288477063179016,
0.5737164616584778... | |
nightmare. Regardless our simple solution was to put it on a shared server in the office and backup the server occasionally in case someone screwed up the data.
Well, I screwed up the data and needed to restore. Unfortunately, I have another co-worker in the office who is working on another project and is using the sa... | [
0.272706001996994,
0.18364432454109192,
0.22554951906204224,
0.4164682626724243,
0.2413337677717209,
0.015969039872288704,
0.47346511483192444,
0.45496299862861633,
-0.3138110041618347,
-0.5981507301330566,
0.07531475275754929,
0.42374807596206665,
-0.264081209897995,
0.7482009530067444,
... | |
offline and drop connections with:
```
EXEC sp_dboption N'yourDatabase', N'offline', N'true'
```
Or you can
```
ALTER DATABASE [yourDatabase] SET OFFLINE WITH
ROLLBACK AFTER 60 SECONDS
```
Rollback specifies if anything is executing. After that period they will be rolled back. So it provides some protection.
Sor... | [
0.14166416227817535,
-0.14720158278942108,
0.5075900554656982,
0.20368655025959015,
0.05431940779089928,
-0.2374771237373352,
0.2665679454803467,
0.17887502908706665,
-0.5585486888885498,
-0.22718021273612976,
-0.24101150035858154,
0.5339416861534119,
-0.23499073088169098,
-0.1144097968935... | |
Something like
```
var life= {
users : {
guys : function(){ this.SOMETHING.mameAndDestroy(this.girls); },
girls : function(){ this.SOMETHING.kiss(this.boys); },
},
mameAndDestroy : function(group){ },
kiss : function(group){ }
};
```
this.SOMETHING is what I ... | [
0.38122180104255676,
-0.39559799432754517,
0.2674352526664734,
0.03966802731156349,
0.3281187117099762,
-0.1516965627670288,
0.2453303337097168,
0.3435947597026825,
-0.1446702629327774,
-0.5023319721221924,
-0.3280237317085266,
0.45030027627944946,
-0.22608880698680878,
0.2496805191040039,... | |
object?
JavaScript does not offer this functionality natively. And I doubt you could even create this type of functionality. For example:
```
var Bobby = {name: "Bobby"};
var Dad = {name: "Dad", children: [ Bobby ]};
var Mom = {name: "Mom", children: [ Bobby ]};
```
Who does Bobby belong to? | [
0.014254712499678135,
0.22726725041866302,
0.045927464962005615,
-0.05215676501393318,
0.02195701189339161,
0.14896218478679657,
0.44266027212142944,
-0.17888255417346954,
-0.06849946826696396,
-0.10563974827528,
-0.27050819993019104,
0.4024497866630554,
-0.4372732639312744,
0.283933430910... | |
Scenario: Attempting to import many (>100), large(>1M recs) flat-files (csv).
Problem: Many records are missing field delimiters.
Asking: Is there a parsing tool that will attempt to define and validate the file and allow you to make "in-line" corrections?
**ETA:** I'm attempting to import this files to MS SQL Serve... | [
0.19434213638305664,
-0.1277076005935669,
-0.01076095923781395,
0.2515438199043274,
0.14293710887432098,
0.22356590628623962,
0.22680695354938507,
-0.07670466601848602,
-0.398185670375824,
-0.5718058347702026,
-0.06665048003196716,
0.5945909023284912,
-0.2802908420562744,
-0.19879442453384... | |
that I've encountered in CSV files (missing delimiters, bad separator values, embedded CR/LF in the middle of fields, etc.), it was worth writing my own. That way when I find a new problem I just extend my existing program to deal with it.
I should probably change my nickname to NIH given my propensities. | [
0.3519632816314697,
0.2271396815776825,
-0.04093353450298309,
-0.08293227106332779,
-0.20045506954193115,
-0.12686912715435028,
-0.06799915432929993,
0.48757296800613403,
-0.27700620889663696,
-0.40870413184165955,
0.16234003007411957,
0.16302455961704254,
0.0010441038757562637,
0.26582714... | |
I have two collections which have property `Email` in both collections. I need to get a list of the items in the first list where `Email` does not exist in the second list. With SQL I would just use "not in", but I do not know the equivalent in LINQ. How is that done?
So far I have a join, like...
```
var matches = f... | [
0.09942096471786499,
0.15506410598754883,
0.3876993656158447,
-0.09894182533025742,
-0.10643410682678223,
-0.16710461676120758,
0.1247410997748375,
-0.40852534770965576,
-0.35143017768859863,
-0.6702282428741455,
0.12243816256523132,
0.39795395731925964,
-0.3259141743183136,
0.248075738549... | |
Exists I believe. I just have not found an example to do that yet.
I don't know if this will help you but..
```
NorthwindDataContext dc = new NorthwindDataContext();
dc.Log = Console.Out;
var query =
from c in dc.Customers
where !(from o in dc.Orders
select o.CustomerID)
... | [
0.11753614991903305,
0.2263694405555725,
1.1472785472869873,
-0.047939058393239975,
0.4046926498413086,
-0.040629372000694275,
0.20435699820518494,
0.11037173122167587,
-0.23649151623249054,
-0.6474161148071289,
-0.062496744096279144,
0.3033069670200348,
-0.27853116393089294,
0.48959347605... | |
in query) Console.WriteLine( c );
```
from [The NOT IN clause in LINQ to SQL](https://web.archive.org/web/20120321161927/https://www.programminglinq.com/blogs/marcorusso/archive/2008/01/14/the-not-in-clause-in-linq-to-sql.aspx) by [Marco Russo](https://web.archive.org/web/20110805143247/http://introducinglinq.com/blo... | [
-0.25219935178756714,
0.09719949960708618,
0.4119948446750641,
-0.05003979802131653,
0.24534550309181213,
0.09727931022644043,
-0.05719867721199989,
-0.22180670499801636,
-0.22255028784275055,
-0.024037731811404228,
-0.4562520384788513,
0.35793188214302063,
-0.5841206908226013,
-0.04395732... | |
JPEG, GIF and PNG can be displayed with the img tag and will work in all browsers, the object element can be use for displaying images specifying its MIME type, but what other graphic formats are supported by img or object tag in most browsers without installing plugins? (TIF, SVG, PCX, PICT, etc..)
There's an excellen... | [
0.36080458760261536,
-0.013753831386566162,
0.4547237753868103,
0.18588967621326447,
-0.5667842030525208,
-0.04266814887523651,
-0.08774042129516602,
0.09371363371610641,
-0.3263606131076813,
-0.916094183921814,
-0.22639745473861694,
0.4487302303314209,
-0.4102623760700226,
-0.009752259589... | |
correctly display images with gamma correction or color correction. Versions of Internet Explorer prior to version 7 are unable to correctly display images with alpha channel (for transparency) without additional coding | [
-0.18348930776119232,
-0.04457201436161995,
0.3811788558959961,
-0.05792054533958435,
-0.1275082379579544,
-0.19430047273635864,
0.6467352509498596,
0.24066777527332306,
0.13279543817043304,
-0.8403584957122803,
-0.3243465721607208,
0.4438735246658325,
-0.66641765832901,
-0.156200155615806... | |
Is there a benefit to using one over the other? In Python 2, they both seem to return the same results:
```
>>> 6/3
2
>>> 6//3
2
```
In Python 3.x, `5 / 2` will return `2.5` and `5 // 2` will return `2`. The former is floating point division, and the latter is ***floor division***, sometimes also called ***integer di... | [
-0.011057965457439423,
0.1173628494143486,
0.1869926005601883,
-0.22352401912212372,
0.033911045640707016,
-0.07322961837053299,
-0.28345537185668945,
-0.5677060484886169,
-0.6272239089012146,
-0.3740122318267822,
-0.14631421864032745,
0.3236475884914398,
-0.07743535190820694,
-0.039393555... | |
division result of the operation.
You can find a detailed description at *[PEP 238: Changing the Division Operator](https://docs.python.org/whatsnew/2.2.html#pep-238-changing-the-division-operator)*. | [
0.08702400326728821,
-0.09497488290071487,
0.21184079349040985,
-0.31914255023002625,
0.11875590682029724,
0.08364218473434448,
-0.10394666343927383,
-0.3899313509464264,
-0.5176578760147095,
-0.05226392671465874,
-0.2277316004037857,
0.4136384129524231,
-0.27166157960891724,
0.21486984193... | |
Is there any way to clean up this type of loop using LINQ?
```
List<Car> result;
List<string> makes;
List<string> models;
for (int i = 0; i < makes.Count() && i < models.Count(); i++)
{
result.Add(new Car() { Make = makes[i], Model = models[i] });
}
```
Basically I'm looking for some way to collate ... | [
0.33726343512535095,
-0.13688026368618011,
0.4462205767631531,
0.15319058299064636,
0.06765487790107727,
0.41641107201576233,
-0.03596525639295578,
-0.5981454849243164,
-0.33929166197776794,
-0.48211756348609924,
0.010337337851524353,
0.4606907367706299,
-0.08751541376113892,
0.37838992476... | |
}).ToList();
```
If `makes` and `models` always contain the same number of items, you can use more compact syntax:
```
List<Car> result = makes.Select((make, i) => new Car { Make = make, Model = models[i] }).ToList();
``` | [
0.3180679678916931,
-0.04886475205421448,
0.411574125289917,
-0.025421081110835075,
0.5355044603347778,
0.34081223607063293,
-0.03077593632042408,
-0.5465429425239563,
-0.26911821961402893,
-0.5607667565345764,
-0.37418320775032043,
0.6104550957679749,
-0.14572007954120636,
0.3017020523548... | |
I'm working on a home project that involves comparing images to a database of images (using a quadrant - or so - histogram approach). I wanted to know what my options are in regards to web cams or other image capture devices that:
* Are easy to work with with the
Windows SDK (particularly
[DirectShow](http://msdn.micr... | [
0.6309951543807983,
0.26379504799842834,
0.28659191727638245,
0.17495116591453552,
-0.04728768393397331,
0.1273936927318573,
-0.27261343598365784,
-0.050511281937360764,
-0.08214065432548523,
-0.399184912443161,
0.2510949969291687,
0.6313859820365906,
-0.07836973667144775,
-0.0719669908285... | |
I should look at. I suspect that any old web cam will do but I'd rather be safe than sorry.
Use the ScriptManager server control:
```
<asp:ScriptManager ID="myScriptManager" runat="server">
<Scripts>
<asp:ScriptReference Path = "~/javascript/actions.js" />
<asp:ScriptReference Path = "~/javascript/j... | [
0.11052139848470688,
0.06247072294354439,
0.39972424507141113,
-0.04416907951235771,
-0.03084040805697441,
-0.2105625718832016,
0.010499553754925728,
-0.11719398200511932,
-0.08162311464548111,
-0.7657174468040466,
0.05709455534815788,
0.9176191091537476,
0.01954720914363861,
-0.1457134485... | |
I'm currently in the process of choosing a project for a grad-level compiler course to be done over the next 8 weeks. I'd like to do something related to optimization since I haven't worked much in that area before, but anything in the field is fair game.
What was the most interesting compiler-related project you've ... | [
0.5232445597648621,
0.0722065269947052,
-0.08195182681083679,
0.3010910451412201,
-0.1185627430677414,
-0.3513566553592682,
0.004857418593019247,
0.2387552559375763,
-0.09796041250228882,
-0.7927970290184021,
0.2504573464393616,
0.4984002709388733,
0.24804450571537018,
-0.05947962030768394... | |
be any way to take advantage of them without support for the front-end. This optimization converted normal scalar code into vector code.
Since auto-vectorization is a fairly difficult optimization to implement, we limited our scope as much as we could. First, in order to expose instruction level parallelism in the cod... | [
0.1791003793478012,
-0.23859761655330658,
-0.17065134644508362,
-0.08794412761926651,
-0.12628412246704102,
0.4301028251647949,
-0.1253993660211563,
-0.401496946811676,
0.03694590553641319,
-0.4261891841888428,
-0.06804940104484558,
0.35499173402786255,
-0.8269639015197754,
-0.169479250907... | |
is pretty complicated. There are a lot of constraints; for instance, you don't want to vectorize a variable that lives out of the loop, since the rest of the program expects it to be scalar. We put in a lot of hours in the last few weeks. The project was a lot of fun though, and we learned a lot.
If you're interested i... | [
0.4862431287765503,
-0.3275206387042999,
-0.0763007327914238,
0.19951656460762024,
0.03580378741025925,
0.05201874300837517,
-0.1271042674779892,
0.09252862632274628,
-0.3001587688922882,
-0.26272618770599365,
0.359562486410141,
0.38454103469848633,
-0.24518375098705292,
0.0062853186391294... | |
How do I do forward referencing / declaration in C++ to avoid circular header file references?
I have the #ifndef guard in the header file, yet memory tells me I need this forward referencing thing - which i've used before >< but can't remember how.
You predeclare the class without including it. For example:
```
//#i... | [
0.06432629376649857,
0.4162909984588623,
0.4282700717449188,
-0.40170466899871826,
-0.216804638504982,
-0.11162058264017105,
0.03319459781050682,
-0.5552902817726135,
-0.04761682450771332,
-0.1793605536222458,
0.08306087553501129,
0.4060925543308258,
-0.3568197190761566,
0.3581239581108093... | |
Say you've loaded a text file into a string, and you'd like to convert all Unicode escapes into actual Unicode characters inside of the string.
Example:
> "The following is the top half of an integral character in Unicode '\u2320', and this is the lower half '\U2321'."
The answer is simple and works well with string... | [
-0.21380755305290222,
-0.032308951020240784,
0.6448532938957214,
-0.20179621875286102,
0.13041485846042633,
0.16762663424015045,
0.19179752469062805,
-0.7461062669754028,
0.013414214365184307,
-0.3387477695941925,
-0.6568400263786316,
0.6881647706031799,
-0.3713253438472748,
-0.16262966394... | |
example shows the replacement being made using a lambda expression (C# 3.0) and the second uses a delegate which should work with C# 2.0.
To break down what's going on here, first we create a regular expression:
```
new Regex( @"\\[uU]([0-9A-F]{4})" );
```
Then we call Replace() with the string 'result' and an anon... | [
-0.3037261366844177,
-0.09734439849853516,
0.2700798809528351,
0.021161342039704323,
0.13523072004318237,
0.17719319462776184,
0.24118098616600037,
-0.4923590123653412,
-0.10634882748126984,
-0.34492504596710205,
-0.4664255380630493,
0.5449536442756653,
-0.510858416557312,
-0.0385878123342... | |
(skip the first two characters).
```
match.Value.Substring(2)
```
Parse that string using Int32.Parse() which takes the string and the number format that the Parse() function should expect which in this case is a hex number.
```
NumberStyles.HexNumber
```
Then we cast the resulting number to a Unicode character:
... | [
-0.22730617225170135,
0.13236504793167114,
0.2856595516204834,
-0.3831527829170227,
-0.009705179370939732,
0.09050111472606659,
0.05266255885362625,
-0.5912503600120544,
0.13532643020153046,
-0.37908244132995605,
-0.2156457006931305,
0.6304336190223694,
-0.36709779500961304,
-0.30561059713... | |
readable. | [
-0.20903193950653076,
0.42770448327064514,
0.09074141830205917,
0.09227047115564346,
0.025663919746875763,
-0.5062947869300842,
0.040699735283851624,
0.5803966522216797,
0.10667100548744202,
-0.6047987937927246,
-0.5428951978683472,
0.090870700776577,
-0.04425017163157463,
-0.1048674955964... | |
I have a class that has a Generic type "G"
In my class model i have
```
public class DetailElement : ElementDefinition
```
Let's say i have a method like this
```
public void DoSomething<G>(G generic)
where G : ElementDefinition
{
if (generic is DetailElement)
{ | [
0.036995429545640945,
-0.18250158429145813,
0.2482185661792755,
0.07680946588516235,
-0.15252019464969635,
0.030862674117088318,
0.05632716789841652,
-0.30542805790901184,
0.0006404047599062324,
-0.6412544250488281,
0.13490702211856842,
0.6453353762626648,
-0.5322511792182922,
0.1730253249... | |
((DetailElement)generic).DescEN = "Hello people"; //line 1
//////
ElementDefinition element = generic;
((DetailElement)element).DescEN = "Hello again"; //line 3
//////
(generic as DetailElement).DescEN = "Howdy"; | [
-0.2928783595561981,
-0.3242407441139221,
0.3289646804332733,
0.0806402713060379,
0.0031969789415597916,
0.2785249352455139,
0.43044036626815796,
0.33299708366394043,
-0.11784325540065765,
-0.8615431785583496,
-0.7490796446800232,
0.7148426175117493,
-0.042379140853881836,
-0.0004859112959... | |
//line 5
}
else
{
//do other stuff
}
}
```
Compiler reports one error in line 1:
```
Cannot convert type 'G' to 'DetailElement'
```
But line 3 works fine.
I can workaround this issue by doing the code written | [
-0.03624482825398445,
0.22845469415187836,
0.18263733386993408,
-0.027817513793706894,
-0.1544744223356247,
0.05502341687679291,
0.507283627986908,
-0.2524840831756592,
0.02586444281041622,
-0.643960177898407,
-0.25314441323280334,
0.694494903087616,
-0.46226978302001953,
-0.28818526864051... | |
in line 5.
**What i would like to know is why does the compiler reports the error in line 1 and not the one in line 3, given that, as far as i know, they are identical.**
edit: I am afraid i might be missing some important piece of the framework logic
edit2: Although solutions for the compiler error are important, m... | [
-0.05916890501976013,
0.11868710815906525,
0.15722261369228363,
-0.07349144667387009,
-0.2648765444755554,
0.12222976237535477,
0.4991794526576996,
-0.2241021692752838,
-0.10806291550397873,
-0.45744553208351135,
-0.31488168239593506,
0.5503681898117065,
-0.5338021516799927,
-0.10238298028... | |
But because `G` might be another subclass of `ElementDefinition` other than `DetailElement` at run-time it won't allow it at compile-time where the type is unknown and unverifiable.
**In line 3 the type you cast from *is* known to be an `ElementDefinition` so all you're doing is an up-cast**. The compiler doesn't know... | [
0.0517486110329628,
0.0027432767674326897,
0.40595805644989014,
-0.1396121382713318,
-0.23769670724868774,
-0.11743742227554321,
0.6132058501243591,
-0.34736230969429016,
-0.06735768914222717,
-0.48490819334983826,
-0.3448130488395691,
0.37813231348991394,
-0.5710917115211487,
0.0675463005... | |
can use `as` with *any* type, not just ones that are compatible with `ElementDefinition`.
From *[Can I Cast to and from Generic Type Parameters?](http://msdn.microsoft.com/en-us/library/aa479858.aspx#bestpractices_topic5 "Generics FAQ: Best Practices")* on MSDN:
> The compiler will only let you implicitly cast gener... | [
0.15331906080245972,
-0.12177225202322006,
0.2428741604089737,
0.14962252974510193,
-0.3156559467315674,
0.09002259373664856,
0.5582119822502136,
-0.4254426658153534,
-0.054059091955423355,
-0.65052330493927,
0.0005307088140398264,
0.49771249294281006,
-0.4433852434158325,
0.12681840360164... | |
{...}
> class MyClass<T>
> {
> void SomeMethod(T t)
> {
> ISomeInterface obj1 = (ISomeInterface)t;//Compiles
> SomeClass obj2 = (SomeClass)t; //Does not compile
> }
> }
>
> ```
>
> However, you can force a cast from a generic type parameter to any other type ... | [
0.08521314710378647,
-0.354641318321228,
0.004986340645700693,
-0.046467676758766174,
-0.12512874603271484,
0.09299080073833466,
0.3943989872932434,
-0.27348098158836365,
-0.022822028025984764,
-0.5721334218978882,
-0.2579246759414673,
0.37244346737861633,
-0.42682215571403503,
0.021756350... | |
temporary object variable
>
>
>
> ```
> void SomeMethod<T>(T t)
> { object temp = t;
> MyOtherClass obj = (MyOtherClass)temp;
> }
>
> ```
>
> Needless to say, such explicit casting is dangerous because it may throw an exception at run-time if the concrete type used instead of the generic type parameter... | [
0.01731996424496174,
-0.14876174926757812,
0.19215194880962372,
0.01121030654758215,
-0.05284706875681877,
0.028026936575770378,
0.39766284823417664,
0.10604780912399292,
-0.2545073628425598,
-0.5804206728935242,
-0.3137683570384979,
0.3480655550956726,
-0.4543291926383972,
0.2446694970130... | |
type parameter is of the queried type, and `as` will perform a cast if the types are compatible, and will return null otherwise.
>
>
>
> ```
> public void SomeMethod(T t)
> {
> if(t is int) {...}
>
> string str = t as string;
> if(str != null) {...}
> }
>
> ``` | [
0.1221807524561882,
-0.2249554991722107,
0.14124716818332672,
-0.09670022875070572,
-0.2774978578090668,
0.11359567940235138,
0.22918376326560974,
-0.2387031614780426,
0.07676811516284943,
-0.28222253918647766,
-0.345624715089798,
0.4336337745189667,
-0.4182592034339905,
0.0403195098042488... | |
I am developing a WebPart (it will be used in a SharePoint environment, although it does not use the Object Model) that I want to expose AJAX functionality in. Because of the nature of the environment, Adding the Script Manager directly to the page is not an option, and so must be added programmatically. I have attempt... | [
0.17961415648460388,
0.10016431659460068,
0.3544802665710449,
-0.14246203005313873,
-0.014677233062684536,
-0.38768091797828674,
0.4567788541316986,
-0.21708160638809204,
0.07918323576450348,
-0.8808202147483826,
-0.06325557827949524,
0.5521998405456543,
-0.28255003690719604,
0.10964724421... | |
// Ensure the ScriptManager is the first control.
Page.Form.Controls.AddAt(0, sMgr);
}
}
```
However, when this code is executed, I get the following error message:
> "The control collection cannot be modified during DataBind, Init, Load, PreRender or Unload phases."
Is there another way to add the Scr... | [
-0.022885087877511978,
-0.13549675047397614,
0.346193790435791,
-0.09011263400316238,
0.11783197522163391,
-0.28433582186698914,
0.4167983829975128,
-0.3314337730407715,
-0.016767803579568863,
-0.6884952187538147,
-0.2086486518383026,
0.7133403420448303,
-0.2816815972328186,
-0.00078287324... | |
e)
{
Page.Init += delegate(object sender, EventArgs e_Init)
{
if (ScriptManager.GetCurrent(Page) == null)
{
ScriptManager sMgr = new | [
-0.11875630915164948,
-0.31619930267333984,
0.662409782409668,
-0.0005055502406321466,
0.02740122750401497,
-0.1116730123758316,
0.566351592540741,
-0.5384436845779419,
-0.2570830285549164,
-0.8239415287971497,
-0.4183131456375122,
0.4327087998390198,
-0.34309718012809753,
0.25503548979759... | |
ScriptManager();
Page.Form.Controls.AddAt(0, sMgr);
}
};
base.OnInit(e);
}
``` | [
-0.1925070583820343,
-0.23387596011161804,
0.4563460350036621,
-0.3333636522293091,
0.1701514720916748,
-0.0699840858578682,
0.4477140009403229,
-0.15160764753818512,
-0.11384575814008713,
-0.8101367950439453,
-0.4349653720855713,
0.44562795758247375,
-0.4972158670425415,
0.081650152802467... | |
I can't find this anywhere in the Domino Designer help. It seems so straightforward!
All I need to do is find the position of a character in a string.
(edited) Please see the answer from charles ross instead.
<https://stackoverflow.com/a/19437044/11293>
My less efficient method is below.
---
If you really need the ... | [
-0.19256019592285156,
-0.09809134155511856,
0.18930521607398987,
-0.3445178270339966,
0.18445895612239838,
0.012917034327983856,
-0.07263114303350449,
-0.4061069190502167,
-0.18982374668121338,
-0.4480432868003845,
-0.03987854719161987,
0.37357595562934875,
-0.47149989008903503,
0.19331085... | |
@If(@Middle(S; I; 1) = F;
@Do(R := I; I := LEN_S);
@Nothing
)
);
``` | [
-0.007388526573777199,
-0.09280087798833847,
0.43626081943511963,
-0.5069608092308044,
0.21090863645076752,
-0.13460887968540192,
0.45897436141967773,
-0.27170032262802124,
0.02164553850889206,
-0.3013859689235687,
-0.457392156124115,
0.6015189290046692,
-0.16261284053325653,
0.32821285724... | |
### I am looking for an easily digestible book to present to my boss/team.
---
**Background info:** More and more of our meetings at work involve my boss/team pondering how to implement more "best practices" around here. ("Here" = a very small application development shop. 4 developers)
The following things are item... | [
0.40751615166664124,
0.2358075976371765,
0.3105241358280182,
0.26413312554359436,
0.20614071190357208,
-0.07977955788373947,
0.5351697206497192,
0.1255231648683548,
-0.17637337744235992,
-0.6998131275177002,
-0.045439232140779495,
0.7464318871498108,
0.09194058179855347,
-0.411505907773971... | |
into place. Right now we are stuck in discussions of fuzzy, feel-good ideas and nice-sounding buzzwords.
Please recommend to me your favorite book (or online resource) that contains clear, discrete, sequential steps for implementing a management scheme for guiding a TDD or Agile team/shop.
I realize that there are ot... | [
0.2835334837436676,
0.15880198776721954,
-0.2112520933151245,
0.21471340954303741,
-0.038658060133457184,
-0.15284711122512817,
0.3748374879360199,
0.09954492002725601,
-0.17115509510040283,
-0.5661575198173523,
-0.10707732290029526,
0.6004494428634644,
0.09812192618846893,
-0.132735252380... | |
sentiments! I will take no offense. :)
### As others have stated, I think these questions are answered best when respondents list only one book recommendation per answer.
---
Thank you all.
To throw another Pragmatic Programmers title in the mix: [Ship It!](http://pragprog.com/titles/prj/ship-it)
Great book - take ... | [
0.15534743666648865,
-0.03967077285051346,
0.40395665168762207,
0.4604193866252899,
-0.23395398259162903,
-0.5293436050415039,
0.14605391025543213,
0.31737855076789856,
0.014059523120522499,
-0.7110969424247742,
-0.29599645733833313,
0.5152556896209717,
0.3555445075035095,
0.05338734760880... | |
<http://developer.yahoo.com/javascript/howto-proxy.html>
Are there disadvantages to this technique? The advantage is obvious, that you can use a proxy to get XML or JavaScript on another domain with XMLHttpRequest without running into same-origin restrictions. However, I do not hear about disadvantages over other meth... | [
0.1733296811580658,
-0.0031084096990525723,
0.1860785335302353,
0.31051158905029297,
-0.04673178121447563,
-0.3163035809993744,
0.03681989759206772,
0.08039984852075577,
-0.20017462968826294,
-0.9799985885620117,
0.008756606839597225,
0.2224963754415512,
0.060941364616155624,
0.14739044010... | |
Suppose there is a fully populated array of data String[n][3] myData.
I want to do this:
```
for (String[] row : myData)
{
SQL = "update mytable set col3 = row[2]
where col1 = row[0] and col2=row[1];"
}
```
Obviously I've left a lot out, but I want to express the idea as succinctly as possible.
Is there a s... | [
0.13163718581199646,
0.007100176997482777,
0.26602962613105774,
-0.08761409670114517,
0.0013617324875667691,
0.19833064079284668,
0.07698256522417068,
-0.3586977422237396,
-0.11497946828603745,
-0.6314451694488525,
0.051997650414705276,
0.5054214000701904,
-0.42451393604278564,
-0.17698024... | |
proof. Parameterized Queries are my preferred way of going.
I'm using MS-SQL Server 2005
EDIT:Closing, and re-asking as [Multiple DB Updates:](https://stackoverflow.com/questions/184471/multiple-db-updates)
EDIT: Re-opened, as this appears to be a popular question
If you are using Sql Server you can use SqlBulkCop... | [
-0.14052852988243103,
0.4046468734741211,
0.09984994679689407,
0.04912704601883888,
-0.31670233607292175,
-0.14758354425430298,
0.47912299633026123,
-0.20054657757282257,
-0.21401120722293854,
-0.3714873790740967,
0.10578659921884537,
0.3310944736003876,
-0.2785172164440155,
0.204687446355... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.