text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
master page. I got it to work by setting the status code later in the pages lifecycle, obviously the rendering of the master page was resetting it, so I overrode the render method and set it after the render was complete.
```
protected override void Render(HtmlTextWriter writer)
{
base.Render(writer);
Response... | [
0.15974128246307373,
0.07764451950788498,
0.5740190744400024,
-0.13526476919651031,
-0.08280916512012482,
-0.1392083764076233,
0.6490717530250549,
-0.15589086711406708,
-0.1889587640762329,
-0.8861422538757324,
0.02587985061109066,
0.7760493159294128,
-0.27194473147392273,
-0.0049008009955... | |
a 404 status code. I can't tell you what is wrong with your app, but I can tell you what I did:
1) Edited the web.config for custom errors:
> ```
> <customErrors mode="On">
> <error statusCode="404" redirect="404.aspx"/>
> </customErrors>
>
> ```
2) Added a 404.aspx page and set the status code to 404.
> ```
> p... | [
0.059381041675806046,
-0.056464023888111115,
0.5676873326301575,
0.09591402113437653,
0.004891489166766405,
-0.1997983455657959,
0.6095251441001892,
-0.11529655009508133,
-0.4567227065563202,
-0.8596193194389343,
-0.14269958436489105,
0.7701035737991333,
-0.4562644362449646,
0.005383468698... | |
extension that is processed by Asp.Net and does not exist, my fiddler log clearly shows a 404, here is the header:
> ```
> HTTP/1.1 404 Not Found
> Server: Microsoft-IIS/5.1
> Date: Sun, 07 Dec 2008 06:04:13 GMT
> X-Powered-By: ASP.NET
> X-AspNet-Version: 2.0.50727
> Cache-Control: private
> Content-Type: text/html; c... | [
0.025052839890122414,
-0.10472273826599121,
0.9238463640213013,
-0.13418927788734436,
0.05594155937433243,
-0.13984309136867523,
0.23355801403522491,
-0.07800280302762985,
-0.6236248016357422,
-0.6394636631011963,
-0.2007201910018921,
0.4423523545265198,
-0.3008287847042084,
0.244403406977... | |
test does do a redirect to the new page so the url of the requested file is pretty much lost (except its in the query string).
[Google 404 and .NET Custom Error Pages](https://stackoverflow.com/questions/152307/google-404-and-net-custom-error-pages)
**Header Spy Response:**
```
HTTP/1.1 404 Not Found
Date: Sun, 07 D... | [
0.2028026133775711,
0.02437257021665573,
0.21518896520137787,
0.11140195280313492,
-0.015114108100533485,
-0.42263883352279663,
0.6655030250549316,
0.034561362117528915,
0.3633526563644409,
-0.4231129586696625,
-0.007854504510760307,
0.2652653753757477,
0.18932795524597168,
0.0904304608702... | |
So I'm having a path issue on OS X Leopard. It seems OS X is adding other paths that I'm not stating and it's messing with my path priority. I only have a `.bash_login` file, I don't have a `.bashrc` or a .profile file. My `.bash_login` file is as such:
```
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/... | [
-0.011388822458684444,
0.2474006861448288,
0.1590731292963028,
-0.1919613778591156,
-0.15699194371700287,
-0.2689874768257141,
0.5847582221031189,
0.10304524749517441,
-0.4027651846408844,
-0.8506973385810852,
-0.03482584282755852,
0.6861012578010559,
-0.6896457672119141,
-0.14047431945800... | |
and Gems are taking priority over the one I have installed at `/usr/local/bin`, figured maybe you fellow Rubyists could help too.
Have you looked inside these two directories:
```
/etc/paths.d/
/etc/manpaths.d
```
Any paths defined in files in those directories get appended automatically to PATH variable -- I mostly... | [
0.09665811061859131,
-0.010356951504945755,
-0.06742463260889053,
0.15288743376731873,
0.0034004217013716698,
-0.1642853021621704,
0.06636716425418854,
-0.48437124490737915,
-0.32092127203941345,
-0.7843644618988037,
-0.023696813732385635,
0.9372979998588562,
-0.2494896650314331,
-0.279805... | |
reads and sets up the paths defined in the files `/etc/paths` and `/etc/manpaths`. A look at `/etc/paths` reveals this:
```
$ cat /etc/paths
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin
```
And, I believe, those account for the half of what you are seeing as set in PATH. | [
0.370242178440094,
-0.04357193410396576,
0.22666653990745544,
0.020844459533691406,
0.2417568564414978,
-0.12907184660434723,
0.24954886734485626,
-0.2518683671951294,
-0.11999088525772095,
-0.9037061929702759,
-0.08952850848436356,
0.423696368932724,
-0.28877127170562744,
-0.0245786365121... | |
So I'm trying to take a bilinear interpolation algorithm for resizing images and add in alpha values as well. I'm using Actionscript 3 to do this, but I don't really think the language is relevant.
The code I have below actually works really well, but edges around "erased" regions seem to get darker. Is there an easy ... | [
0.03734760731458664,
-0.028989387676119804,
0.2683018743991852,
-0.3287338614463806,
-0.31836819648742676,
0.20853549242019653,
0.26558077335357666,
-0.34224632382392883,
-0.10775202512741089,
-0.6412239670753479,
0.12432172149419785,
0.3207441568374634,
-0.58383709192276,
0.03275428712368... | |
y + 1);
d = getPixel32(x + 1, y + 1);
alph = (t(a) * x_opposite + t(be) * x_ratio) * y_opposite + (t(c) * x_opposite + t(d) * x_ratio) * y_ratio;
red = (r(a) * x_opposite + r(be) * x_ratio) * y_opposite + (r(c) * x_opposite + r(d) * x_ratio) * y_ratio;
green = (g(a) * x_opposite + g(be) * x_ratio... | [
-0.2826373875141144,
-0.05796327814459801,
0.36366546154022217,
-0.06275678426027298,
-0.3502548038959503,
0.3605073392391205,
0.02705366350710392,
-0.5450917482376099,
-0.007862916216254234,
-0.22010537981987,
-0.2992556691169739,
0.38461241126060486,
-0.5824494361877441,
0.25664684176445... | |
* x_opposite + b(be) * x_ratio) * y_opposite + (b(c) * x_opposite + b(d) * x_ratio) * y_ratio;
```
Image of the effect: <http://beta.shinyhammer.com/images/site/eraser_pixelborders.jpg>
**Posting code of solution!**
```
a = getPixel32(x, y);
be =getPixel32(x + 1, y);
c = getPixel32(x, y + 1);
d = getPixel32(x +... | [
-0.012574880383908749,
0.009188865311443806,
0.6468713283538818,
-0.15841932594776154,
-0.658166229724884,
0.35261306166648865,
0.40958133339881897,
-0.6722425818443298,
-0.057989977300167084,
-0.1424698680639267,
0.13394232094287872,
0.2187965214252472,
-0.6856523156166077,
0.444207042455... | |
t(be) * x_ratio) * y_opposite + (r(c) * t(c) * x_opposite + r(d) * t(d) * x_ratio) * y_ratio);
red = (asum > 0) ? red / asum : 0;
green = ((g(a) * t(a) * x_opposite + g(be) * t(be) * x_ratio) * y_opposite + (g(c) * t(c) * x_opposite + g(d) * t(d) * x_ratio) * y_ratio);
green = (asum > 0) ? green / asum : 0;
blue ... | [
-0.125398188829422,
-0.1911933571100235,
0.2930172383785248,
-0.3207628130912781,
-0.3888222277164459,
0.5033308267593384,
0.16517992317676544,
-0.48382264375686646,
-0.11144793033599854,
-0.32735970616340637,
-0.36275407671928406,
0.4645046591758728,
-0.6718542575836182,
0.430245965719223... | |
* t(d) * x_ratio) * y_ratio);
blue = (asum > 0) ? blue / asum : 0;
```
You need to multiply each of your r,g,b values by the corresponding alpha before working with them, then divide the values by the final alpha when you're done. It's easy to imagine the effect this will have when one of the pixels has an alpha of ze... | [
0.5960932374000549,
-0.0441989041864872,
0.16593961417675018,
-0.2530122399330139,
0.12127330899238586,
0.224733367562294,
0.38011741638183594,
-0.2906227111816406,
-0.038383424282073975,
-0.791182279586792,
-0.19243314862251282,
0.299948126077652,
-0.6026977896690369,
0.26749855279922485,... | |
divide by zero, and make sure that roundoff error doesn't push your final values past the upper limit.
Often images will be stored in memory with the alpha already multiplied into the r,g,b values - this is called premultiplied alpha ([Wikipedia reference](http://en.wikipedia.org/wiki/Alpha_compositing)). | [
0.15192067623138428,
-0.1189412921667099,
-0.06181672587990761,
0.005902096629142761,
0.07419764250516891,
0.07346182316541672,
0.0998203307390213,
-0.19670887291431427,
-0.2372741848230362,
-0.3762679398059845,
-0.16024678945541382,
0.25261834263801575,
-0.2978314459323883,
0.164170503616... | |
I need to get a file into memory in my app from a secured web location. I have the URL of the file to capture, but can't seem to get the security issue resolved. Here's the code from the [Cookbook samples page](http://groovy.codehaus.org/Simple+file+download+from+URL):
```
def download(address)
{
def file = new Fi... | [
0.30666857957839966,
0.3029173016548157,
0.4057289659976959,
-0.1518808752298355,
0.2460927814245224,
0.11697239428758621,
0.1550035923719406,
-0.4307329058647156,
-0.15617655217647552,
-0.689690887928009,
0.03766726702451706,
0.650933563709259,
-0.03681385889649391,
-0.07306545227766037,
... | |
in 3 lines (or less)
def out = new ByteArrayOutputStream()
out << new URL(address).openStream()
out.toByteArray()
}
```
When I try this against an unsecured URL (pick any image file you can find on the net), it works just fine. However, if I pick a URL that requires a user/password, no go.
A... | [
0.14785714447498322,
-0.24439342319965363,
0.5780849456787109,
-0.12148934602737427,
-0.20715570449829102,
0.05533469840884209,
0.5603179931640625,
-0.03375176340341568,
-0.14159883558750153,
-0.7986564040184021,
0.18035832047462463,
0.35992124676704407,
-0.5946099162101746,
0.238023042678... | |
a 302 response with a location to a login server. If I access that location with an Authenticator set, then I get another 302 with a Cookie and the location set back to the original URL. If I then access the original, the download occurs correctly.
So, I have to mimic a browser a bit, but eventually it all works.
Mak... | [
-0.029949182644486427,
-0.1119520515203476,
0.39571845531463623,
0.17853643000125885,
-0.0720483809709549,
0.06053879112005234,
0.2804192900657654,
-0.08061282336711884,
0.049920566380023956,
-0.681397557258606,
0.1262109875679016,
0.7975442409515381,
-0.35718971490859985,
0.03258698061108... | |
= "Basic " + "${user}:${passwd}".bytes.encodeBase64()
url.setRequestProperty("Authorization", remoteAuth);
out << url.inputStream
}
```
Hope that helps! | [
0.2650397717952728,
0.10585309565067291,
0.35625627636909485,
-0.19284681975841522,
0.45265963673591614,
0.10847941040992737,
0.46179255843162537,
-0.23304419219493866,
0.03384288772940636,
-0.6490673422813416,
-0.16312140226364136,
0.34140872955322266,
-0.22863343358039856,
0.257009595632... | |
I don't know how to save object with where clause. I need it to prevent saving object with range of dates overlapping on others.
```
public class TaskEvent
{
public DateTime StartDate {get;set;}
public DateTime EndDate {get;set;}
}
```
I want to check overlaping in criteria within saving operation but I don'... | [
0.06577401608228683,
-0.25475388765335083,
0.609334409236908,
-0.01839904673397541,
0.1191939190030098,
-0.18914011120796204,
0.248238205909729,
-0.2538776099681854,
-0.15489059686660767,
-0.6362338066101074,
-0.18375033140182495,
0.6062606573104858,
-0.14393359422683716,
0.157582238316535... | |
Both Session.Clear() and Session.Abandon() get rid of session variables. As I understand it, Abandon() ends the current session, and causes a new session to be created thus causing the End and Start events to fire.
It seems preferable to call Abandon() in most cases, such as logging a user out. Are there scenarios whe... | [
0.1366814821958542,
0.18147671222686768,
-0.06567922979593277,
-0.20596830546855927,
0.34934136271476746,
-0.4576283395290375,
0.47166815400123596,
-0.04362370818853378,
-0.06848850846290588,
-0.23038408160209656,
-0.20415472984313965,
0.7656888365745544,
-0.412933349609375,
0.504357099533... | |
and the user will get a new session key. You could use it for example when the user logs out.
Use `Session.Clear()`, if you want that the user remaining in the same session (if you don't want the user to relogin for example) and reset all the session specific data. | [
0.3021576702594757,
-0.40334969758987427,
0.2458924502134323,
0.11044107377529144,
0.19493237137794495,
-0.4240380525588989,
0.21626852452754974,
0.2533189654350281,
-0.42154237627983093,
-0.6202117204666138,
-0.30728697776794434,
0.7685227990150452,
-0.30997103452682495,
0.408317089080810... | |
I'm trying to write a program to calculate the quadratic formula. When I run it, I get 2 error messages:
```
error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
fatal error LNK1120: 1 unresolved externals
```
this is after I changed the last line of code from
...:
```
<< ... | [
-0.14220194518566132,
0.42489296197891235,
0.32922422885894775,
-0.04040093347430229,
-0.16397027671337128,
0.22493454813957214,
0.615705132484436,
-0.14347302913665771,
-0.0979534238576889,
-0.43447145819664,
0.11497937887907028,
0.4682007133960724,
-0.13118022680282593,
0.213429510593414... | |
"Write tests until fear is
> transformed into boredom."
[/**Update**]
I think the problem prevalent in the current times is the lack of unit testing... not excessive testing. I think I see what you're getting at.. I wouldn't term it as excessive unit-testing but rather.. not being smart about where you focus your ef... | [
0.6066434979438782,
0.40622398257255554,
0.04933144152164459,
0.16936485469341278,
-0.04309035465121269,
-0.3042987883090973,
0.6276903748512268,
-0.09544510394334793,
-0.15178819000720978,
-0.5504736304283142,
0.08703327178955078,
0.6150484681129456,
0.006613618694245815,
0.17780232429504... | |
location of the defect. The same defect shouldn't cause tens of UTs to break simultaneously
* **Don't test code that you didn't write.** A corollary is: you don't test framework code (like reading values from an app.config file) You just assume it works. And how many times have you had framework code breaking? Next to ... | [
0.5727779865264893,
0.23822933435440063,
0.045753754675388336,
0.2646729052066803,
0.13809086382389069,
-0.06959781050682068,
0.6943387389183044,
-0.17237384617328644,
-0.3071848154067993,
-0.6951446533203125,
-0.07577987015247345,
0.562299370765686,
0.1587844341993332,
-0.1464509069919586... | |
under a test harness.. instead of spending time writing redundant tests for areas that you know are pretty solid.
e.g. A third party/team library keeps breaking at the interface.. doesn't work like it is supposed to. Mocks won't catch it. Have a regression type suite using the real collaborator and running some sanity... | [
0.3841661810874939,
-0.18050824105739594,
-0.12730099260807037,
0.6697816252708435,
-0.14085716009140015,
-0.45993950963020325,
0.6582850813865662,
-0.22464177012443542,
-0.004886892158538103,
-0.42569097876548767,
0.15185314416885376,
0.47848886251449585,
-0.1333995908498764,
-0.057676710... | |
I'm fairly new to ASP.NET MVC, and I'm having a little trouble with scripts... in particular, I want to use jQuery in most pages, so it makes sense to put it in the master page. However, if I do (from my `~/Views/Shared/Site.Master`):
```
<script src="../../Scripts/jquery-1.2.6.js" type="text/javascript"></script>
``... | [
0.17119163274765015,
0.20012390613555908,
0.3990834057331085,
-0.37794309854507446,
-0.2305413782596588,
-0.08510909974575043,
0.2823063135147095,
-0.059577297419309616,
-0.18449074029922485,
-0.950472891330719,
0.012576914392411709,
0.5981505513191223,
0.08010345697402954,
-0.116807885468... | |
(I'll post below) - but: am I missing something?
I'd rather not have to involve a script-manager, as that seems to defeat the simplicity of the ASP.NET MVC model... or am I worrying too much?
Here's the way I can get it working, which works also for non-trivial virtuals - but it seems over-complicated:
```
<script s... | [
-0.3198395371437073,
0.23175610601902008,
0.7649633288383484,
0.014886526390910149,
-0.05526791885495186,
0.037355635315179825,
0.21507546305656433,
-0.17402370274066925,
-0.29781657457351685,
-0.7251905202865601,
0.01125768106430769,
0.7138711810112,
-0.5988444685935974,
-0.01192705146968... | |
Given a file tree - a directory with directories in it etc, how would you write a script to create a diagram of the file-tree as a graphic file that I can embed in a word processor document.
I prefer vector (SVG, EPS, EMF...) files.
The tool must run on Windows, but preferably cross-platform.
The tool may be commercial... | [
0.30068203806877136,
-0.04555070400238037,
0.27115899324417114,
0.20969568192958832,
0.11207576096057892,
-0.10899098962545395,
0.039513662457466125,
-0.31197261810302734,
-0.25877314805984497,
-0.8020476698875427,
-0.17745083570480347,
0.6028717160224915,
-0.09768296033143997,
0.191764771... | |
folders I redirected to a text file, which I then edited. For example if a subfolder contained 20 similarly typed files that individually were not important to the point I was making, I left just two and replaced the rest with one ... line. I then printed out the file to console again and screen grabbed it.
Before scre... | [
0.05019695684313774,
-0.05615288391709328,
0.379362553358078,
0.2246500551700592,
-0.16017836332321167,
0.34393006563186646,
-0.1409754902124405,
-0.07204555720090866,
-0.5786224007606506,
-0.6021696329116821,
0.0696340873837471,
0.2626121938228607,
-0.47888481616973877,
-0.032674256712198... | |
I'd write a Visio Extension or may be some command line that produces SVG. SVG being HTML5 substandard, would even allow painless inclusion into online documentation.
Update 2017-10-17.
I am sorry that this question was removed as not belonging to SO. So I have re-worded it. I need a script - not a WYSIWYG tool. So an... | [
0.46424296498298645,
0.2769623100757599,
0.39079874753952026,
-0.0027608766686171293,
-0.19802922010421753,
-0.2966473400592804,
0.5427770018577576,
-0.3187015950679779,
-0.14827361702919006,
-0.6288074851036072,
-0.3433757424354553,
0.6702203750610352,
-0.13241995871067047,
0.092077746987... | |
bar.xml
├───Baz
│ ├───BadBaz
│ │ badbaz.xml
│ └───Drop
...
```
**tree /A**
```
C:\Foobar>tree /A
C:.
+---FooScripts
+---barconfig
+---Baz
¦ +---BadBaz
¦ \---Drop
...
```
**tree /F /A**
```
C:\Foobar>tree /A
C:.
+---FooScripts
¦ foo.sh
+---barconfig
¦ bar.xml
+---Baz
¦ +---BadBaz
¦ ¦ badb... | [
0.0953177884221077,
0.5009746551513672,
0.691222071647644,
-0.3632132411003113,
-0.25698208808898926,
0.23531101644039154,
-0.06587263196706772,
-0.3940465450286865,
0.018353184685111046,
-0.603249192237854,
-0.38416725397109985,
0.41689959168434143,
-0.690802276134491,
-0.0644358992576599... | |
is used with code pages that do not support graphic characters and to send output to printers that do not properly interpret graphic characters. | [
0.09184662252664566,
-0.04616294056177139,
0.02200576663017273,
0.20278142392635345,
-0.11794883757829666,
-0.06743452697992325,
-0.047870296984910965,
0.15770487487316132,
0.12182122468948364,
-0.3772217035293579,
-0.3905043601989746,
0.006530473940074444,
-0.30183491110801697,
-0.0382376... | |
For a WPF application which will need 10 - 20 small icons and images for illustrative purposes, is storing these in the assembly as embedded resources the right way to go?
If so, how do I specify in XAML that an Image control should load the image from an embedded resource?
If you will use the image in multiple places... | [
0.2558186650276184,
-0.061622217297554016,
0.6147925853729248,
-0.06478656083345413,
0.0016708316979929805,
0.01843559369444847,
-0.07848989963531494,
-0.710188090801239,
-0.5267040133476257,
-0.7055646181106567,
-0.16933822631835938,
0.49820125102996826,
-0.2923326790332794,
-0.2419330030... | |
I found that I had to set the `Image.png` file to have a build action of `Resource` rather than just `Content`. This causes the image to be carried within your compiled assembly. | [
0.4409179389476776,
-0.01224127784371376,
0.19986899197101593,
-0.03334261104464531,
0.0062653739005327225,
0.1383330523967743,
0.11981058865785599,
-0.19208508729934692,
-0.09944751858711243,
-0.7342105507850647,
-0.09793084114789963,
0.4312995970249176,
-0.18757645785808563,
0.1445277333... | |
How do I find out which directories are responsible for chewing up all my inodes?
Ultimately the root directory will be responsible for the largest number of inodes, so I'm not sure exactly what sort of answer I want..
Basically, I'm running out of available inodes and need to find a unneeded directory to cull.
Than... | [
0.5204580426216125,
0.3952779471874237,
-0.03652965649962425,
0.06941637396812439,
0.25971800088882446,
-0.11261925846338272,
0.13419219851493835,
0.13730266690254211,
-0.2971154451370239,
-0.41380107402801514,
-0.14411012828350067,
0.5375277996063232,
-0.48928841948509216,
0.0807965695858... | |
| wc -l) $1
``` | [
0.08469986915588379,
0.48264262080192566,
0.46046707034111023,
-0.1959153562784195,
0.1193651482462883,
-0.22293789684772491,
0.22146525979042053,
-0.11027725040912628,
0.05793711543083191,
-0.3179929554462433,
0.10093404352664948,
0.6482028365135193,
-0.42068344354629517,
0.41035327315330... | |
How would I handle something like the below uri using ASP.NET MVC's routing capability:
```
http://localhost/users/{username}/bookmarks/ - GET
http://localhost/users/{username}/bookmark/{bookmarkid} - PUT
```
Which lists the bookmarks for the user in {username}.
Thanks
first you need to create a new route in global... | [
-0.11109743267297745,
-0.33921393752098083,
0.6296369433403015,
0.18568837642669678,
-0.09516465663909912,
0.040360547602176666,
0.13247722387313843,
-0.33242228627204895,
-0.45643410086631775,
-1.0291645526885986,
0.05692344903945923,
0.25884804129600525,
-0.3043159544467926,
0.0159912109... | |
I have a Page with a UserControl on it. If the user presses Esc while anywhere on Page I want to handle.
I thought this would be as easy as hooking up the PreviewKeyDown event, testing for the Esc key, and then handling it. However, when I placed I breakpoint in the event handler I found it was never getting called. I... | [
0.1756460964679718,
0.19372786581516266,
0.08497530966997147,
0.09102348983287811,
0.09607452154159546,
-0.2596715986728668,
0.431490033864975,
-0.033631689846515656,
-0.16904057562351227,
-0.7450079917907715,
0.13289768993854523,
0.20932061970233917,
-0.002717586001381278,
0.1614200323820... | |
routed event, rather than a bubbling one. If that is the case, then if your Page isn't getting the event, the UserControl shouldn't be either since it is below the Page in the visual tree. Maybe try handling it at the top level of your app (Window perhaps?) and see if it is getting the event?
Another option that might... | [
0.4476792514324188,
-0.7360894083976746,
0.24272774159908295,
0.416429728269577,
-0.14291349053382874,
-0.37791433930397034,
0.19013279676437378,
0.41724956035614014,
-0.35648149251937866,
-0.4917002022266388,
-0.01728389784693718,
0.3869425058364868,
-0.2730078101158142,
-0.10271300375461... | |
I need some help calculating Pi. I am trying to write a python program that will calculate Pi to X digits. I have tried several from the python mailing list, and it is to slow for my use.
I have read about the [Gauss-Legendre Algorithm](http://en.wikipedia.org/wiki/Gauss-Legendre_algorithm), and I have tried porting i... | [
-0.052864786237478256,
0.21623335778713226,
0.28976643085479736,
-0.07982054352760315,
-0.0600966215133667,
0.3129866421222687,
-0.011302048340439796,
-0.12108948081731796,
-0.1781773418188095,
-0.5299568176269531,
0.18393917381763458,
0.18215946853160858,
-0.4677801728248596,
0.2019591033... | |
a = (a+b)/2
b = math.sqrt(b*y)
t = t - x * square((y-a))
x = 2* x
pi = (square((a+b)))/4*t
print pi
raw_input()
```
1. You forgot parentheses around `4*t`:
```
pi = (a+b)**2 / (4*t)
```
2. You can use `decimal` to perform calculation with higher precision.
```
#!/usr/bin/env python
from __future__ impo... | [
-0.06434600055217743,
0.06734996289014816,
0.0714636743068695,
-0.26519912481307983,
0.09818907082080841,
0.19953139126300812,
0.11347696185112,
-0.43649521470069885,
-0.17992371320724487,
-0.08301037549972534,
-0.197434201836586,
0.5698084831237793,
-0.4040532112121582,
-0.402827888727188... | |
a, b, t, p = 1, 1/D(2).sqrt(), 1/D(4), 1
pi = None
while 1:
an = (a + b) / 2
b = (a * b).sqrt()
t | [
-0.07918225228786469,
-0.0002913626376539469,
0.4672953486442566,
-0.2556964159011841,
-0.05538201704621315,
0.6499804854393005,
0.14895465970039368,
-0.733432412147522,
-0.018574493005871773,
-0.21993009746074677,
-0.3823756277561188,
0.2685256004333496,
-0.35154831409454346,
-0.056629762... | |
-= p * (a - an) * (a - an)
a, p = an, 2*p
piold = pi
pi = (a + b) * (a + b) / (4 * t)
if pi == piold: # equal within given precision | [
0.014408738352358341,
-0.05819030851125717,
0.3375546932220459,
-0.05486369878053665,
-0.1489420384168625,
0.47560378909111023,
0.11255685985088348,
-0.8702898621559143,
0.18759360909461975,
-0.021399181336164474,
0.036768727004528046,
0.09828788042068481,
0.07419764995574951,
0.0419408529... | |
break
return +pi
decimal.getcontext().prec = 100
print pi_gauss_legendre()
```
Output:
```
3.141592653589793238462643383279502884197169399375105820974944592307816406286208\
998628034825342117068
``` | [
-0.5065459609031677,
0.3827962279319763,
0.10309430956840515,
-0.05867140740156174,
0.12525251507759094,
0.316925972700119,
0.3109563887119293,
-0.6394382119178772,
-0.30048954486846924,
-0.12853781878948212,
-0.4402913749217987,
0.4323255121707916,
-0.2499978244304657,
-0.0218721181154251... | |
Why don't we get compile errors on inline code errors in asp.net mvc views f.eks
```
<h1><%= ViewData.Model.Title.Tostrig() %></h1>
```
The code above will build just fine. Wrong spelling in webform controls will give you an error so I can't see why this isn't supported in asp.net mvc
EDIT:
Luckily there seem to be... | [
0.3696560859680176,
0.1463368833065033,
0.3648746907711029,
0.12920241057872772,
0.025939814746379852,
-0.22992292046546936,
0.2730093002319336,
-0.10207264125347137,
-0.20862451195716858,
-0.6136590242385864,
-0.11548389494419098,
0.6929263472557068,
-0.3330751657485962,
-0.17394116520881... | |
errors. You will add some time to your build process, but in exchange for the wait you should be able to spot these errors more easily. | [
0.5470834374427795,
0.49970412254333496,
0.09123782813549042,
0.3256564438343048,
0.24350637197494507,
0.3153756558895111,
0.18455007672309875,
0.23640447854995728,
-0.18342985212802887,
-0.8962655067443848,
0.1174050122499466,
0.7002423405647278,
0.07592800259590149,
-0.08160225301980972,... | |
I'm building a web application that guides my users through the configuration and installation of an application. It builds a set of configuration files dynamically, then sends them in an archive (.ZIP file) along with an installer for the application. The web page is generated from a linux shell script (sorry), and fo... | [
0.7266898155212402,
0.12455171346664429,
0.21134960651397705,
-0.03775757551193237,
0.4019837975502014,
-0.22802571952342987,
-0.18434616923332214,
0.08919275552034378,
-0.15800529718399048,
-0.808968186378479,
-0.14070172607898712,
0.5836141109466553,
-0.24434395134449005,
0.0341870337724... | |
then start the download automatically, without asking the user to click a "download this file" link:
```
#!/bin/bash
echo_header_and_instructions # Standard HTML
<Magic HTML tag to start transfer> # ??? What goes here???
command_to_stream_the_files # Probably 'cat'
echo_end_tags ... | [
0.43311697244644165,
0.08216635137796402,
0.5739642381668091,
-0.04819726198911667,
0.051715489476919174,
-0.14877690374851227,
0.39564505219459534,
-0.3525594174861908,
-0.25377124547958374,
-0.45888951420783997,
-0.1606004536151886,
0.5933969020843506,
-0.1726052463054657,
-0.12612506747... | |
download:
```
<iframe id="file_download" width="0" height="0" scrolling="no"
frameborder="0" src=/cgi-bin/my/scripts/sendfiles?file=$filename.zip>
You need a browser that supports frames.
</iframe>`
``` | [
0.16387437283992767,
-0.18421116471290588,
0.6008051037788391,
0.2419358640909195,
-0.0032018874771893024,
0.02449885755777359,
0.04367371276021004,
-0.032368503510951996,
-0.5005422234535217,
-0.7119722366333008,
-0.2571897506713867,
0.4559265375137329,
-0.14136189222335815,
-0.0188079290... | |
For the umpteenth time my laptop just shut down in the middle of my game because my power cable had disconnected without me noticing it.
Now I want to write a little C# program that detects when my power cable disconnects and then emits a nice long System beep. What API could I use for that?
This should be trivial to ... | [
0.07018168270587921,
-0.11080704629421234,
0.43354588747024536,
0.16216817498207092,
0.2860478460788727,
-0.520668625831604,
0.5707754492759705,
0.05003407597541809,
-0.2605193853378296,
-0.6148216128349304,
-0.13904428482055664,
0.5791589021682739,
-0.12653180956840515,
0.3330182731151581... | |
I need to use `FtpWebRequest` to put a file in a FTP directory. Before the upload, I would first like to know if this file exists.
What method or property should I use to check if this file exists?
```
var request = (FtpWebRequest)WebRequest.Create
("ftp://ftp.domain.com/doesntexist.txt");
request.Credentials = n... | [
0.03626568615436554,
-0.37853360176086426,
0.8736857771873474,
-0.11435819417238235,
0.17974834144115448,
-0.08882452547550201,
0.5229061841964722,
-0.45807987451553345,
-0.20014582574367523,
-0.7879160642623901,
-0.1999136507511139,
0.5017713308334351,
-0.30240002274513245,
0.193833783268... | |
a general rule it's a bad idea to use Exceptions for functionality in your code like this, however in this instance I believe it's a win for pragmatism. Calling list on the directory has the potential to be FAR more inefficient than using exceptions in this way.
If you're not, just be aware it's not good practice!
ED... | [
0.3673704266548157,
0.0054290639236569405,
0.251265287399292,
-0.11657755076885223,
0.01551136840134859,
-0.7483004331588745,
0.5162584185600281,
-0.3340418338775635,
-0.5011941194534302,
-0.4116920828819275,
-0.15797901153564453,
0.5676829814910889,
-0.5062151551246643,
0.1268576383590698... | |
design limitation (big fat bug!) that unless FtpWebRequest is either downloading or uploading a file it will NOT send "TYPE I". See discussion and Microsoft response [here](http://social.msdn.microsoft.com/forums/en-US/netfxnetcom/thread/0c38814e-d8e3-49f3-8818-b5306cc100ce/).
I'd recommend using the following WebRequ... | [
-0.16468378901481628,
0.058919019997119904,
0.2948371171951294,
0.05489838495850563,
-0.14927586913108826,
-0.3862210810184479,
0.32057419419288635,
-0.01050474401563406,
-0.33847469091415405,
-0.7691740393638611,
-0.04248078167438507,
0.5260840058326721,
-0.49435633420944214,
0.2352942079... | |
I would like to generate some JavaScript on the server side in ASP.Net MVC. Is there a view engine that supports this? Ideally I would like to be able to get JavaScript from an url like:
```
http://myapp/controller/action.js
```
I've looked at the MonoRail project, and they seem to have this feature, but it's very ... | [
0.41026318073272705,
-0.04843941703438759,
0.33840063214302063,
0.05773893743753433,
-0.3540323078632355,
0.12813344597816467,
0.12822623550891876,
-0.07456013560295105,
-0.2769797444343567,
-0.8470434546470642,
0.08457081019878387,
0.39380449056625366,
-0.21760936081409454,
0.035348724573... | |
only a single action in the controller, but two views: one for HTML and one for JS.
**Edit 2:** I basically wanted to achieve the same result as [router extension parsing/request handling](http://www.pagebakers.nl/2007/06/05/using-json-in-cakephp-12/) in CakePHP.
I wanted to extend this idea to not only allow Javascri... | [
-0.10416778922080994,
-0.6030066013336182,
0.6910502314567566,
0.0894210934638977,
-0.3550524413585663,
0.03142862766981125,
0.0687536746263504,
-0.08626940846443176,
-0.4114833176136017,
-0.6270200610160828,
-0.06810977309942245,
0.31854817271232605,
-0.23275339603424072,
0.01500578969717... | |
use it with NVelocity/WebForms/Whatever:
```
public class TypeViewEngine<T> : IViewEngine where T : IViewEngine
{
private readonly T baseEngine;
public T BaseEngine
{
get { return baseEngine; }
}
public TypeViewEngine(T baseEngine)
{
this.baseEngine = baseEngine;
}
pub... | [
0.1956152319908142,
-0.49642911553382874,
0.34687724709510803,
-0.15317830443382263,
0.132862851023674,
-0.04134681075811386,
0.27870312333106995,
-0.18987184762954712,
-0.07221312820911407,
-0.9948327541351318,
-0.24482671916484833,
0.3759140074253082,
-0.3880366384983063,
0.1066998839378... | |
"{controller}/{action}.{type}",
new {controller = "Home", action = "Index", type = "html"}
);
}
public ViewEngineResult FindView(ControllerContext controllerContext, string viewName, string masterName)
{
var vars = controllerContext.RouteData.Values;
if(vars["type"] ... | [
-0.012945955619215965,
-0.6847594380378723,
0.9031481742858887,
0.07483184337615967,
0.054000865668058395,
-0.07913599908351898,
0.38154688477516174,
-0.07874121516942978,
-0.09206134080886841,
-0.5858609080314636,
-0.3781614601612091,
0.572665810585022,
-0.3308907747268677,
0.410322964191... | |
viewName = string.Format("{0}/{1}", vars["type"], viewName);
}
return baseEngine.FindView(controllerContext, viewName, masterName);
}
public ViewEngineResult FindPartialView(ControllerContext controllerContext, string partialViewName)
{
return baseEngine.FindPartialView(controllerCo... | [
-0.06842582672834396,
-0.21567115187644958,
0.9051843881607056,
-0.29217958450317383,
0.04270654916763306,
-0.03747786581516266,
0.3031107187271118,
-0.046483613550662994,
-0.03382449224591255,
-0.7566656470298767,
-0.5007911920547485,
0.5732250809669495,
-0.3950496315956116,
0.37083500623... | |
= new TypeViewEngine<WebFormViewEngine>(new WebFormViewEngine());
ve.RegisterRoutes(RouteTable.Routes);
RegisterRoutes(RouteTable.Routes);
ViewEngines.Engines.Clear();
ViewEngines.Engines.Add(ve);
}
```
Thanks for everyone's help with this! | [
0.30578362941741943,
-0.035739559680223465,
0.7402051091194153,
-0.18382145464420319,
-0.05984906107187271,
-0.11017244309186935,
0.7006707787513733,
-0.12181641161441803,
-0.28095269203186035,
-0.9192324280738831,
-0.33528760075569153,
0.45598042011260986,
-0.2953023314476013,
0.211609393... | |
I guess, the following is a standard problem on every school or university:
It is Your job to teach programming. Unfortunately, some of the students
are semi-professionals and have years of experience while others do not even know the basic concepts, e.g. the concept "typed variable".
As far as I know, this leads to ... | [
0.27859508991241455,
0.20489312708377838,
-0.22465136647224426,
0.3311527669429779,
0.06580508500337601,
-0.46860894560813904,
0.6017383337020874,
0.3306208848953247,
-0.09411009401082993,
-0.5637311935424805,
-0.2883426249027252,
0.6959184408187866,
0.21583692729473114,
0.3067402839660644... | |
Inexperienced students cannot follow the lectures and a lot of them will focus on unimportant stuff (e.g. understanding every detail of a complex example while not getting the concept behind the example). Some of them will give up.
3. Universities invent an artificial programming language to give experienced programmer... | [
0.3085651099681854,
0.12440449744462967,
0.2456042617559433,
0.3953498303890228,
0.05292043462395668,
-0.19933383166790009,
0.5411888360977173,
0.11884968727827072,
-0.4635046124458313,
-0.6493080258369446,
-0.2653541564941406,
0.7706242799758911,
0.1458870768547058,
-0.22688239812850952,
... | |
real-world problems). This requires the professor himself to have hands-on experience, work with new technologies and know them pretty well and not just teach what he had learned a couple decades ago.
The thing is, programming should be learned by practice. The instructor should focus on motivating students to code an... | [
-0.22963504493236542,
0.09366913139820099,
-0.056705500930547714,
0.3714166581630707,
0.23220287263393402,
0.03694498911499977,
0.6949562430381775,
0.15201646089553833,
-0.03592934459447861,
-0.606540322303772,
-0.3258152902126312,
0.860844612121582,
-0.17139491438865662,
-0.08177193254232... | |
and where it might be useful.
Just a thought though. Not tried it! ;) | [
0.4438121020793915,
0.07316575944423676,
0.08151303231716156,
0.1854315847158432,
0.146846204996109,
0.20075778663158417,
0.23452340066432953,
0.19765827059745789,
-0.18476112186908722,
-0.11715412884950638,
0.09593342989683151,
0.42872869968414307,
0.1775776445865631,
-0.14604994654655457... | |
Is there any way to increase the heap size for Java ME on a device? I'm developing an application for a Nokia N95, but am bumping into memory issues when I try to do image processing of larger images. The phone has plenty of heap space available, but seems to restrict the amount allowed to be used by Java ME to 1MB.
Sh... | [
0.047393735498189926,
-0.058406248688697815,
0.26105305552482605,
0.029682204127311707,
-0.1189134493470192,
0.06402784585952759,
0.2491370439529419,
-0.17355920374393463,
-0.44741877913475037,
-0.45849424600601196,
0.08379290252923965,
0.4708203077316284,
-0.3131542503833771,
-0.214215949... | |
operations are possible. You figure... | [
0.2066638022661209,
0.022598786279559135,
-0.016238151118159294,
0.08594267815351486,
0.33850178122520447,
-0.002463520737364888,
0.06887168437242508,
0.12382031977176666,
-0.5274215340614319,
-0.2690856456756592,
-0.40815097093582153,
0.48428359627723694,
-0.1564399003982544,
-0.341674387... | |
I'm trying to implement a Load / Save function for a Windows Forms application.
I've got following components:
* A tree view
* A couple of list views
* A couple of text boxes
* A couple of objects (which holds a big dictionarylist)
I want to implement a way to save all of this into a file, and resume/load it later o... | [
0.4725863039493561,
0.05919582024216652,
0.3353581726551056,
0.08625848591327667,
0.0487404502928257,
-0.10639714449644089,
-0.12268383055925369,
-0.08240353316068649,
-0.23227794468402863,
-0.9167452454566956,
0.10568355768918991,
0.27204230427742004,
-0.17205825448036194,
-0.025493986904... | |
an object and some ancestors
to the UI; the use of C# 3.0 here is purely for brevity -
everything would work with C# 2.0 too.
Most of the code here is setting up the form, and/or
dealing with property-change notifications -
importantly, there isn't any code devoted to updating
the UI from the object model, or the obje... | [
0.13856720924377441,
0.0336960032582283,
0.2906735837459564,
0.22425377368927002,
-0.11762548983097076,
-0.34058743715286255,
-0.012703459709882736,
-0.32345402240753174,
-0.1850528120994568,
-0.5663943290710449,
-0.03574487939476967,
0.5311229228973389,
0.022115962579846382,
0.09380009025... | |
however,
most 2-way UI binding will work considerably better
if you do implement this. Not that PostSharp has some
interesting ways of doing this with minimal code.
```
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Windows.Forms;
using System.Xml.Serializati... | [
0.0631989985704422,
-0.3555693030357361,
0.9368040561676025,
0.042784709483385086,
0.019869396463036537,
0.2851264178752899,
0.05859757587313652,
-0.3149096369743347,
-0.2886064946651459,
-0.8992112874984741,
-0.43096670508384705,
0.29656144976615906,
-0.5740728378295898,
0.248322054743766... | |
using (Form form = new Form {
DataBindings = {{"Text", source, "Name"}}, // show customer name as form title
Controls = {
new DataGridView { Dock = DockStyle.Fill, // grid of orders
DataSource = source, DataMember = "Orders"}, | [
0.1407248079776764,
-0.14834833145141602,
0.8938562870025635,
-0.03962872177362442,
0.3621808886528015,
0.3043404221534729,
-0.09631715714931488,
-0.5014198422431946,
-0.3316563665866852,
-0.588346540927887,
-0.046161849051713943,
0.44402679800987244,
-0.1261141300201416,
0.230820059776306... | |
new TextBox { Dock = DockStyle.Top, ReadOnly = true, // readonly order ref
DataBindings = {{"Text", source, "Orders.OrderRef"}}},
new TextBox { Dock = DockStyle.Top, // editable customer name
DataBindings = {{"Text", source, "Name"}}}, | [
-0.27997225522994995,
-0.07219995558261871,
0.7028335928916931,
-0.367896169424057,
-0.06786973029375076,
0.6257851719856262,
-0.03931828588247299,
-0.11423848569393158,
-0.49019673466682434,
-0.751169741153717,
-0.25887322425842285,
0.7685607671737671,
-0.26358848810195923,
0.087444990873... | |
(save = new Button { Dock = DockStyle.Bottom, Text = "save" }),
(load = new Button{ Dock = DockStyle.Bottom, Text = "load"}),
(newCust = new Button{ Dock = DockStyle.Bottom, Text = "new"}),
}
}) | [
-0.32982027530670166,
-0.3106163740158081,
0.7495260238647461,
-0.23342262208461761,
0.47019878029823303,
0.46309828758239746,
0.03389011695981026,
-0.04479636251926422,
-0.49581825733184814,
-0.5325425863265991,
-0.48963266611099243,
0.8180956244468689,
-0.11489179730415344,
0.04210393503... | |
{
const string PATH = "customer.xml";
form.Load += delegate {
newCust.PerformClick(); // create new cust when loading form
load.Enabled = File.Exists(PATH);
}; | [
-0.09711722284555435,
-0.3438982367515564,
0.6087133884429932,
-0.18585675954818726,
0.1295211911201477,
0.13048572838306427,
0.14587870240211487,
-0.2690187096595764,
-0.01625656522810459,
-0.5357052087783813,
-0.4577741026878357,
0.49858832359313965,
-0.43191054463386536,
0.1258864849805... | |
save.Click += delegate {
using (var stream = File.Create(PATH)) {
serializer.Serialize(stream, source.DataSource);
}
load.Enabled = true;
}; | [
0.19444580376148224,
-0.38430464267730713,
0.5505634546279907,
0.03807774931192398,
0.34748148918151855,
0.11492982506752014,
0.20611274242401123,
-0.13976892828941345,
-0.264830619096756,
-0.7152877449989319,
-0.1603824943304062,
0.42191076278686523,
-0.5479810833930969,
0.372906714677810... | |
load.Click += delegate {
using (var stream = File.OpenRead(PATH)) {
source.DataSource = serializer.Deserialize(stream);
}
};
newCust.Click += delegate { | [
0.04913093522191048,
-0.4409681558609009,
0.36279916763305664,
0.16712680459022522,
0.2852911651134491,
0.03414751961827278,
0.09719409048557281,
-0.3139706552028656,
-0.4491276741027832,
-0.6362283825874329,
-0.13823065161705017,
0.2989330589771271,
-0.45505401492118835,
0.520961165428161... | |
source.DataSource = new Customer();
};
Application.Run(form);
}
}
}
[Serializable]
public sealed class Customer : NotifyBase {
private int customerId;
[DisplayName("Customer Number")]
public int CustomerId {
get { return customerId; }
set { SetField(ref ... | [
0.08682019263505936,
-0.15714630484580994,
0.7401089668273926,
-0.2864246964454651,
0.206655353307724,
0.18894603848457336,
0.04741240292787552,
-0.13989046216011047,
0.12684790790081024,
-0.5935455560684204,
-0.59685218334198,
0.5396012663841248,
-0.25595951080322266,
0.13782423734664917,... | |
}
}
private string name;
public string Name {
get { return name; }
set { SetField(ref name, value, "Name"); }
}
public List<Order> Orders { get; set; } // XmlSerializer demands setter
public Customer() {
Orders = new List<Order>();
}
}
[Serializable]
public sealed... | [
0.05285295844078064,
-0.2813127338886261,
0.5686967968940735,
-0.31451451778411865,
0.10125847160816193,
0.32611504197120667,
0.08556444942951202,
-0.2806275486946106,
-0.1870688796043396,
-0.38411229848861694,
-0.4891871213912964,
0.597517728805542,
-0.44285333156585693,
0.293463528156280... | |
public int OrderId {
get { return orderId; }
set { SetField(ref orderId, value, "OrderId"); }
}
private string orderRef;
[DisplayName("Reference")]
public string OrderRef {
get { return orderRef; }
set { SetField(ref orderRef, value, "OrderRef"); }
}
private de... | [
-0.2006463259458542,
0.016324248164892197,
0.4297979176044464,
-0.04679687321186066,
-0.008861248381435871,
0.5734872817993164,
-0.03034919686615467,
-0.11486031860113144,
0.08378893882036209,
-0.25616455078125,
-0.3243253231048584,
0.6829586625099182,
-0.35749268531799316,
0.1130765676498... | |
public decimal OrderValue {
get { return orderValue; }
set {
if (SetField(ref orderValue, value, "OrderValue")) {
OnPropertyChanged("TotalValue");
}
}
}
[DisplayName("Carriage Value")]
public decimal CarriageValue { | [
-0.24721494317054749,
-0.1392665058374405,
0.5547133088111877,
0.1324736475944519,
-0.16173812747001648,
0.5074219107627869,
0.0003021830052603036,
0.05457859858870506,
0.10581882297992706,
-0.3378237187862396,
-0.15773837268352509,
0.695559561252594,
-0.26777592301368713,
0.04913081973791... | |
get { return carriageValue; }
set {
if (SetField(ref carriageValue, value, "CarriageValue")) {
OnPropertyChanged("TotalValue");
}
}
}
[DisplayName("Total Value")]
public decimal TotalValue { get { return OrderValue + CarriageValue; } }
}
[Serializabl... | [
0.030066728591918945,
-0.3783739507198334,
0.5282031297683716,
0.055835261940956116,
-0.07550983875989914,
0.25334250926971436,
0.15744732320308685,
-0.09629958868026733,
0.0949694961309433,
-0.4251808524131775,
-0.19408857822418213,
0.5114293098449707,
-0.323284775018692,
-0.0431483723223... | |
[field: NonSerialized]
public event PropertyChangedEventHandler PropertyChanged;
protected bool SetField<T>(ref T field, T value, string propertyName) {
if (!EqualityComparer<T>.Default.Equals(field, value)) {
field = value;
OnPropertyChanged(propertyName);
return tr... | [
-0.2001725137233734,
-0.43854424357414246,
0.4415445923805237,
0.07184857130050659,
0.23212869465351105,
-0.0883956179022789,
0.36791127920150757,
-0.07847574353218079,
-0.1844342201948166,
-0.3361407220363617,
-0.33678069710731506,
0.9536958932876587,
-0.10667414963245392,
0.4552140831947... | |
void OnPropertyChanged(string propertyName) {
PropertyChangedEventHandler handler = PropertyChanged;
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
}
}
``` | [
0.14005734026432037,
-0.29757311940193176,
0.24918831884860992,
-0.12451989203691483,
0.5098274350166321,
-0.029584363102912903,
0.26689305901527405,
-0.23706525564193726,
-0.2473670095205307,
-0.201144739985466,
-0.3657578229904175,
0.6860806345939636,
-0.48873940110206604,
0.378003895282... | |
Can someone please let me know how do I implement "Did you mean" feature in Lucene.net?
Thanks!
You should look into the [SpellChecker](https://svn.apache.org/repos/asf/lucene/lucene.net/trunk/C%23/contrib/SpellChecker.Net/) module in the contrib dir. It's a port of Java lucene's [SpellChecker](https://lucene.apache.o... | [
0.23196153342723846,
-0.10837353765964508,
0.4215027391910553,
0.17934155464172363,
-0.1538465917110443,
-0.19389432668685913,
0.22698116302490234,
0.03440741077065468,
0.3830682337284088,
-0.6928168535232544,
0.12106665223836899,
0.06631114333868027,
0.03450566530227661,
-0.02651423588395... | |
This is silly, but I haven't found this information. If you have names of concepts and suitable references, just let me know.
I'd like to understand how should I validate a given named id for a generic entity, like, say, an email login, just like Yahoo, Google and Microsoft do.
I mean... If you do have an user named ... | [
0.3762882649898529,
0.21757887303829193,
0.5486833453178406,
-0.10683275014162064,
0.20071086287498474,
-0.2795290946960449,
0.13623318076133728,
-0.08384983986616135,
-0.37551411986351013,
-0.5526891350746155,
-0.11922324448823929,
0.43956273794174194,
-0.31421419978141785,
0.164665833115... | |
Is there any way I can specify a standard or custom numeric format string to always output the sign, be it +ve or -ve (although what it should do for zero, I'm not sure!)
Yes, you can.
There is conditional formatting. See [Conditional formatting in MSDN](http://msdn.microsoft.com/en-us/library/0c899ak8.aspx)
eg:
``... | [
0.02381129190325737,
0.10475113987922668,
0.3227221667766571,
-0.08350806683301926,
-0.034152861684560776,
0.035041097551584244,
0.01004357635974884,
-0.015392451547086239,
-0.15192577242851257,
-0.29836493730545044,
-0.16070935130119324,
0.41766294836997986,
-0.18786661326885223,
-0.20320... | |
I want to match a block of code *multiple* times in a file but can't work out the regular expression to do this. An example of the code block is:
```
//@debug
...
// code in here
...
//@end-debug (possibly more comments here on same line)
```
Each code block I'm trying to match will start with `//@debug` and stop at... | [
0.22047863900661469,
-0.29519909620285034,
0.23905475437641144,
0.20686320960521698,
0.15605174005031586,
-0.14350120723247528,
0.060377754271030426,
-0.23345187306404114,
-0.009936233051121235,
-0.5781915187835693,
0.20924049615859985,
0.28417205810546875,
-0.31350308656692505,
0.12503711... | |
operators grab as much as they possibly can with the results you've seen. Just change it to non-greedy where appropriate. In your case use:
/(/{2}\@debug)(.|\s)\*?(/{2}\@end-debug).\*/ | [
-0.23495884239673615,
-0.7232969403266907,
0.1147681325674057,
0.08782085031270981,
0.26803144812583923,
-0.09347987174987793,
-0.1205245852470398,
-0.1094491183757782,
-0.12653517723083496,
-0.4165090322494507,
-0.2613563537597656,
0.7956612706184387,
-0.48378217220306396,
-0.291918009519... | |
I am writing a Firefox extension. I would like to search the current webpage for a set of words, and count how many times each occurs. This activity is only performed when the user asks, but it must still happen reasonably quickly.
I am currently using indexOf on the BODY tag's innerHTML element, but am finding it too... | [
0.3124243915081024,
-0.03226275369524956,
0.921521782875061,
-0.2245698720216751,
0.1445033997297287,
-0.07794468849897385,
0.36075863242149353,
-0.2434990257024765,
-0.007908101193606853,
-0.67307448387146,
-0.1284557729959488,
0.7088759541511536,
-0.4265105426311493,
-0.07945344597101212... | |
break;
}
pos = len + match.length;
count++;
}
return count;
}
var html = content.document.body.innerHTML.toLowerCase()
for(var i=0; i<keywords.length; i++)
{
var kw = keywords[i];
myDump(kw + ": " + wordcount(html, kw));
}
```
With 100 keywords, this takes approximately 10 to 20 seconds to run. ... | [
0.09881073981523514,
-0.12701775133609772,
0.7324024438858032,
-0.06617384403944016,
0.040040306746959686,
-0.017584171146154404,
0.7881103754043579,
-0.5202358365058899,
-0.2679688334465027,
-0.43609198927879333,
-0.48415830731391907,
0.28143617510795593,
0.0631663128733635,
-0.1476585119... | |
of the performance I can expect:
* Navigate the DOM rather than using
innerHTML. Will this be likely
quicker or slower? It would have the
benefit of only searching textual
content.
* Loop through the document word by
word, accumulating a count of each
word's occurence simultaneously.
With this method I would have to d... | [
-0.10633410513401031,
0.12751635909080505,
0.5000818967819214,
0.07281244546175003,
-0.30209118127822876,
0.1525558978319168,
0.532776951789856,
-0.10496625304222107,
-0.09335396438837051,
-0.8205465078353882,
0.011502946726977825,
0.7927189469337463,
-0.06883969157934189,
-0.2172161638736... | |
= document.body.innerHTML.replace(/<.*?>/g,'').split(/\s+/);
var i = words.length;
var keywordCounts = {'keyword': 0, 'javascript': 0, 'today': 0};
var keywords = [];
var keywordMatcher = '';
var word;
for (word in keywordCounts) {
keywords[keywords.length] = word ;
keywordMatcher = keywordMatcher + '(' + word ... | [
-0.1988239288330078,
-0.22894276678562164,
0.8010437488555908,
-0.3384203612804413,
0.14428210258483887,
0.1074829027056694,
0.6386274695396423,
-0.6498411893844604,
-0.057099830359220505,
-0.5917583107948303,
-0.8802080154418945,
0.616727352142334,
-0.33293572068214417,
0.1626496911048889... | |
j = keywords.length;
do {
j = j - 1;
if (matched[j + 1]) {
keyword = keywords[j];
keywordCounts[keyword] = keywordCounts[keyword] + 1;
} | [
-0.32828837633132935,
-0.12875854969024658,
0.24628989398479462,
-0.40746474266052246,
-0.035999611020088196,
-0.1505407989025116,
0.4607633054256439,
-0.5054373741149902,
0.0413360595703125,
-0.3065682053565979,
-0.6062566041946411,
0.4506833553314209,
-0.32450342178344727,
0.054062489420... | |
} while (j);
} while (i);
}
```
I'll definitely grant that from a Big(O) perspective it isn't the best because as i and j get big it still requires n squared time but I've found regular expression processing to generally be pretty fast.
Basically I'm taking tvanfosson's idea and expanding on it, but rather than ... | [
-0.05702066794037819,
-0.026733314618468285,
0.6835455894470215,
-0.29186567664146423,
-0.028590183705091476,
-0.07587751746177673,
0.3006570339202881,
-0.2516605854034424,
-0.07123880088329315,
-0.43447786569595337,
-0.27913692593574524,
0.564975917339325,
-0.19236530363559723,
0.02388980... | |
new regular expression is constructed using each keyword as a group so when matched it returns an array of results that has (in my example) [fullMatch,keywordMatch,javascriptMatch,todayMatch]. I'm using decrementing do while loops because they've been shown in lots of places to be the fastest looping structure in JavaS... | [
0.20658427476882935,
-0.057930607348680496,
0.19677649438381195,
0.10153679549694061,
-0.23844359815120697,
0.03117169253528118,
0.4063849449157715,
-0.2256251573562622,
-0.25053396821022034,
-0.5415291786193848,
-0.15186241269111633,
0.5410681366920471,
-0.3457425832748413,
-0.14195157587... | |
I am working on a solo project, writing all code myself so no collaboration is required,
However, I do need the following features:
1. Check in a current version, with comments
2. Assign a label to a version
3. Retrieve a version using label/tag
4. NOT HOSTED (meaning I hold the repository on my local machine)
5. fre... | [
0.5468295216560364,
0.03771238774061203,
0.23642666637897491,
0.039804648607969284,
-0.2499280571937561,
-0.48294657468795776,
0.33576682209968567,
0.17643100023269653,
-0.27704155445098877,
-0.5029008388519287,
-0.0903700441122055,
0.7060464024543762,
-0.14912058413028717,
0.2266079634428... | |
code, do it right way from the very beginning, do not reinvent the wheel. | [
0.32388484477996826,
0.22448159754276276,
-0.4108770787715912,
0.4448382258415222,
0.07064706832170486,
-0.09246747940778732,
0.5517065525054932,
-0.12277239561080933,
0.09282027184963226,
-0.5130243897438049,
0.0680193081498146,
0.6904476284980774,
-0.3069109320640564,
0.21109646558761597... | |
I'm writing an application that allows users to upload images onto the server. I expect about 20 images per day all jpeg and probably not edited/resized. (This is another question, how to resize the images on the server side before storing. Maybe someone can please drop a .NET resource for that in the comment or so).
... | [
0.6935193538665771,
0.15412798523902893,
0.4575861692428589,
0.17112649977207184,
-0.23404090106487274,
0.028536157682538033,
0.04280060902237892,
0.2652187645435333,
-0.4864971339702606,
-0.9801462888717651,
0.17382420599460602,
0.3761395215988159,
-0.04393725097179413,
0.0338116548955440... | |
using an "image" or "binary data" data type of the database server.
I see advantages and disadvantages in both.
I like a) because I can easily relocate the files and just have to change the table entry. On the other hand I don't like storing business data on the web server and I don't really want to connect the web s... | [
0.25701501965522766,
0.17871662974357605,
0.19192668795585632,
0.19042040407657623,
0.16442984342575073,
-0.24905797839164734,
-0.10472745448350906,
0.208818718791008,
-0.6063634157180786,
-0.8224472999572754,
-0.02310534566640854,
0.4521597623825073,
-0.27289992570877075,
0.27494716644287... | |
Outsourcing that data could be more difficult.
I generally store files on the file-system, since that's what its there for, though there are exceptions. For files, the file-system is the most flexible and performant solution (usually).
There are a few problems with storing files on a database - files are generally muc... | [
0.35955810546875,
0.19984370470046997,
0.0987851545214653,
0.23394052684307098,
0.2754310369491577,
-0.06797047704458237,
0.04597095027565956,
-0.10852918028831482,
-0.4126182794570923,
-0.5946998596191406,
-0.16236141324043274,
0.718006432056427,
-0.04797114431858063,
0.006126007996499538... | |
there.
Regarding security - I usually store the files in a directory that is outside of the document root (not accessible through an http request) and serve them through a script that checks for the proper authorization first. | [
0.7259294390678406,
0.4362645149230957,
0.2663365304470062,
-0.0021747706923633814,
0.2303282618522644,
-0.5123072862625122,
0.0059056528843939304,
0.015355151146650314,
-0.04486481845378876,
-0.2961095869541168,
-0.34687235951423645,
0.6471323370933533,
0.2863542139530182,
-0.003521030070... | |
I've got MS Access database with linked tables, whenever each table is linked to a table in the same SQL Server database. I have a query inside Access that joins two tables (in particular I'm updating a table based on another using a join).
The question is does Access "download" all the table data before doing a join?... | [
0.06335413455963135,
0.2851921021938324,
0.5766274333000183,
0.15977035462856293,
0.12374211102724075,
0.10603825002908707,
-0.05771297216415405,
-0.06848928332328796,
-0.41466662287712097,
-0.7186038494110107,
0.28104788064956665,
0.5339597463607788,
-0.21154510974884033,
0.29847079515457... | |
what i found:
* it selects all records from both tables
* for each record in one table calls an UPDATE
So this will be slow. | [
-0.020414961501955986,
0.12414872646331787,
0.3360505700111389,
0.09512489289045334,
-0.017995847389101982,
0.08377477526664734,
0.2553241550922394,
0.2177714854478836,
-0.32402893900871277,
-0.7532976269721985,
0.24599826335906982,
0.11698191612958908,
-0.046957798302173615,
0.09786874055... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.