text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
an lvalue, you are enlarging the array every time it is too short. Hence, it will never be out of elements.
In the first two examples, you only used it as an rvalue, thus no extra elements are created. In the third one it is an lvalue, and thus the elements are created, so that `$_` can be assigned to.
This is not a ... | [
-0.12524667382240295,
-0.43521133065223694,
0.363988995552063,
-0.23900645971298218,
-0.10331960767507553,
0.11436115950345993,
0.05461198464035988,
-0.15955108404159546,
-0.047925084829330444,
-0.6618608236312866,
-0.3424173891544342,
0.42322784662246704,
-0.5830367207527161,
-0.003743602... | |
I know I can do something like the following code to dynamically create a client endpoint connection in WCF:
```
BasicHttpBinding basic =
new BasicHttpBinding(BasicHttpSecurityMode.TransportCredentialOnly);
basic.Security.Transport.ClientCredentialType =
HttpClientCredentialType.Ntlm;
EndpointAddress ser... | [
0.07861197739839554,
0.042946718633174896,
0.6590109467506409,
-0.07751629501581192,
-0.10132785886526108,
-0.2473878264427185,
0.6054956316947937,
-0.2214660346508026,
-0.30211374163627625,
-0.737392008304596,
-0.13919277489185333,
0.4008288085460663,
-0.19231778383255005,
0.5021091699600... | |
the value of 'YourServiceClient' in an object I've retrieved from the DB?
I would strongly recommend starting with [KMDF](http://www.microsoft.com/whdc/driver/wdf/KMDF.mspx). It is dramatically easier to learn than WDM but still requires you to learn the fundamentals of windows kernel development. Also just hanging out... | [
0.1393176168203354,
0.08504584431648254,
0.5481091737747192,
0.2972933053970337,
-0.14650486409664154,
-0.379415899515152,
0.2531948387622833,
0.10940776020288467,
-0.3066537082195282,
-0.28516414761543274,
-0.15949603915214539,
0.7557598948478699,
0.29430291056632996,
-0.03667860105633736... | |
Is there any class, library or some piece of code which will help me to upload files with **HTTPWebrequest**?
**Edit 2:**
I do not want to upload to a WebDAV folder or something like that. I want to simulate a browser, so just like you upload your avatar to a forum or upload a file via form in a web application. Upl... | [
0.356040894985199,
-0.0010691232746466994,
0.4419143497943878,
0.1449509859085083,
-0.10333605110645294,
-0.1207892894744873,
0.1744585931301117,
0.02047993429005146,
-0.35268911719322205,
-0.7603912949562073,
0.15648970007896423,
0.5305149555206299,
-0.3139894902706146,
0.0466128401458263... | |
files, NameValueCollection formFields = null)
{
string boundary = "----------------------------" + DateTime.Now.Ticks.ToString("x");
HttpWebRequest request = (HttpWebRequest) WebRequest.Create(url);
request.ContentType = "multipart/form-data; boundary=" +
boundary;
request.M... | [
-0.1684301197528839,
-0.3155776858329773,
0.7647678852081299,
0.08021402359008789,
0.2792412042617798,
0.053006041795015335,
0.317928284406662,
-0.32587891817092896,
-0.2780926525592804,
-0.6927802562713623,
-0.3807651996612549,
0.22562050819396973,
-0.3441978394985199,
0.7025724053382874,... | |
boundary + "\r\n");
var endBoundaryBytes = System.Text.Encoding.ASCII.GetBytes("\r\n--" + | [
-0.5574344396591187,
-0.09145434200763702,
0.742577075958252,
-0.09059744328260422,
0.27588313817977905,
-0.049684472382068634,
0.12378150969743729,
-0.2363917976617813,
-0.09605754166841507,
-0.5429013967514038,
-0.2531546354293823,
-0.003215222852304578,
-0.4601932764053345,
0.4525162279... | |
boundary + "--");
string formdataTemplate = "\r\n--" + boundary +
"\r\nContent-Disposition: form-data; name=\"{0}\";\r\n\r\n{1}";
if (formFields != null)
{
foreach (string key in formFields.Keys)
{ | [
-0.5455716848373413,
-0.3588511049747467,
0.8464374542236328,
-0.1398703008890152,
0.022183164954185486,
-0.36649584770202637,
0.12263183295726776,
-0.5204665660858154,
0.21777032315731049,
-0.382707804441452,
-0.38104137778282166,
0.22546513378620148,
-0.3258818984031677,
0.34715116024017... | |
string formitem = string.Format(formdataTemplate, key, formFields[key]);
byte[] formitembytes = System.Text.Encoding.UTF8.GetBytes(formitem);
memStream.Write(formitembytes, 0, formitembytes.Length);
}
}
string headerTemplate =
"Content-Disposition: form-data; name=\"{0}\... | [
-0.28401777148246765,
-0.29551732540130615,
0.6348341107368469,
-0.16380135715007782,
0.03049466386437416,
-0.08076921105384827,
0.1869521588087082,
-0.3769771158695221,
0.005461235996335745,
-0.45125678181648254,
-0.4283761978149414,
0.1949135810136795,
-0.40067416429519653,
0.28902110457... | |
memStream.Write(boundarybytes, 0, boundarybytes.Length);
var header = string.Format(headerTemplate, "uplTheFile", files[i]);
var headerbytes = System.Text.Encoding.UTF8.GetBytes(header);
memStream.Write(headerbytes, 0, headerbytes.Length);
using (var fileStream = new FileStream(files[i... | [
-0.2866041660308838,
0.022679679095745087,
0.6176117658615112,
-0.20633123815059662,
0.14650005102157593,
0.16525378823280334,
0.40004411339759827,
-0.2964596450328827,
-0.12838229537010193,
-0.7526768445968628,
-0.3946549892425537,
0.43903157114982605,
-0.06988197565078735,
0.344569146633... | |
while ((bytesRead = fileStream.Read(buffer, 0, buffer.Length)) != 0)
{
memStream.Write(buffer, 0, bytesRead);
}
}
}
memStream.Write(endBoundaryBytes, 0, endBoundaryBytes.Length);
request.ContentLength = memStream.Length;
using (Stream requestStream = req... | [
-0.011455979198217392,
-0.2893926501274109,
0.9963650107383728,
0.03986947983503342,
0.32197001576423645,
0.03750515729188919,
0.37954002618789673,
0.008423699997365475,
-0.22436054050922394,
-0.592024564743042,
-0.41965824365615845,
0.41117772459983826,
-0.19662633538246155,
0.51790243387... | |
memStream.Position = 0;
byte[] tempBuffer = new byte[memStream.Length];
memStream.Read(tempBuffer, 0, tempBuffer.Length);
memStream.Close();
requestStream.Write(tempBuffer, 0, tempBuffer.Length);
}
using (var response = request.GetResponse())
{
Stream stream2 = respo... | [
-0.25571587681770325,
-0.20352290570735931,
0.9425562620162964,
-0.2508889138698578,
0.15366193652153015,
0.2525903880596161,
0.407819002866745,
-0.33142125606536865,
-0.2258102148771286,
-0.8361284732818604,
-0.48350903391838074,
0.7066985368728638,
-0.21760216355323792,
0.257781386375427... | |
I'm currently working on creating electronic version of various request forms. Each form will more than likely require some specific data about the user. For sake of argument, here's a simplified version.
```
Form Required Info
¯¯¯¯¯¯¯¯¯¯¯¯¯¯ ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯... | [
0.6851326823234558,
0.24785469472408295,
0.43395036458969116,
0.18655216693878174,
0.2172626405954361,
-0.2003515213727951,
0.007358900737017393,
-0.26325279474258423,
0.29215559363365173,
-0.5975279808044434,
0.00003940285023418255,
0.3672456741333008,
-0.13406825065612793,
-0.17395041882... | |
Mileage Claim Does user have a lease car?
Overtime Claim Contract type (permanent/temp). Salary
Procurement Request User role (supervisor, technician)
```
I currently don't know how many forms in total will end up on this system, or what other extra information about the user they... | [
0.9532796740531921,
0.3757303059101105,
0.43719759583473206,
0.028072088956832886,
0.3443627655506134,
0.4851172864437103,
-0.4022569954395294,
-0.30420804023742676,
-0.1775696724653244,
-0.45973753929138184,
0.2551077902317047,
0.6880179643630981,
0.09333685040473938,
-0.01895812340080738... | |
to model this? Throw it all into the users table or create lots of tables that reference User?
Throwing it all into the users table is a recipe for a growing "[Ball of Mud](http://en.wikipedia.org/wiki/Big_ball_of_mud)" pattern. Eventually you'll have a table with 300 fields - first name, last name, address, work addre... | [
0.3090530037879944,
0.08535566926002502,
0.34222644567489624,
0.27683815360069275,
0.04498787224292755,
0.21196973323822021,
0.10103341937065125,
0.05525308474898338,
-0.22879856824874878,
-0.6690576076507568,
-0.014415904879570007,
-0.10495183616876602,
-0.2813902795314789,
0.268345147371... | |
to have users and employees, or some such. The main point is that I wouldn't try to shoehorn different types into the same table.
edit-
an additional point is that glomming different datatypes together makes enforcing integrity impossible - suppose you have "RentalCarUser" and "EmployeeUser" grouped into the same tab... | [
0.5367088913917542,
0.17174863815307617,
0.07941710948944092,
0.3374982476234436,
0.26512056589126587,
-0.20556996762752533,
0.007832692936062813,
-0.01900479942560196,
-0.2845756411552429,
-0.45499828457832336,
0.21706634759902954,
0.6916848421096802,
-0.2180415689945221,
0.30722990632057... | |
because you've got additional users for whom that value isn't applicable. Adding a trigger to fill in "NA" for the Employees doesn't help, because you've then got a whole bunch of records with "NA" and you can't easily tell if that's correct or missing data. | [
0.34089356660842896,
-0.020378317683935165,
-0.03214217349886894,
0.2622587978839874,
0.3608787953853607,
-0.12034265697002411,
0.31800588965415955,
-0.08784905076026917,
-0.4954889416694641,
0.0038461294025182724,
0.2937001883983612,
0.20134110748767853,
-0.24828177690505981,
0.2968651056... | |
I'm trying to do a vanishing Star Wars type thing like [this](http://www.freehandsource.com/_frames/_tips/_archive/tip_week103.html), but programatically.
Most of what they've done is easy to program (make a motion tween), but I wish to generate the text-based graphic programatically as well (from text using a dynamic... | [
0.12988273799419403,
-0.020874375477433205,
0.7952511310577393,
0.014978843741118908,
-0.49367600679397583,
0.113987036049366,
-0.0011098653776571155,
-0.10179216414690018,
-0.6989098787307739,
-0.5191028118133545,
0.1804906129837036,
0.1328873336315155,
0.023355990648269653,
0.10819131880... | |
what it's called).
If you are compiling for flash player 10 (which requires CS4 or a recent flex sdk), you can just rotate the text field in 3d:
```
text.rotateX = -45;
```
There are a few more issues with this, such as you need to use font embedding, and getting the vanishing point in the center of the field.
Doin... | [
0.25888416171073914,
-0.16808642446994781,
0.5006746649742126,
0.024707376956939697,
-0.1541457325220108,
-0.00014835160982329398,
0.264898419380188,
-0.2017703354358673,
0.012357446365058422,
-0.5469562411308289,
0.07854646444320679,
0.6767227053642273,
-0.41965848207473755,
-0.2079699188... | |
division. Eg (in flex):
```
class Main extends Sprite
{
[Embed(systemFont="Arial", fontName="embedFont", mimeType="application/x-font")]
var embedFont:Class;
public function Main()
{
var text:TextField = new TextField();
text.defaultTextFormat = new TextFormat("embedFont", 30);
... | [
-0.2869265675544739,
-0.27444466948509216,
0.7007666826248169,
-0.42815518379211426,
0.0020989696495234966,
0.44578319787979126,
0.3770482540130615,
-0.22383269667625427,
-0.11410236358642578,
-0.6214371919631958,
-0.7390719652175903,
0.7250333428382874,
-0.3634771406650543,
0.221854135394... | |
for (var i:int = 0; i != bmp.height; ++i) {
var m:Matrix = new Matrix();
// x-division, change 0.8, 0.2 to change scale increase, scale at top
m.a = i*(0.8/bmp.height)+0.2;
// horizontal center
m.tx = bmp.width * (1-m.a) / 2; | [
-0.013247314840555191,
-0.2108864039182663,
0.8696891069412231,
-0.36548957228660583,
0.04923408851027489,
0.5433352589607239,
0.29334262013435364,
-0.6049392819404602,
-0.4743179678916931,
-0.3967844247817993,
-0.4443269371986389,
0.526972770690918,
-0.051249247044324875,
0.11339791864156... | |
// y-division, and align text to bottom
m.ty = (bmp.height-i)/m.a - bmp.height;
bmp.draw(text, m, null, null, new Rectangle(0, i, bmp.width, 1));
}
addChild(new Bitmap(bmp));
}
}
```
I haven't done the maths, so I don't know if that's physically accurate, but it should gi... | [
0.20702135562896729,
0.21045048534870148,
0.48468804359436035,
-0.17265917360782623,
0.19635377824306488,
0.14983944594860077,
0.3144861161708832,
-0.4122934639453888,
-0.1837911307811737,
-0.5399249196052551,
-0.1453351378440857,
0.7949054837226868,
0.04034610092639923,
-0.172350078821182... | |
Would like to know options in 3D graphics engines out there that can even work on cards that do not have support for pixel shader or dedicated video memory.
For example , xna samples do not work on my notebook ( no dedicated video memory , shared video memory(64MB) and no pixel shader )
Although , on this very noteb... | [
-0.120676688849926,
-0.14942777156829834,
0.1929309070110321,
0.5207652449607849,
-0.19262951612472534,
-0.26832810044288635,
-0.1095895767211914,
0.3029543459415436,
-0.1553371101617813,
-0.8188074827194214,
0.2621009945869446,
0.79832524061203,
0.028690991923213005,
-0.16718508303165436,... | |
- dotNet
DirectX is still pretty good about supporting low-end hardware. Of course, you won't be able to use advanced features like pixel shaders if your hardware doesn't support them, but it can emulate a lot of features (including hardware T&L) in software.
If you're using C#, you'll want to look into Managed Direct... | [
0.6504310369491577,
-0.3642193078994751,
0.5878599882125854,
0.17614823579788208,
-0.03990372642874718,
-0.1874149888753891,
0.038211263716220856,
0.5293496251106262,
-0.09373843669891357,
-0.7036341428756714,
-0.04436410218477249,
0.49619919061660767,
-0.1969054639339447,
0.02105094492435... | |
I'm just starting to read TAOCP Volume 1 and I'm having trouble understanding the style.
Knuth mentions a computational method to be a quadruple (Q,I, Omega, f) -- but I am having trouble understanding what each of these is intended to be. I understand his first example, but don't understand his second
I'm looking at... | [
0.04463877156376839,
0.02788723260164261,
0.14944146573543549,
-0.031863704323768616,
-0.4917962849140167,
0.06787504255771637,
0.22612935304641724,
-0.3822134733200073,
0.0016012596897780895,
-0.3122238516807556,
-0.1315947324037552,
0.23264172673225403,
-0.4221392571926117,
-0.1515426039... | |
of all string on A.
The idea is to encode the states of the computation so that they are represented by strings of A\*
```
Q = (s,j) where s is in A* and j is an integer, 0 <= j <= N
I = subset of Q with j = 0
Omega = subset with j = N
f = function below
```
(note that p & w are strings)
If and s are strings in A... | [
-0.05531006306409836,
-0.26253196597099304,
0.07340383529663086,
-0.2287810742855072,
0.050684306770563126,
0.3851564824581146,
0.26520419120788574,
-0.38520798087120056,
-0.02212570048868656,
-0.4050412178039551,
-0.4532095193862915,
-0.0521249994635582,
-0.29865893721580505,
0.0983034148... | |
if Tj does not occur in s;
f(s,j) = (pYjw,bj) if p is the shortest possible string for which s = pYjw
f(s,N) = (s,N)
```
I understand the concept of making sets of strings, but don't understand **all** that he is trying to say here. Why do I need Q, I, Omega? What is the f really explaining to me (why do I need 3 f... | [
0.002892868360504508,
-0.08899731934070587,
0.05805816128849983,
-0.015447107143700123,
-0.07876024395227432,
0.17850254476070404,
0.46936115622520447,
-0.35228511691093445,
-0.10638397186994553,
-0.6442468762397766,
-0.5521049499511719,
0.15652786195278168,
-0.4019438922405243,
0.37123164... | |
== 0`)
`Omega` = final states (hence the requirement that `j == N`)
`f` = transition function
Also, there aren't three functions named `f` but rather `f` is piecewise-defined by three equations. | [
-0.17639273405075073,
-0.12939870357513428,
0.15264596045017242,
-0.19950971007347107,
0.05923297628760338,
0.2327330857515335,
-0.050043459981679916,
-0.5739350914955139,
0.015443318523466587,
-0.4435383379459381,
-0.1270921230316162,
0.3165786862373352,
-0.29267191886901855,
0.2956872284... | |
Now, I could go ahead and write this using `FileSystemWatcher` etc, but before I start coding - I wonder if there is a better option that I can re-use (rather than re-invent).
From my web-server, I want to drop files (to be printed) into a network share as a queue (ordering not hugely critical). Ideally, a windows ser... | [
0.6999759078025818,
-0.22597387433052063,
0.32219642400741577,
-0.12821215391159058,
0.017759930342435837,
0.017407668754458427,
-0.12257461249828339,
-0.025783007964491844,
-0.2566744387149811,
-0.7286844253540039,
0.1251441240310669,
0.4185403883457184,
-0.1496964693069458,
0.01418634876... | |
features like directory monitoring, print scheduling etc with command line options. You can run it as a service. | [
0.10830692201852798,
-0.22232665121555328,
0.11524222046136856,
0.10637957602739334,
0.16705912351608276,
-0.23142744600772858,
0.053728412836790085,
0.3473844528198242,
-0.12023810297250748,
-0.4793038070201874,
-0.13028988242149353,
0.6319795846939087,
0.06651409715414047,
0.275058090686... | |
Given two arrays, is there a fast algorithm for finding all elements in the two that are different? For example, consider two arrays of Keys (as in keyboard keys) structs. One represents the currently depressed keys, and the other represents the keys depressed in the last timestep.
```
Keys[] oldKeys = LastKeyboardSta... | [
-0.20626339316368103,
-0.08558914810419083,
0.49954652786254883,
-0.4506314694881439,
-0.016301782801747322,
0.17828361690044403,
-0.16967281699180603,
-0.5359255075454712,
-0.384346604347229,
-0.5478034019470215,
-0.10033686459064484,
0.7250862121582031,
-0.38005104660987854,
0.1673024147... | |
I am creating a pdf file with Latex via pdflatex and want to have have headlines with ragged text, while the rest of the document should use justified text.
This gives me an error (! `LaTeX Error: Something's wrong--perhaps a missing \item`):
```
\usepackage{ragged2e}
..
\flushleft
\chapter{Something}
\justifying
... | [
0.3620518743991852,
-0.13806983828544617,
0.4929402470588684,
0.05023644492030144,
-0.4024280905723572,
-0.26912951469421387,
0.4011611342430115,
-0.201165109872818,
-0.15590766072273254,
-0.37221047282218933,
-0.2147534191608429,
0.396984726190567,
-0.40964436531066895,
-0.020084941759705... | |
Is it possible to use objects as a datasource for a remote SSRS report? I know it is possible to use objects locally from within an application. I would like to like to use business objects as a data source for reports that are run on the SSRS server. In the past I have created stored procedures that returned the same ... | [
0.2296425998210907,
0.10412214696407318,
0.11309722810983658,
0.20426003634929657,
-0.08666004985570908,
0.22710610926151276,
0.10380370914936066,
-0.04545033723115921,
-0.4921838045120239,
-0.39389103651046753,
0.15271303057670593,
0.48281270265579224,
-0.5134389400482178,
0.1173689588904... | |
address the question in the comments:
> How can I make this work though? python -c "import calendar;print calendar.prcal(2009);for x in range(1,10): print x"
```
python -c "for x in range(1,10): x==1 and __import__('calendar').prcal(2009); print x;"
```
As you can see it's pretty gross. We can't import before the l... | [
0.35107752680778503,
0.13794060051441193,
0.2291542887687683,
-0.19558443129062653,
-0.36308375000953674,
-0.1235884502530098,
0.22702328860759735,
-0.09721813350915909,
-0.31118685007095337,
-0.33605706691741943,
0.2602725327014923,
0.41048869490623474,
-0.163435697555542,
-0.001620531547... | |
I'm new to Linq to Xml. I have a very simple xml file like this:
```
<Items>
<Item>
<Stuff>Strings</Stuff>
</Item>
<Item>
<Stuff>Strings</Stuff>
</Item>
</Items>
```
And I'm trying to query it like this:
```
XDocument doc = XDocument.Load(myStream)
from node in doc.Descendants(XName.Ge... | [
0.4136856198310852,
0.0863044410943985,
0.6876716017723083,
0.0478874035179615,
0.30935007333755493,
-0.3482595682144165,
0.11898510903120041,
-0.22256894409656525,
-0.1864774376153946,
-0.7542850375175476,
-0.029038894921541214,
0.3236779570579529,
-0.03492327034473419,
0.2370115965604782... | |
<Items>
<Item>
<Stuff>Strings</Stuff>
</Item>
<Item> | [
-0.14000266790390015,
0.27781954407691956,
-0.06188994646072388,
0.339104562997818,
-0.30574938654899597,
0.1566123068332672,
0.06982021033763885,
0.17039741575717926,
-0.5557310581207275,
-0.5474701523780823,
-0.6229193210601807,
-0.14528758823871613,
-0.1603628695011139,
0.23984561860561... | |
<Stuff>Strings</Stuff>
</Item>
</Items>";
using (StringReader myStream = new StringReader(xml))
{
XDocument doc = XDocument.Load(myStream);
var query = from node in doc.Descendants(XName.Get("Item")) | [
0.03204299136996269,
-0.35791194438934326,
0.8840888738632202,
0.018831608816981316,
0.3996444344520569,
-0.01462572906166315,
0.022634083405137062,
-0.1982443630695343,
-0.2558404505252838,
-0.39384615421295166,
-0.3140392601490021,
0.2816018760204315,
-0.22892801463603973,
0.314824283123... | |
select new { Stuff =
node.Element(XName.Get("Stuff")).Value };
foreach (var item in query)
{
Console.WriteLine("Stuff: {0}", item.Stuff);
}
}
```
It should be noted that if the elements are not qualified with namespaces, then you don't | [
-0.13864251971244812,
-0.13898396492004395,
0.49850374460220337,
-0.04410672187805176,
0.33055397868156433,
-0.23600701987743378,
0.16601529717445374,
-0.4445236623287201,
-0.17886675894260406,
-0.6030529141426086,
-0.4130421578884125,
0.19445891678333282,
-0.21803948283195496,
0.273731619... | |
really need XName:
```
static void Main(string[] args)
{
string xml = @"
<Items>
<Item>
<Stuff>Strings</Stuff>
</Item> | [
0.1445188969373703,
-0.0744408667087555,
0.4331981837749481,
0.1840554028749466,
0.3271942734718323,
-0.12476390600204468,
0.33111318945884705,
0.1454400271177292,
-0.17724980413913727,
-0.47002872824668884,
-0.395325243473053,
0.4912310838699341,
-0.28263965249061584,
-0.02784191258251667... | |
<Item>
<Stuff>Strings</Stuff>
</Item>
</Items>";
using (StringReader myStream = new StringReader(xml))
{
XDocument doc = XDocument.Load(myStream); | [
0.13929483294487,
-0.34085580706596375,
0.86417555809021,
-0.06828249990940094,
0.32478901743888855,
-0.13034220039844513,
-0.08482959866523743,
-0.19207163155078888,
-0.05693289265036583,
-0.5001316666603088,
-0.3593235909938812,
0.47330886125564575,
-0.34400880336761475,
0.17238326370716... | |
var query = from node in doc.Descendants("Item")
select new { Stuff = node.Element("Stuff").Value };
foreach (var item in query)
{
Console.WriteLine("Stuff: {0}", item.Stuff);
}
}
}
``` | [
-0.34480682015419006,
-0.13736623525619507,
0.6546217203140259,
-0.11441529542207718,
0.23091958463191986,
0.09151891618967056,
0.23428437113761902,
-0.34078240394592285,
-0.11414290964603424,
-0.47904810309410095,
-0.3697196841239929,
0.2490343153476715,
-0.13499827682971954,
0.3345510065... | |
I have data in a MSSQL table (TableB) where [dbo].tableB.myColumn changes format after a certain date...
I'm doing a simple Join to that table..
```
Select [dbo].tableB.theColumnINeed from [dbo].tableA
left outer join [dbo].tableB on [dbo].tableA.myColumn = [dbo].tableB.myColumn
```
However, I need to join, usin... | [
-0.4156334698200226,
0.14962464570999146,
0.7005576491355896,
0.014854615554213524,
0.17551913857460022,
0.03236445412039757,
0.0244735237210989,
-0.023255204781889915,
-0.17984600365161896,
-0.6394217014312744,
-0.18131598830223083,
-0.025169892236590385,
0.00818855594843626,
0.2128598988... | |
END
ELSE
BEGIN
FormatColumnAnotherWay([dbo].tableB.myColumn)
END
```
I'm wondering if there's a way to do this.. or a better way I'm not thinking of to approach this..
```
SELECT [dbo].tableB.theColumnINeed
FROM [dbo].tableA
LEFT OUTER JOIN [dbo].tableB
ON [dbo].tableA.myColumn =
... | [
-0.15158692002296448,
0.18556512892246246,
0.7141971588134766,
-0.017276426777243614,
0.0577114000916481,
-0.13612999022006989,
-0.15009081363677979,
-0.023887692019343376,
0.02574114128947258,
-0.5749392509460449,
-0.3949922025203705,
0.1295996457338333,
0.0026236025150865316,
0.302503287... | |
I'm writing a WCF service to replace a current web service, and I'm having trouble with one of the legacy complex types that I need to return.
Unfortunately I can't touch any of the code but looking at them all the classes are Serializable and the current web service is using it with no problem.
Whenever my client ca... | [
0.3819301426410675,
0.20081932842731476,
0.42033058404922485,
-0.0435158796608448,
-0.1857578158378601,
-0.2823087275028229,
0.19115018844604492,
-0.3174802362918854,
-0.3409593403339386,
-0.6446431279182434,
0.1682702749967575,
0.3568815290927887,
-0.6504488587379456,
0.6393446922302246,
... | |
- for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.*
The type I want to return is ApplicationPrincipal, but it seems to be falling over at a child type. Here's how these classes look:
The type I want to return:
```
[Serializable]
[Ty... | [
-0.18191927671432495,
0.0717250257730484,
0.6435807347297668,
0.053996942937374115,
0.36746254563331604,
0.20939426124095917,
0.05122905969619751,
-0.27746742963790894,
-0.14641118049621582,
-0.6749792695045471,
-0.1658032387495041,
0.5191527009010315,
-0.4481036365032196,
0.32471609115600... | |
/// <summary>
/// Occurs when a value is being changed in the collection.
/// </summary>
[field:NonSerialized]
public event CollectionChangeEventHandler CollectionChanging;
/// <summary>
/// Occurs when a value has been changed in the collection.
/// </summary>
[field:NonSerialized]
... | [
-0.293442964553833,
-0.3268665075302124,
0.5170412063598633,
0.21883469820022583,
0.5694438815116882,
0.051477134227752686,
-0.217624694108963,
-0.21864914894104004,
-0.5077878832817078,
-0.3233130872249603,
-0.49769705533981323,
0.40380460023880005,
-0.3932543992996216,
0.2887606918811798... | |
private ConditionDictionary m_roleConditions;
```
Any suggestions as to why WCF is not able to serialize ApplicationGroup?
Try adding these to the top of your DataContract:
```
[KnownType(typeof(ApplicationGroupCollection))]
[KnownType(typeof(ApplicationGroup))]
```
[Edit] Without testing I cannot tell you if this... | [
0.41127809882164,
0.033899642527103424,
0.3719680607318878,
0.05059240385890007,
0.15753769874572754,
-0.13467182219028473,
0.3804813027381897,
-0.054363664239645004,
-0.2902866005897522,
-0.5547006726264954,
0.04023280367255211,
0.7148284912109375,
-0.49373430013656616,
0.3217651247978210... | |
of that type so that it can deserialize the message. This means that you will need to provide a copy of the assemblies that contain the legacy types to the client for the client to reference. | [
0.5578015446662903,
0.17565107345581055,
-0.03229917958378792,
0.027713200077414513,
0.15398509800434113,
-0.07515190541744232,
0.3296753168106079,
-0.09239187091588974,
-0.40390539169311523,
-0.5986590385437012,
-0.15614400804042816,
0.24204500019550323,
-0.34470734000205994,
0.2273498773... | |
What is the proper way to pass an answer (a collection) back to Silverlight?
For example, if I have a service application that sits on top of the Northwind sample database and the service has a method called GetEmployees(). What is the proper "thing" to pass back to Silverlight? An IQueryable ?
Then considering the A... | [
0.48761269450187683,
0.0039910138584673405,
0.4538576602935791,
0.3544975519180298,
-0.25986018776893616,
-0.2504948377609253,
0.1436433047056198,
-0.5234156250953674,
-0.1750977784395218,
-0.3093404769897461,
0.036431919783353806,
0.34287649393081665,
0.07543780654668808,
0.07096655666828... | |
Silverlight-friendly-WCF class so thats not what I started with. Once I added that attribute in the solution wouldn't let me use the service any more without it. So I could not test what I was seeing before. Any thoughts on what *AspNetCompatibilityRequirementsMode.Allowed* does under the hood?
**UPDATE 2:**
See co... | [
0.4876130223274231,
-0.04544142261147499,
0.4315780699253082,
-0.03031003661453724,
-0.4166351854801178,
-0.5044190287590027,
0.4152539074420929,
-0.2689666450023651,
-0.4805356562137604,
-0.37374675273895264,
0.21003961563110352,
0.3852693438529968,
-0.49958643317222595,
-0.06399751454591... | |
contain information about the Employees (or whatever). Try to keep it relatively simple. When you create your proxy (probably with svcutil or Add Service Reference) VS2008 will auto-magically define the DataContracts on your client side and then you can use them just like a regular object.
I prefer to use WCF manually... | [
0.5350632667541504,
0.013565444387495518,
0.8070014715194702,
0.3198153078556061,
-0.04547223821282387,
-0.3446321487426758,
0.47972723841667175,
-0.16813240945339203,
-0.19282323122024536,
-0.6964413523674011,
-0.0511728897690773,
0.4251459240913391,
-0.15940724313259125,
0.08005097508430... | |
3 of the WCF Bible, "Programming WCF Services" by Juval Lowy. It's chock full of info on DataContracts. | [
-0.10039316117763519,
0.4692077040672302,
-0.0897010788321495,
-0.005128576420247555,
-0.33654847741127014,
-0.43392181396484375,
0.5653455853462219,
-0.09160014241933823,
0.09813843667507172,
-0.48146316409111023,
0.03416502848267555,
0.5380397439002991,
-0.2503701448440552,
0.01410057581... | |
How long does windows wait before deciding a window is unresponsive and brings up the the unresponsive chrome? Just from anecodotal experience, I assume it is different in XP and Vista, as they are handled very differently by the DWM in Vista and the Explorer shell in XP.
Taken from [Windows Error Reporting at MSDN](ht... | [
0.027042998000979424,
-0.1562165468931198,
0.369723379611969,
-0.1795651763677597,
-0.2767690122127533,
0.0751604214310646,
0.31218573451042175,
-0.23762285709381104,
-0.3575354516506195,
-0.46148207783699036,
-0.17259155213832855,
0.6846774220466614,
-0.007520414888858795,
-0.230130612850... | |
I noticed Arc Gis maps render really slow. When you zoom, it renders slow. When you pan, it renders slow. Does anyone have any suggestions on making the maps render much faster similar to google maps and microsoft virtual earth.
Which product are you using? Desktop ArcGIS, ArcEngine, ArcGIS server, or what?
Not that i... | [
0.44735679030418396,
-0.018815122544765472,
0.11415784806013107,
0.26802241802215576,
-0.5220304131507874,
0.04662732407450676,
0.1511184424161911,
0.3438754975795746,
-0.17124298214912415,
-0.7754205465316772,
0.16063664853572845,
0.7146562933921814,
0.1627245992422104,
-0.096143878996372... | |
Stack Overflow - love ya! | [
-0.013758930377662182,
0.2913461923599243,
0.6309148073196411,
0.49072882533073425,
0.017797796055674553,
0.08998242020606995,
0.07321631163358688,
0.396238774061203,
-0.38225603103637695,
-0.04786035418510437,
0.06028122082352638,
0.4312731623649597,
-0.07999059557914734,
0.10996154695749... | |
Is there a way in python to programmatically determine the width of the console? I mean the number of characters that fits in one line without wrapping, not the pixel width of the window.
**Edit**
Looking for a solution that works on Linux
```
import os
rows, columns = os.popen('stty size', 'r').read().split()
```
... | [
0.2185000628232956,
-0.11261191964149475,
0.5792971849441528,
-0.1244489997625351,
-0.21136561036109924,
0.11313589662313461,
-0.16782577335834503,
0.010054688900709152,
-0.2328873574733734,
-0.6364641785621643,
-0.026415055617690086,
0.5516448020935059,
-0.19776368141174316,
0.27994799613... | |
as my standard shell) the data will also be up-to-date whereas I believe the os.environ["COLUMNS"] value would only be valid for the time of the launch of the python interpreter (suppose the user resized the window since then).
(See answer by @GringoSuave on how to do this on python 3.3+) | [
0.2202816754579544,
0.026552261784672737,
0.4910115599632263,
-0.1488075703382492,
0.07533063739538193,
-0.22894833981990814,
0.19843627512454987,
0.018016129732131958,
-0.11345509439706802,
-0.41940003633499146,
-0.17729823291301727,
0.8748371601104736,
0.024985332041978836,
-0.2424182742... | |
I'm in the process of learning Python while implementing build scripts and such. And for the moment everything is working fine in that the scripts do what they need to do. But I keep having the feeling I'm missing something, such as "The Python Way". I know build scripts and glue scripts are not really the most excitin... | [
0.6656967997550964,
0.4659440219402313,
-0.3471989035606384,
-0.182824045419693,
-0.21985846757888794,
-0.12269517779350281,
0.5359012484550476,
0.28675219416618347,
-0.0867292508482933,
-0.5698712468147278,
0.11945240199565887,
0.9216806292533875,
-0.004407183732837439,
-0.187175363302230... | |
structure and style to a lot of my C# code. In other words I feel like I'm thinking in C# but writing in Python.
Am I really missing something?
(Note: I realize this isn't so much a programming question and it's quite broad and there may not be a definitive answer so mod me down into oblivion if you have to.)
I would... | [
0.3570851981639862,
0.1181546151638031,
-0.06119462847709656,
0.09976892918348312,
-0.10841122269630432,
-0.2295006811618805,
0.20548108220100403,
0.14981494843959808,
-0.3548942804336548,
-0.6960986852645874,
-0.17304806411266327,
0.42726966738700867,
-0.0033121181186288595,
-0.2811673581... | |
Don't forget to `import this` ;)
**Addendum**: I would also aggregate some excellent suggestions given by others in this thread here:
* Read [Code Like a Pythonista: Idiomatic Python](http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html) (from [David Grant](https://stackoverflow.com/users/26829/david... | [
-0.4481493830680847,
0.1598191261291504,
0.010949887335300446,
0.10868237167596817,
-0.08409131318330765,
0.07243441045284271,
0.23073144257068634,
-0.2910250723361969,
-0.5796791315078735,
-0.3005392551422119,
-0.29149144887924194,
0.2674781084060669,
-0.08662345260381699,
-0.457787871360... | |
I think the question title neatly sums up what I am after. I have a web app and a service and I would like the build script to check if the service has been updated since the last build and if so, run the "update service reference" script that is available when you right-click on a service.
Any ideas?
I would recommen... | [
0.4829171895980835,
0.16745808720588684,
0.2757005989551544,
-0.1396855115890503,
0.07637666910886765,
0.058544840663671494,
0.03600459545850754,
-0.038313381373882294,
-0.13748547434806824,
-0.7342590689659119,
-0.034353096038103104,
0.5159669518470764,
0.09006337821483612,
-0.32160699367... | |
forget to `import this` ;)
**Addendum**: I would also aggregate some excellent suggestions given by others in this thread here:
* Read [Code Like a Pythonista: Idiomatic Python](http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html) (from [David Grant](https://stackoverflow.com/users/26829/david-grant... | [
-0.5109295845031738,
0.2278124839067459,
0.036616381257772446,
0.11254366487264633,
-0.05497385188937187,
0.12642337381839752,
0.2602940499782562,
-0.34497562050819397,
-0.6047533750534058,
-0.37389692664146423,
-0.4014270305633545,
0.23794639110565186,
-0.0866483673453331,
-0.450773149728... | |
I have a PHP web app located on **shared hosting**.
My goal is to modify .htaccess file from PHP code when the PHP page is running.
I need that .htaccess to insert a couple of mod\_rewrite lines into it.
The problem is that on Windows+Apache I can dynamically modify .htaccess file
but the same code on Linux reports a ... | [
0.27806535363197327,
0.35696685314178467,
0.37581342458724976,
-0.05683126300573349,
-0.3153873085975647,
-0.09698121249675751,
0.5889801979064941,
-0.056458670645952225,
-0.1907741129398346,
-0.5724019408226013,
0.0761171206831932,
0.6313024759292603,
-0.2755684554576874,
0.27599161863327... | |
to add a new RewriteRule into .htaccess that maps a
newly added category\_id with new category\_name.
If it wasn't shared hosting, I would use something like RewriteMap (in main Apache config) and would be able to access the map file.
This is the first real limitation I've been unable to tackle with PHP+Apache, but I... | [
0.3587624728679657,
-0.08573747426271439,
0.5203776359558105,
0.11716281622648239,
-0.190923810005188,
-0.4312209486961365,
0.24446837604045868,
-0.09431242197751999,
-0.12364012748003006,
-0.7679780125617981,
0.15639764070510864,
0.46210935711860657,
-0.2362818717956543,
0.222104534506797... | |
to do is, set up the index file, read in the directory that was loaded (perhaps using $\_SERVER['URI\_REQUEST']), and deal with it.
add to .htaccess this:
```
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
<... | [
-0.12521778047084808,
0.04022602736949921,
0.5144917368888855,
-0.05723701789975166,
-0.008917420171201229,
-0.22149281203746796,
0.06058195233345032,
-0.1998649537563324,
-0.14949166774749756,
-0.6719029545783997,
-0.2224368005990982,
0.6135851740837097,
-0.29043471813201904,
0.3127855062... | |
My company is hosting a few separate, but related, moderately hit, web sites. Accordingly, a production database server, staging database server, production web server, staging web server, etc are needed. My question is, should we invest in physically separate servers for each of our needs, or should we put that money ... | [
0.5946658253669739,
-0.018619706854224205,
0.078843854367733,
0.3288426399230957,
0.33778664469718933,
0.2145533710718155,
-0.3554442524909973,
0.29085636138916016,
-0.4793938398361206,
-0.5293670892715454,
0.2908683717250824,
0.26377376914024353,
0.0039531877264380455,
0.08311598002910614... | |
generally save you money on hardware, power, and floorspace. There is a tipping point, however, based on the overhead of the VM layer itself. Honestly, you will have to experiment to find the right cost/performance balance on this. I am sure the VM vendors would be happy to help you with the math.
The downside is that... | [
0.5862376093864441,
0.07469165325164795,
0.21896712481975555,
0.5778558254241943,
0.2405950427055359,
-0.1482313722372055,
0.07297918945550919,
0.24757468700408936,
-0.2124129831790924,
-0.5261972546577454,
0.026489946991205215,
0.38795602321624756,
0.06576994061470032,
0.19928953051567078... | |
Is it possible to document C code in Eclipse (3.4 w/ CDT) in such a way that JavaDoc/Intellisense like documentation is auto generated and displayed?
E.g. On typing a function name followed by a '(' you get the first param with a tooltip explaining the meaning of that parameter?
Thanks.
To my knowledge: No (With CDT5... | [
-0.028533121570944786,
0.17994673550128937,
0.14882108569145203,
0.05445583164691925,
-0.35517391562461853,
-0.001988446107134223,
-0.031249916180968285,
-0.2632502615451813,
-0.28737494349479675,
-0.17227953672409058,
-0.2145223468542099,
0.6977024674415588,
-0.14496032893657684,
-0.24983... | |
Lets say I have guessed a lottery number of:
> 1689
And the way the lottery works is, the order of the digits don't matter as long as the digits match up 1:1 with the digits in the actual winning lottery number.
So, the number 1689 would be a winning lottery number with:
> 1896, 1698, 9816, etc..
As long as each... | [
0.3826224207878113,
0.15554824471473694,
0.32693201303482056,
0.05704376846551895,
-0.10701653361320496,
0.47655338048934937,
-0.045368343591690063,
-0.23384439945220947,
-0.5980994701385498,
-0.4966377317905426,
0.4682181775569916,
0.1975034475326538,
-0.10390443354845047,
0.2460543513298... | |
(separating them with modulus). Which is fine, it works but I want to know if there are any neat math tricks I can do.
For example, at first... I thought I could be tricky and just take the sum and product of each digit in both numbers and if they matched then you won.
^ Do you think that would work?
However, I quic... | [
0.3680110275745392,
-0.1955585926771164,
0.12757010757923126,
0.31274309754371643,
-0.35488492250442505,
0.234527587890625,
-0.21860717236995697,
-0.13681308925151825,
-0.46183937788009644,
-0.448443740606308,
0.4410289227962494,
0.3120436370372772,
-0.09934449195861816,
0.1193869784474372... | |
in num2 regardless of order?
How about going through each number, and counting up the number of appearances of each digit (into two different 10 element arrays)? After you'd done the totaling, compare the counts of each digit. Since you only look at each digit once, that's O(N).
Code would look something like:
```
fo... | [
-0.19656413793563843,
-0.15279874205589294,
0.0897432416677475,
-0.11322175711393356,
-0.23154321312904358,
0.16405119001865387,
0.19213907420635223,
-0.3939930200576782,
-0.11830108612775803,
-0.17067117989063263,
0.05569188669323921,
0.4182470440864563,
-0.00909087061882019,
-0.161468461... | |
just skip the `- '0'` business.
There are probably optimizations that would make this take less space or terminate sooner, but it's a pretty straightforward example of an O(N) approach.
By the way, as I mentioned in a comment, the multiplication/sum comparison will definitely not work because of zeros. Consider 0123 ... | [
0.39680665731430054,
-0.03966010361909866,
0.12382354587316513,
-0.11549317091703415,
-0.11726057529449463,
0.10366222262382507,
-0.023323295637965202,
-0.09097009897232056,
-0.1896163374185562,
-0.22864732146263123,
0.049950841814279556,
0.36934351921081543,
-0.11843618750572205,
0.320562... | |
I'm using Postgres 8.2 and the associated libpq library for ANSI C. I've skimmed the documentation and not found something that would give me that specific information.
In the "COPY" section of the documentation, "Outputs" are described as such:
> On successful completion, a COPY command returns a command tag of the ... | [
-0.058358874171972275,
0.04623003304004669,
0.3923685550689697,
-0.06786208599805832,
0.28011274337768555,
-0.14415079355239868,
0.2831498980522156,
0.10806415230035782,
-0.18949826061725616,
-0.4334700107574463,
-0.3350149989128113,
0.5188140869140625,
-0.3595832586288452,
0.1582108885049... | |
WITH DELIMITER '|'",
tempFileName);
fprintf(stderr, "COPY all records: %s\n", queryString);
res = PQexec(conn, queryString);
bResultErr = (PQresultStatus(res) != PGRES_COMMAND_OK);
if (bResultErr) {
PQclear(res);
fprintf(stderr, "Aborting:DELETE failed: %s\n",
... | [
-0.36514317989349365,
-0.2929842174053192,
0.6380425691604614,
-0.22079209983348846,
0.34403863549232483,
0.15057486295700073,
0.5006797313690186,
-0.38094887137413025,
-0.2292894721031189,
-0.052425630390644073,
-0.6664988994598389,
0.743497908115387,
-0.23554781079292297,
0.3875615596771... | |
exit (1);
} else {
// Display how many records were COPY'd
fprintf(stderr, "COPY completed: %d rows imported\n",
PQntuples(res));
PQclear(res);
}
```
How ever, the ouput is always "COPY completed: 0 rows imported", despite the fact that the rows *are* imported.
I woul... | [
-0.3107362389564514,
0.1211097463965416,
0.6280623078346252,
-0.1573815494775772,
0.4624572694301605,
-0.048672154545784,
0.1384054273366928,
-0.11465650796890259,
-0.11947773396968842,
-0.540263831615448,
-0.31162673234939575,
0.5391936898231506,
0.017324402928352356,
0.07848318666219711,... | |
not an integer. | [
0.04848792776465416,
0.042647335678339005,
-0.04228205606341362,
0.12889927625656128,
-0.1891908198595047,
0.23809145390987396,
-0.06984841823577881,
0.1353149563074112,
-0.23109017312526703,
-0.0752471536397934,
0.22232453525066376,
-0.02014976739883423,
-0.21053509414196014,
0.3596897721... | |
I'm building a new website and want to use Ajax controls.
Do I need to put a ScriptManager control on both the MasterPage and on each content page? or Just on the MasterPage?(or just on the content page?)
You are only allowed to have one ScriptManager. You can have it on either. Having it on the master page saves you ... | [
0.5959588885307312,
0.08951188623905182,
0.1607736051082611,
0.09183130413293839,
-0.13954567909240723,
-0.18241867423057556,
0.4296445846557617,
-0.0325075127184391,
-0.3199487328529358,
-1.0169309377670288,
0.037999581545591354,
0.5736262202262878,
-0.05530863255262375,
-0.04919534921646... | |
Does anyone knows a good 2D engine for Java with sprites, animations and collisions handling?
JGame is probably what you're looking for.
You might also want to check out this question ( <https://stackoverflow.com/questions/293079/java-2d-game-frameworks> ) that has a list of Engines out there and a bit of feedback on... | [
0.2835542559623718,
0.05727627873420715,
-0.08491557091474533,
0.33716461062431335,
-0.2001405507326126,
-0.1558031439781189,
0.10613150149583817,
0.30284354090690613,
-0.24926131963729858,
-0.5490360260009766,
0.06432997435331345,
0.7767826318740845,
0.014760435558855534,
-0.1030035391449... | |
I am listening for the loaded event of a Page. That event fires first and then all the children fire their load event. I need an event that fires when ALL the children have loaded. Does that exist?
I hear you. I also am missing an out of the box solution in WPF for this.
Sometimes you want some code to be executed aft... | [
0.40140748023986816,
0.17310871183872223,
0.12324626743793488,
0.02209452912211418,
0.021359099075198174,
-0.023237058892846107,
0.46772798895835876,
-0.22871124744415283,
-0.22266587615013123,
-0.6732116341590881,
-0.13897822797298431,
0.7303392291069031,
-0.16072070598602295,
0.149336770... | |
Could someone please tell me what I'm doing wrong with this code? It is just printing 'count' anyway. I just want a very simple prime generator (nothing fancy).
```
import math
def main():
count = 3
one = 1
while one == 1:
for x in range(2, int(math.sqrt(count) + 1)):
if count % x == ... | [
0.21430540084838867,
0.14248549938201904,
0.171342670917511,
-0.21302524209022522,
0.23515929281711578,
-0.127044215798378,
0.5407260656356812,
-0.1985151320695877,
-0.08606812357902527,
-0.363284170627594,
0.059938084334135056,
0.7789267301559448,
-0.6287396550178528,
-0.05820911750197410... | |
if count % x != 0:
print count
count += 1
```
There are some problems:
* Why do you print out count when it didn't divide by x? It doesn't mean it's prime, it means only that this particular x doesn't divide it
* `continue` moves to the next loop iteration - but you really want to stop it usi... | [
0.17660275101661682,
-0.03018285147845745,
0.006663475185632706,
-0.09435871243476868,
-0.04023842513561249,
-0.11198068410158157,
0.18324995040893555,
-0.2498961240053177,
-0.3975500464439392,
-0.26415103673934937,
0.11948657035827637,
0.42928174138069153,
-0.6861008405685425,
0.017683388... | |
math
def main():
count = 3
while True:
isprime = True
for x in range(2, int(math.sqrt(count) + 1)):
if count % x == 0:
isprime = False
break
if isprime: | [
-0.3201531767845154,
-0.03215257078409195,
0.25796470046043396,
-0.14573746919631958,
-0.00038078517536632717,
-0.1984488070011139,
0.7834103107452393,
-0.4013323485851288,
-0.09752199053764343,
0.1104329451918602,
-0.4547302722930908,
0.6771873831748962,
-0.2224198579788208,
-0.2774859368... | |
print count
count += 1
```
For much more efficient prime generation, see the Sieve of Eratosthenes, as others have suggested. Here's a nice, optimized implementation with many comments:
```
# Sieve of Eratosthenes
# Code by David Eppstein, UC Irvine, 28 Feb 2002
# http://code.activestate.com/recipes/117119/... | [
0.12277140468358994,
0.32013022899627686,
-0.39797013998031616,
-0.1282799243927002,
-0.15034258365631104,
0.9212860465049744,
-0.15268944203853607,
-0.4252914488315582,
-0.5244011878967285,
-0.5710763335227966,
0.18374453485012054,
0.2054305523633957,
-0.41629767417907715,
-0.016452264040... | |
# indefinitely, but only as long as required by the current
# number being tested.
#
D = {}
# The running integer that's checked for primeness
q = 2
while True:
if q not in D:
# q is a new prime.
# Yield it and mark its first multiple that | [
0.3965457081794739,
-0.27140313386917114,
0.5217244029045105,
-0.18534019589424133,
0.21237140893936157,
-0.06296168267726898,
0.49419257044792175,
-0.3207308053970337,
-0.12630842626094818,
-0.28426897525787354,
-0.2806814908981323,
0.4382650852203369,
-0.19242727756500244,
0.022819809615... | |
isn't
# already marked in previous iterations
#
yield q
D[q * q] = [q]
else:
# q is composite. D[q] is the list of primes that | [
-0.017858074977993965,
0.09057208895683289,
0.008358701132237911,
-0.44437897205352783,
-0.04118736833333969,
0.28915858268737793,
0.02488120086491108,
-0.5558225512504578,
0.11297256499528885,
-0.43212711811065674,
-0.12044418603181839,
0.2744712829589844,
-0.38078829646110535,
0.19116033... | |
# divide it. Since we've reached q, we no longer
# need it in the map, but we'll mark the next
# multiples of its witnesses to prepare for larger
# numbers
#
for p in D[q]: | [
0.23101970553398132,
-0.00585180101916194,
0.6985324621200562,
0.09644641727209091,
-0.0007254568045027554,
0.38578423857688904,
-0.021239202469587326,
-0.28117990493774414,
-0.12308558821678162,
-0.7303285598754883,
-0.021120723336935043,
0.05993739143013954,
-0.14900793135166168,
0.03866... | |
D.setdefault(p + q, []).append(p)
del D[q]
q += 1
```
Note that it returns a generator. | [
0.00910948310047388,
-0.18837210536003113,
0.3841893970966339,
-0.25206229090690613,
-0.13845226168632507,
-0.020605143159627914,
0.06898189336061478,
-0.725263237953186,
0.18792840838432312,
-0.4102996587753296,
-0.5477097034454346,
0.40361544489860535,
-0.6081588268280029,
0.023441869765... | |
I wanted to use Paypal's IPN service to verify payments for a recurring subscription charge for my website. How do you tie the IPN confirmations to a user in your site?
The IPN confirmation message has a name, email, paypal ID, recurring payment ID, but it seems to not give a unique identifier since I don't know where... | [
0.7344205975532532,
0.24464818835258484,
0.4270211458206177,
0.3813278377056122,
0.14659211039543152,
0.05811309441924095,
-0.19449427723884583,
-0.031670115888118744,
-0.45870712399482727,
-0.29835590720176697,
0.539819061756134,
0.1471061259508133,
0.04871007427573204,
0.1762531101703643... | |
may be many John Smith's and the person may choose to use a different email.)
1) When I send the initial payment request to Paypal, I can attach a unique UUID in the URL I ask them to send back to me, so if I save that unique ID for that user I can match that payment confirmation to the user who initiated it. Am I mak... | [
0.6718816161155701,
0.039078645408153534,
0.46882542967796326,
0.2613750994205475,
-0.052944209426641464,
-0.024108972400426865,
-0.07246692478656769,
-0.15149430930614471,
-0.30724120140075684,
-0.30366191267967224,
0.13133618235588074,
0.3943709433078766,
-0.10733188688755035,
0.08941762... | |
the recurring Paypal payments with IPN's, does it reuse that unique URL? Or do I have to associate the Paypal ID's with the user after the first recurring payment is received?
I recently also set up some reoccurring payments with Paypal.
I actually wanted people to register as members *after* paying for the subscripti... | [
0.5495818853378296,
-0.11270381510257721,
0.5235806703567505,
0.12414273619651794,
-0.16370424628257751,
-0.06874570995569229,
0.05948648601770401,
0.218751460313797,
-0.6992492079734802,
-0.2401932030916214,
0.22637943923473358,
0.24598917365074158,
-0.06818772852420807,
0.372934490442276... | |
the Activations table, then it sends this code to whoever paid for the subscription, with instructions on how to activate.
At the point of activation, you need to register or login. At this point the userID is added to the relevant row in the Activations table.
When the EndOfTerm IPN notification comes in the IPN scr... | [
0.3985258638858795,
-0.1043086051940918,
0.7501994371414185,
0.09300067275762558,
-0.10159087926149368,
-0.27040529251098633,
-0.0003327025333419442,
-0.1195269450545311,
-0.17453929781913757,
-0.5870987176895142,
-0.24424578249454498,
0.6956325173377991,
-0.20135948061943054,
0.0865062549... | |
I should start by saying that I am using ASP.NET using C# in a .NET 2.0 environment. In particular, I am trying to generate a csv download when the user clicks on a link button. The link to my postback is inside an UpdatePanel. In the past (before ajax) to return non-html content I would use code such as the following:... | [
0.2597118020057678,
-0.18861396610736847,
0.6646201014518738,
-0.15514624118804932,
-0.29224729537963867,
-0.23079758882522583,
0.16449393332004547,
0.14893366396427155,
-0.33355778455734253,
-0.8495312929153442,
-0.39081481099128723,
0.47027555108070374,
-0.2155664712190628,
0.07231529802... | |
of the browser this technique does not work.
Does someone have a better approach for this kind of situation. One constraint I have is that I am stuck with .net 2.0 for this part of the project and can't switch to 3.5 to solve this problem.
p.s. I need to generate the content with a dynamic filename as well
I would a... | [
0.19260083138942719,
0.07757078111171722,
0.31547462940216064,
0.1711135059595108,
-0.35609257221221924,
-0.3203200697898865,
0.5893598198890686,
0.37602680921554565,
-0.1082705706357956,
-0.9279702305793762,
-0.12992936372756958,
0.37560737133026123,
-0.5594222545623779,
0.300349205732345... | |
Down at the bottom of [this essay](http://www.schneier.com/essay-148.html) is a comment about a spooky way to beat passwords. Scan the entire HDD of a user including dead space, swap space etc, and just try everything that looks like it might be a password.
**The question:** part 1, are there any tools around (A live ... | [
0.45151615142822266,
0.029107199981808662,
-0.03840650990605354,
0.3530345559120178,
0.07823847979307175,
-0.41792574524879456,
0.12148793041706085,
0.15189403295516968,
-0.23985658586025238,
-0.5336666703224182,
0.08434290438890457,
0.1151895746588707,
-0.004881615750491619,
0.00340676354... | |
Dead space inside of some types of binary files (like .DOC)
The tool (aside from the last case) would not modify anything that can be detected via the file system API. I'm *not* looking for a block device find/replace but rather something that just scrubs everything that isn't part of a file.
part 2, How practical wo... | [
0.7126758694648743,
0.06141488626599312,
0.17382510006427765,
0.21610042452812195,
0.31785574555397034,
-0.3169381618499756,
0.2518053948879242,
0.15093278884887695,
-0.30364152789115906,
-0.49384748935699463,
-0.002097528427839279,
0.5534653067588806,
-0.05659173056483269,
0.3328183889389... | |
data) to back up the whole disk, wipe it clean and then restore it.
I would avoid generating a postback for this at all. Istead, you want to use a completely separate page, preferably even just a handler (\*.ashx). Then you can use a normal hyperlink and your old attachment code will work just fine. | [
0.10495278984308243,
-0.14520004391670227,
0.34316903352737427,
0.43002358078956604,
-0.12762752175331116,
-0.2946147620677948,
0.18359573185443878,
0.35096654295921326,
-0.12717679142951965,
-0.7291434407234192,
-0.326244980096817,
0.5447997450828552,
-0.311283677816391,
0.154288575053215... | |
I'm looking for alternatives to client side Javascript in web programming, because for me this language just plain sucks. I mean I am indeed impressed of the capabilities jquery or other javascript-frameworks accomplish, but for myself programming in javascript is a pain in the rump. I would like to replace it without ... | [
0.3634541630744934,
0.2133205533027649,
-0.25143304467201233,
0.009485612623393536,
-0.21734273433685303,
-0.1364801526069641,
0.2270311415195465,
0.20100587606430054,
-0.13787339627742767,
-0.9621119499206543,
0.10542405396699905,
0.7548937201499939,
-0.16266940534114838,
-0.2379193156957... | |
in java and "compiles" to javascript. More info on it here: <http://code.google.com/webtoolkit/>
Back to javascript, it is best to start small and understand what is going on. If you always start with frameworks, it is very hard to know the "how" behind it. But really, once you deal with a few cross-browser bugs, it's... | [
0.36203545331954956,
0.09923432767391205,
-0.3751687705516815,
-0.09071395546197891,
-0.2326578050851822,
-0.2827226519584656,
0.44772133231163025,
0.08267750591039658,
-0.23830662667751312,
-0.9245281219482422,
-0.11215456575155258,
0.5405883193016052,
-0.1697644144296646,
-0.272321671247... | |
I am using rails freeze 1.2.3 to run a rails app. Because the app is on a remote machine, I used ssh tunnel (ssh -l -L) to show the app on my screen. When I ran it, it correctly prompted the login page, after I put in the info, I got this error:
OCIError in ServiceController
Error while trying to retrieve text for erro... | [
0.18245777487754822,
0.06978020071983337,
0.1287805736064911,
-0.08751456439495087,
0.40821659564971924,
0.18717215955257416,
0.3977814316749573,
0.1997886449098587,
-0.08587423712015152,
-0.9248481392860413,
-0.014546604827046394,
0.4237877428531647,
-0.32836905121803284,
0.08318169414997... | |
source control.
Simply put, code is code and mistakes happen. It's nice to be able to go back and see what changed over time and be able to go back to those changes.
We have to add it manually to a source control system, but you can create addons for the Sql Server the Management System. I haven't ever created one t... | [
0.45561981201171875,
0.13293053209781647,
0.0562928132712841,
0.4776419401168823,
0.10720086097717285,
-0.05330471321940422,
-0.22201207280158997,
0.05789078027009964,
-0.21898606419563293,
-0.6332815289497375,
0.15640132129192352,
0.6938365697860718,
-0.26672837138175964,
0.20817866921424... | |
code and commit it automatically.
Update: I would always write extra code to check and see if the code exists and if it doesn't create a filler procedure and then the actual script do and alter procedure.
```
IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE
id = OBJECT_ID(N'[dbo].[SomeStoredProcedure]') AND
OBJEC... | [
0.22213053703308105,
-0.10427939146757126,
0.6133514046669006,
0.03461724519729614,
-0.02589474432170391,
-0.12003692984580994,
0.35909321904182434,
-0.31739702820777893,
-0.22469261288642883,
-0.5989217758178711,
-0.17153625190258026,
0.7047114968299866,
-0.5597031116485596,
-0.1661147773... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.