text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
of files required by the application to be the build output - this means I also get the full set of files in one place from running [MSBuild](http://en.wikipedia.org/wiki/MSBuild).
One solution appears to be Web Deployment Projects (WDPs), an add-on for Visual Studio (and msbuild) available that builds a web project to a directory and can optionally merge assemblies and alter the web.config file. The output of building a WDP is all the files necessary to deploy the site in one directory.
More information about Web Deployment Projects:
1. [Announcement on webdevtools MSDN blog](http://blogs.msdn.com/webdevtools/archive/2008/01/25/announcing-rtw-of-visual-studio-2008-web-deployment-projects-wdp.aspx) for WDP 2008
2. [ScottGu introduction to WDP 2005](http://weblogs.asp.net/scottgu/archive/2005/11/06/429723.aspx)
The only disadvantage | [
0.18001657724380493,
-0.11239753663539886,
0.34104809165000916,
-0.09999143332242966,
-0.19234450161457062,
-0.10072297602891922,
0.23277093470096588,
-0.3564797043800354,
-0.40114617347717285,
-0.5903905034065247,
-0.11081243306398392,
0.4323486387729645,
-0.09906946122646332,
-0.22891543... | |
to this solution is the requirement on an add-on which must be available on the build machine. Still, it's good enough for now! | [
0.3738172948360443,
0.3579438626766205,
0.2785363495349884,
0.17375832796096802,
0.40656405687332153,
-0.01908259280025959,
0.06976591795682907,
0.04238006845116615,
0.029524901881814003,
-0.304592490196228,
0.15417733788490295,
0.7317800521850586,
0.11541201919317245,
-0.09708375483751297... | |
I use Emacs primarily for coding Python but sometimes I use IDLE. Is there a way to change the key bindings easily in IDLE to match Emacs?
IDLE provides Emacs keybindings without having to install other software.
1. Open up the menu item Options -> Configure IDLE...
2. Go to Keys tab
3. In the drop down menu on the right
side of the dialog change the select
to "IDLE Classic Unix"
It's not the true emacs key bindings but you get the basics like movement, saving/opening, ... | [
0.27113547921180725,
0.11186841875314713,
0.15704944729804993,
-0.20272132754325867,
0.05164477974176407,
-0.029956519603729248,
0.06260878592729568,
0.1284680962562561,
-0.190598264336586,
-0.5536301136016846,
-0.0693448930978775,
1.0289812088012695,
-0.21585175395011902,
-0.1991672217845... | |
I know this rather goes against the idea of enums, but is it possible to extend enums in C#/Java? I mean "extend" in both the sense of adding new values to an enum, but also in the OO sense of inheriting from an existing enum.
I assume it's not possible in Java, as it only got them fairly recently (Java 5?). C# seems more forgiving of people that want to do crazy things, though, so I thought it might be possible some way. Presumably it could be hacked up via reflection (not that you'd every actually use that method)?
I'm not | [
0.40587159991264343,
0.010250013321638107,
0.1459781974554062,
-0.06985706090927124,
0.03552938252687454,
-0.3344223201274872,
0.1356833428144455,
-0.012233391404151917,
-0.5017304420471191,
-0.2051467001438141,
0.09741713851690292,
0.5661313533782959,
0.06135528162121773,
-0.1776111274957... | |
necessarily interested in implementing any given method, it just provoked my curiosity when it occurred to me :-)
The reason you can't extend Enums is because it would lead to problems with polymorphism.
Say you have an enum MyEnum with values A, B, and C , and extend it with value D as MyExtEnum.
Suppose a method expects a myEnum value somewhere, for instance as a parameter. It should be legal to supply a MyExtEnum value, because it's a subtype, but now what are you going to do when it turns out the value is D?
To eliminate this problem, extending enums is illegal | [
0.5816928148269653,
-0.14527399837970734,
0.09657108038663864,
0.2548884451389313,
0.20842254161834717,
-0.13402098417282104,
0.0841287225484848,
-0.2702999711036682,
0.08900725096464157,
-0.4979260563850403,
-0.055166590958833694,
0.4280104637145996,
-0.43861982226371765,
0.40787899494171... | |
I want to grab the value of a hidden input field in HTML.
```
<input type="hidden" name="fooId" value="12-3456789-1111111111" />
```
I want to write a regular expression in Python that will return the value of `fooId`, given that I know the line in the HTML follows the format
```
<input type="hidden" name="fooId" value="**[id is here]**" />
```
Can someone provide an example in Python to parse the HTML for the value?
For this particular case, BeautifulSoup is harder to write than a regex, but it is much more robust... I'm just contributing with the BeautifulSoup example, given that you already know which regexp to use :-)
```
from BeautifulSoup import BeautifulSoup
#Or | [
-0.10997911542654037,
-0.017439793795347214,
0.474744975566864,
-0.22900347411632538,
-0.2495679259300232,
0.042855095118284225,
0.3151933550834656,
-0.025983251631259918,
-0.024818528443574905,
-0.5174346566200256,
-0.12615899741649628,
0.6478960514068604,
-0.3328861892223358,
-0.34238821... | |
retrieve it from the web, etc.
html_data = open('/yourwebsite/page.html','r').read()
#Create the soup object from the HTML data
soup = BeautifulSoup(html_data)
fooId = soup.find('input',name='fooId',type='hidden') #Find the proper tag
value = fooId.attrs[2][1] #The value of the third attribute of the desired tag
#or index it directly via fooId['value']
``` | [
-0.20346786081790924,
-0.14013366401195526,
0.6508451104164124,
-0.2000751793384552,
-0.09146551042795181,
0.26733720302581787,
0.36803728342056274,
-0.14687548577785492,
0.0058590201660990715,
-0.5846217274665833,
-0.4306720197200775,
0.18576310575008392,
-0.47112521529197693,
-0.26653957... | |
Running into a problem where on certain servers we get an error that the directory name is invalid when using Path.GetTempFileName. Further investigation shows that it is trying to write a file to c:\Documents and Setting\computername\aspnet\local settings\temp (found by using Path.GetTempPath). This folder exists so I'm assuming this must be a permissions issue with respect to the asp.net account.
I've been told by some that Path.GetTempFileName should be pointing to C:\Windows\Microsoft.NET\Framework\v2.0.50727\temporaryasp.net files.
I've also been told that this problem may be due to the order in which IIS and .NET where installed on the server. I've done the typical 'aspnet\_regiis -i' | [
0.16763128340244293,
-0.07796954363584518,
0.18159689009189606,
0.01629301719367504,
0.09958866983652115,
-0.2981722354888916,
0.5182955265045166,
0.1867058128118515,
-0.38268646597862244,
-0.6379368901252747,
-0.06272954493761063,
0.4981876015663147,
-0.43129199743270874,
0.40793973207473... | |
and checked security on the folders etc. At this point I'm stuck.
Can anyone shed some light on this?
\*\*Update:\*\*Turns out that providing 'IUSR\_ComputerName' access to the folder does the trick. Is that the correct procedure? I don't seem to recall doing that in the past, and obviously, want to follow best practices to maintain security. This is, after all, part of a file upload process.
This is probably a combination of impersonation and a mismatch of different authentication methods occurring.
There are many pieces; I'll try to go over them one by one.
**Impersonation** is a technique to "temporarily" switch the user account under | [
0.45083945989608765,
0.33837318420410156,
0.2760424017906189,
0.1093338280916214,
0.23530232906341553,
-0.17322441935539246,
0.4969404339790344,
0.3673546612262726,
-0.3379703164100647,
-0.5732146501541138,
-0.23233385384082794,
0.23315046727657318,
-0.059100192040205,
0.3534823954105377,
... | |
which a thread is running. Essentially, the thread briefly gains the same rights and access -- no more, no less -- as the account that is being impersonated. As soon as the thread is done creating the web page, it "reverts" back to the original account and gets ready for the next call. This technique is used to access resources that only the user logged into your web site has access to. Hold onto the concept for a minute.
Now, by default ASP.NET runs a web site under a local account called **ASPNET**. Again, by default, only the ASPNET account and | [
0.33576780557632446,
-0.24952630698680878,
0.6312622427940369,
0.07511519640684128,
0.2500707805156708,
-0.25161173939704895,
0.20162639021873474,
0.10702186822891235,
-0.6149867177009583,
-0.32161611318588257,
-0.27467817068099976,
0.3135489523410797,
-0.15158213675022125,
0.2918538451194... | |
members of the Administrators group can write to that folder. Your temporary folder is under that account's purview. This is the second piece of the puzzle.
Impersonation doesn't happen on its own. It needs to be turn on intentionally in your web.config.
```
<identity impersonate="true" />
```
If the setting is missing or set to false, your code will execute pure and simply under the ASPNET account mentioned above. Given your error message, I'm positive that you have impersonation=true. There is nothing wrong with that! Impersonation has advantages and disadvantages that go beyond this discussion.
There is one question left: when you use impersonation, *which account | [
0.6865696310997009,
0.17849195003509521,
0.08380894362926483,
0.0010831252438947558,
0.09969033300876617,
-0.06474609673023224,
0.5713115930557251,
0.31387385725975037,
-0.18019936978816986,
-0.6040748953819275,
0.05375642701983452,
0.45149171352386475,
-0.3708869218826294,
0.1074797883629... | |
gets impersonated*?
Unless you specify the account in the web.config ([full syntax of the identity element here](http://msdn.microsoft.com/en-us/library/72wdk8cc.aspx)), the account impersonated is the one that the IIS handed over to ASP.NET. And that depends on how the user has authenticated (or not) into the site. That is your third and final piece.
The IUSR\_ComputerName account is a low-rights account created by IIS. By default, this account is the account under which a web call runs **if the user could not be authenticated**. That is, the user comes in as an "anonymous".
In summary, this is what is happening to you:
Your user is trying to | [
0.24878038465976715,
0.048557352274656296,
0.4714876115322113,
0.15619602799415588,
0.14366912841796875,
-0.12182281166315079,
0.43075767159461975,
0.10851993411779404,
-0.26913347840309143,
-0.34833934903144836,
-0.22174593806266785,
0.24251067638397217,
-0.36621367931365967,
0.4891664683... | |
access the web site, and IIS could not authenticate the person for some reason. Because Anonymous access is ON, (or you would not see IUSRComputerName accessing the temp folder), IIS allows the user in anyway, but as a generic user. Your ASP.NET code runs and impersonates this generic IUSR\_\_\_ComputerName "guest" account; only now the code doesn't have access to the things that the ASPNET account had access to, including its own temporary folder.
Granting IUSR\_ComputerName WRITE access to the folder makes your symptoms go away.
But that just the symptoms. You need to review **why is the person coming as "Anonymous/Guest"?**
There are | [
-0.04835081472992897,
-0.06021653115749359,
0.5672025680541992,
0.14005695283412933,
-0.03737605735659599,
-0.39859771728515625,
0.692768931388855,
-0.03912222385406494,
-0.3408312201499939,
-0.7398659586906433,
-0.10755559802055359,
0.19897840917110443,
-0.31130799651145935,
0.28277537226... | |
two likely scenarios:
a) You intended to use IIS for authentication, but the authentication settings in IIS for some of your servers are wrong.
In that case, you need to disable Anonymous access on those servers so that the usual authentication mechanisms take place. Note that you might still need to grant to your users access to that temporary folder, or use another folder instead, one to which your users already have access.
I have worked with this scenario many times, and quite frankly it gives you less headaches to forgo the Temp folder; create a dedicated folder in the server, set the | [
0.09845872223377228,
-0.14817039668560028,
0.10405265539884567,
0.2072189301252365,
0.18791039288043976,
-0.2580135464668274,
0.2642265260219574,
-0.13668817281723022,
-0.23480691015720367,
-0.6963293552398682,
-0.16207179427146912,
0.4731050133705139,
-0.4079769253730774,
-0.0226181894540... | |
proper permissions, and set its location in web.config.
b) You didn't want to authenticate people anyway, or you wanted to use ASP.NET Forms Authentication (which uses IIS's Anonymous access to bypass checks in IIS and lets ASP.NET handle the authentication directly)
This case is a bit more complicated.
You should go to IIS and disable all forms of authentication other than "Anonymous Access". Note that you can't do that in the developer's box, because the debugger needs Integrated Authentication to be enabled. So your debugging box will behave a bit different than the real server; just be aware of that.
Then, you need | [
0.13658225536346436,
-0.09422168135643005,
0.1981281191110611,
0.3047800660133362,
0.16404633224010468,
-0.7558007836341858,
0.47950032353401184,
-0.4047302305698395,
-0.042564358562231064,
-0.559196412563324,
-0.34069231152534485,
0.4557972550392151,
-0.26752445101737976,
-0.1422720551490... | |
to decide whether you should turn impersonation OFF, or conversely, to specify the account to impersonate in the web.config. Do the first if your web server doesn't need outside resources (like a database). Do the latter if your web site does need to run under an account that has access to a database (or some other outside resource).
You have two more alternatives to specify the account to impersonate. One, you could go to IIS and change the "anonymous" account to be one with access to the resource instead of the one IIS manages for you. The second alternative is to | [
0.43672797083854675,
-0.14902788400650024,
0.2849366068840027,
0.16645310819149017,
0.08179932087659836,
0.04963740333914757,
0.27671313285827637,
0.24734313786029816,
-0.19974176585674286,
-0.48338544368743896,
0.029769085347652435,
0.2475898414850235,
-0.46793320775032043,
0.151401296257... | |
stash the account and password encrypted in the registry. That step is a bit complicated and also goes beyond the scope of this discussion.
Good luck! | [
0.2504691779613495,
0.33887508511543274,
0.4146956503391266,
0.15744134783744812,
0.4859606921672821,
-0.5240849256515503,
0.6594760417938232,
0.11689834296703339,
0.15459240972995758,
-0.35055163502693176,
-0.030329370871186256,
0.44364655017852783,
0.19188570976257324,
-0.087173730134963... | |
ASP.NET MVC seems to be making a pretty big entrance. Can anyone summarize how its MVC implementation stacks up against popular MVC frameworks for other languages? (I'm thinking specifically of Rails and Zend Framework, though there are obviously lots.) Observations on learning curve, common terminology, ease of use and feelgood factor welcome.
(For the sake of a little background, I've been avoiding using ASP.NET for some time because I really hate the webforms approach, but Jeff's prolific praise on the podcast has almost convinced me to give it a go.)
I'm just getting into ASP.NET MVC, so these are some early thoughts | [
0.30808332562446594,
0.05741460621356964,
0.10768386721611023,
-0.03672352805733681,
-0.41924697160720825,
-0.20429648458957672,
0.1727559119462967,
0.06730912625789642,
-0.4007095694541931,
-0.7827517986297607,
0.04918166995048523,
0.5345240831375122,
0.024029286578297615,
-0.084086701273... | |
comparing it to Rails:
**Mostly manages to stick with static typing, at the expense of a little extra code.**
This will either give you the warm fuzzies or make you feel slightly shackled depending on how you feel about dynamic typing. For instance, you can have your views expect particular typed data (and so get compile-time checking of your views).
**Better separation of bits of the framework.**
So there's no prescribed data access mechanism such as ActiveRecord in Rails; you're free to choose your own. LINQ feels similar if you want something cheap, if a bit more verbose. You can | [
0.19835026562213898,
-0.15570789575576782,
0.43760567903518677,
0.18497321009635925,
-0.41787225008010864,
0.09318971633911133,
-0.1888866424560547,
0.018787002190947533,
-0.07504832744598389,
-0.5923849940299988,
0.24074462056159973,
0.5141288042068481,
-0.029183493927121162,
-0.336994498... | |
use the non-WebForms parts of ASP.NET like caching and authentication.
**Still playing feature catch-up.**
Preview 5 brought AcceptVerbs, model updaters (similar to Ruby's hash.merge) and more ways to bind forms to models. Feels like there's still more to come before they check off most of the feature set that Rails has.
I'm still missing a little of Rails' freedom and elegance (much of which is down to Ruby, I guess), but ASP.NET MVC really does feel quite close. | [
0.17613451182842255,
-0.30481064319610596,
0.42471545934677124,
0.08494949340820312,
-0.6656737923622131,
-0.2422642558813095,
0.3076741397380829,
0.2948744595050812,
-0.28658127784729004,
-0.6896799802780151,
0.28903812170028687,
0.5081314444541931,
0.02936391718685627,
-0.101330555975437... | |
I've been thinking about the number of projects we have in-house that are still being developed using visual studio 6 and how best to migrate them forward onto visual studio 2008. The projects range in flavours of C/C++ and VB.
Is it better to let VS2008 convert the work-spaces into solutions, fix any compile errors and be on your merry way? Or, is it better to start with a clean solution and migrate code across project by project discarding dead code along the way?
The Microsoft p&p team has recommended some [strategies](http://msdn.microsoft.com/en-us/library/ms978506.aspx) that answers this. Basically they recommend something like the project | [
0.46100857853889465,
0.007452916353940964,
0.27654829621315,
0.052238695323467255,
-0.1629399210214615,
-0.00716589717194438,
0.1944492906332016,
0.05056295543909073,
-0.4403740465641022,
-0.5638783574104309,
0.023874403908848763,
0.4120921790599823,
0.20953591167926788,
0.0490350574254989... | |
by project approach you mention. Of course, they're assuming a neatly architected application that has no nasty, dark corners from which late nights of coding and copious amounts of coffee spring from.
It doesn't hurt to let VS2008 convert the project for you and see how much effort is required to fix the errors. | [
0.6206971406936646,
0.1277395337820053,
-0.020221484825015068,
0.5243889689445496,
0.03214311599731445,
-0.06499523669481277,
0.29532390832901,
0.0709233209490776,
-0.13139954209327698,
-0.6932801604270935,
-0.04015064612030983,
0.6140046715736389,
0.14621691405773163,
-0.10598371177911758... | |
I sometimes use the feature 'Reconcile Offline Work...' found in Perforce's P4V IDE to sync up any files that I have been working on while disconnected from the P4 depot. It launches another window that performs a 'Folder Diff'.
I have files I never want to check in to source control (like ones found in bin folder such as DLLs, code generated output, etc.) Is there a way to filter those files/folders out from appearing as "new" that might be added. They tend to clutter up the list of files that I am actually interested in. Does P4 have the equivalent | [
0.5531561970710754,
0.16756899654865265,
0.2513733208179474,
-0.02672320418059826,
-0.019134623929858208,
-0.3017464876174927,
0.35494521260261536,
-0.11315907537937164,
-0.019413376227021217,
-0.7350015640258789,
-0.23689605295658112,
0.6028086543083191,
0.025970153510570526,
-0.035496629... | |
of Subversion's 'ignore file' feature?
As of version 2012.1, Perforce supports the `P4IGNORE` environment variable. I updated my answer to [this question about ignoring directories](https://stackoverflow.com/a/3103898/4228) with an explanation of how it works. Then I noticed this answer, which is now superfluous I guess.
---
Assuming you have a client named "CLIENT", a directory named "foo" (located at your project root), and you wish to ignore all .dll files in that directory tree, you can add the following lines to your workspace view to accomplish this:
```
-//depot/foo/*.dll //CLIENT/foo/*.dll
-//depot/foo/.../*.dll //CLIENT/foo/.../*.dll
```
The first line removes them from the directory "foo" and the second line removes them from all | [
0.09114371985197067,
-0.2078343778848648,
0.6365489363670349,
-0.2106238603591919,
-0.3737373650074005,
0.11390998959541321,
0.5735242366790771,
0.01422236580401659,
-0.21445290744304657,
-0.32813307642936707,
-0.09198790043592453,
0.4007430374622345,
-0.7630895972251892,
0.066177181899547... | |
sub directories. Now, when you 'Reconcile Offline Work...', all the .dll files will be moved into "Excluded Files" folders at the bottom of the folder diff display. They will be out of your way, but can still view and manipulate them if you really need to.
You can also do it another way, which will reduce your "Excluded Files" folder to just one, but you won't be able to manipulate any of the files it contains because the path will be corrupt (but if you just want them out of your way, it doesn't matter).
```
-//depot/foo.../*.dll //CLIENT/foo.../*.dll
``` | [
0.15311507880687714,
-0.31831982731819153,
0.36921846866607666,
0.31509846448898315,
0.14549188315868378,
-0.1457711011171341,
0.22356373071670532,
0.020902683958411217,
-0.45079612731933594,
-0.5511130094528198,
-0.4853391945362091,
0.25553297996520996,
-0.6629364490509033,
0.381480991840... | |
I'm building a PHP page with data sent from MySQL.
Is it better to have
* 1 `SELECT` query with 4 table joins, or
* 4 small `SELECT` queries with no table join; I do select from an ID
Which is faster and what is the pro/con of each method? I only need one row from each tables.
You should run a profiling tool if you're truly worried cause it depends on many things and it can vary but as a rule its better to have fewer queries being compiled and fewer round trips to the database.
Make sure you filter things as well as you | [
0.3862374424934387,
0.09802941232919693,
0.21974018216133118,
0.23307397961616516,
-0.3439103066921234,
0.05844522640109062,
0.15567812323570251,
-0.14794282615184784,
-0.26251375675201416,
-0.7533576488494873,
0.4351656138896942,
0.2939929664134979,
-0.2285233736038208,
0.1277611553668975... | |
can using your where and join on clauses.
But honestly, it usually doesn't matter since you're probably not going to be hit all that hard compared to what the database can do, so unless optimization is your spec you should not do it prematurely and do whats simplest. | [
0.32741764187812805,
0.0022128690034151077,
0.2759757936000824,
0.5343683362007141,
0.36579790711402893,
-0.14093907177448273,
0.19999000430107117,
-0.11304429173469543,
0.05595658719539642,
-0.5653873682022095,
0.11909367144107819,
0.7507181763648987,
-0.11987856030464172,
-0.223689302802... | |
As part of my integration strategy, I have a few SQL scripts that run in order to update the database. The first thing all of these scripts do is check to see if they need to run, e.g.:
```
if @version <> @expects
begin
declare @error varchar(100);
set @error = 'Invalid version. Your version is ' + convert(varchar, @version) + '. This script expects version ' + convert(varchar, @expects) + '.';
raiserror(@error, 10, 1);
end
else | [
0.15699192881584167,
0.24359656870365143,
0.5799441337585449,
-0.2699320316314697,
0.13079635798931122,
0.030915020033717155,
0.5318584442138672,
-0.36311212182044983,
0.10171234607696533,
-0.586527943611145,
0.23453140258789062,
0.7262505888938904,
-0.33903658390045166,
0.0985161364078521... | |
begin
...sql statements here...
end
```
Works great! Except if I need to add a stored procedure. The "create proc" command must be the only command in a batch of sql commands. Putting a "create proc" in my IF statement causes this error:
```
'CREATE/ALTER PROCEDURE' must be the first statement in a query batch.
```
Ouch! How do I put the CREATE PROC command in my script, and have it only execute if it needs to?
Here's what I came up with:
Wrap it in an EXEC(), like so:
```
if @version <> @expects | [
0.48980072140693665,
0.12419585138559341,
0.19817575812339783,
-0.2713482975959778,
0.05030715838074684,
-0.10675647109746933,
0.14481836557388306,
-0.1544213443994522,
0.17516499757766724,
-0.6137311458587646,
-0.10445644706487656,
0.6572790741920471,
-0.4105859398841858,
-0.1279649138450... | |
begin
...snip...
end
else
begin
exec('CREATE PROC MyProc AS SELECT ''Victory!''');
end
```
Works like a charm! | [
0.13834494352340698,
0.21042931079864502,
0.38273775577545166,
0.003783024614676833,
0.18346410989761353,
-0.29152730107307434,
0.13444377481937408,
0.0924697294831276,
0.21684299409389496,
-0.5396934151649475,
-0.6475445032119751,
0.3300659954547882,
-0.05608544126152992,
0.08868292719125... | |
### Background:
Some time ago, I built a system for recording and categorizing application crashes for one of our internal programs. At the time, I used a combination of frequency and aggregated lost time (the time between the program launch and the crash) for prioritizing types of crashes. It worked reasonably well.
Now, The Powers That Be want solid numbers on the *cost* of each type of crash being worked on. Or at least, numbers that *look* solid. I suppose I could use the aggregate lost time, multiplied by some plausible figure, but it seems dodgy.
### Question:
Are there any established methods of | [
0.37334147095680237,
0.31045669317245483,
0.07964577525854111,
0.5521435737609863,
-0.19143721461296082,
0.0027664785739034414,
0.05086379125714302,
0.0738397017121315,
-0.3351749777793884,
-0.17034082114696503,
0.040213849395513535,
0.7891164422035217,
-0.17818011343479156,
-0.05407691746... | |
calculating the real-world cost of application crashes? Or failing that, published studies speculating on such costs?
---
### Consensus
Accuracy is impossible, but an estimate based on uptime should suffice if it is applied consistently and its limitations clearly documented. Thanks, Matt, Orion, for taking time to answer this.
I've not seen any studies, but a reasonable heuristic would be something like :
( Time since last application save when crash occurred + Time to restart application ) \* Average hourly rate of application operator.
The estimation gets more complex if the crashes have some impact on external customers such, or might delay other things (i.e. | [
0.21516376733779907,
0.14790195226669312,
0.3097577393054962,
0.4889313578605652,
0.09640082716941833,
-0.010646450333297253,
0.3160308301448822,
-0.0700659304857254,
-0.07589922100305557,
-0.4583391845226288,
0.20282256603240967,
0.6333463191986084,
-0.02418593503534794,
-0.17761184275150... | |
create a bottle neck such that another person winds up sitting around waiting because some else's application crashed).
That said, your 'powers that be' may well be happy with a very rough estimate so long as it's applied consistently and they can see how it is changing over time. | [
0.9962928891181946,
-0.20073886215686798,
0.05548835173249245,
0.3986514210700989,
0.12486705183982849,
-0.28088563680648804,
0.4695171117782593,
-0.12977688014507294,
0.1685858964920044,
-0.28872188925743103,
-0.015390260145068169,
0.3656899034976959,
0.06860695779323578,
0.03804165497422... | |
This question is related to [this one](https://stackoverflow.com/questions/43324/can-i-put-an-aspnet-session-id-in-a-hidden-form-field), though I think I was a little too long-winded there to really get a good answer. I'll keep this brief.
I'm working on a web handler (ashx) that accepts a form post from an aspx page. When the handler receives this form post, in order to do what it needs to do, it needs to know the user who is logged in (User.Identity.Name), but I can't rely on cookies being sent by the browser.
I know I can get the Session.SessionID and place it in a hidden form field, but once my handler receives the | [
0.2997879981994629,
0.03130606934428215,
0.2281922847032547,
0.03446453437209129,
-0.07659933716058731,
-0.37924039363861084,
0.26384982466697693,
-0.07978523522615433,
-0.17263095080852509,
-0.654376745223999,
0.0896662175655365,
0.12857837975025177,
-0.04371952265501022,
0.00058818352408... | |
form post, how can I use that SessionID to figure out the logged-in user's identity?
I'm using the StateServer mode for session state.
Jonas posted a great answer to this question here:
[Can I put an ASP.Net session ID in a hidden form field?](https://stackoverflow.com/questions/43324/can-i-put-an-aspnet-session-id-in-a-hidden-form-field#237682) | [
0.3004729747772217,
-0.18630351126194,
0.22822852432727814,
0.3099974989891052,
-0.1305936574935913,
-0.300841748714447,
0.5518908500671387,
-0.10710129141807556,
-0.20317523181438446,
-0.40528619289398193,
0.08538251370191574,
0.10801711678504944,
-0.06410475075244904,
0.05444392934441566... | |
I want to test the web pages I create in all the modern versions of Internet Explorer (6, 7 and 8 beta) but I work mainly on a Mac and often don't have direct access to a PC.
**Update:** Microsoft now provide virtual machine images for various versions of IE that are ready to use on all of the major OS X virtualisation platforms ([VirtualBox](https://www.virtualbox.org), [VMWare Fusion](http://www.vmware.com/products/fusion/overview.html), and [Parallels](http://www.parallels.com/)).
Download the appropriate image from: <https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/>
---
On an Intel based Mac you can run Windows within a virtual machine. You will need one virtual machine for each version of IE you want to test | [
0.7731077671051025,
0.16823016107082367,
0.4223017692565918,
0.044674646109342575,
-0.0847700983285904,
-0.1169423758983612,
0.3733777105808258,
0.12142524868249893,
0.13139128684997559,
-1.0427799224853516,
0.04259113222360611,
0.47005096077919006,
0.1081666424870491,
0.03657973185181618,... | |
against.
The instructions below include free and legal virtualisation software and Windows disk images.
1. Download some virtual machine software. The developer disk images we're going to use are will work with either [VMWare Fusion](http://www.vmware.com/products/fusion/) or [Sun Virtual Box](http://www.virtualbox.org/). VMWare has more features but costs $80, Virtual Box on the other hand is more basic but is free for most users (see [Virtual Box licensing FAQ](http://www.virtualbox.org/wiki/Licensing_FAQ) for details).
2. Download the IE developer disk images, which are free from Microsoft: [http://www.microsoft.com/downloads/...](http://www.microsoft.com/downloads/details.aspx?FamilyId=21EABB90-958F-4B64-B5F1-73D0A413C8EF&displaylang=en)
3. Extract the disk images using [cabextract](http://www.cabextract.org.uk/) which is available from [MacPorts](http://www.macports.org) or as source code (Thanks to [Clinton](https://stackoverflow.com/users/6262/clinton)).
4. Download Q.app from <http://www.kju-app.org/> | [
0.5634141564369202,
0.2358032613992691,
0.31986621022224426,
0.1801765412092209,
0.13898201286792755,
0.0757363885641098,
0.28191208839416504,
-0.4370858371257782,
0.05040590092539787,
-0.5629598498344421,
-0.3527284860610962,
0.6958931684494019,
-0.2861765921115875,
-0.10810084640979767,
... | |
and put it in your /Applications folder (you will need it to convert the disk images into a format VMWare/Virtual Box can use)
At this point, the process depends on which VM software you're using.
**Virtual Box users**
1. Open a Terminal.app on your Mac (you can find it in /Applications/Utilities) and run the following sequence of commands, replacing *input.vhd* with the name of the VHD file you're starting from and *output.vdi* with the name you want your final disk image to have:
```
/Applications/Q.app/Contents/MacOS/qemu-img convert -O raw -f vpc "input.vhd" temp.bin
VBoxManage convertdd temp.bin "output.vdi"
rm temp.bin
mv "output.vdi" ~/Library/VirtualBox/VDI/
VBoxManage modifyvdi "output.vdi" compact
```
2. Start Virtual Box and | [
0.19100116193294525,
-0.03996965289115906,
0.9981604218482971,
-0.12308608740568161,
-0.02855636738240719,
-0.032213952392339706,
0.06855201721191406,
-0.3932430148124695,
0.06583171337842941,
-1.0985394716262817,
-0.30861297249794006,
0.8423611521720886,
-0.18660053610801697,
0.1236797794... | |
create a new virtual machine
3. Select the new VDI file you've just created as the boot hard disk
**VMWare fusion users**
1. Open a Terminal.app on your Mac (you can find it in /Applications/Utilities) and run the following commands, replacing *input.vhd* and *output.vmdk* with the name of the VHD file you're working on and the name you want your resulting disk image to have:
```
/Applications/Q.app/Contents/MacOS/qemu-img convert -O vmdk -f vpc "input.vhd" "output.vmdk"
mv "output.vmdk" ~/Documents/Virtual\ Machines.localized/
```
This will probably take a while (It takes around 30 minutes per disk image on my 2.4GHz Core 2 Duo MacBook w/ 2Gb RAM).
2. Start VMWare Fusion and create | [
0.42503783106803894,
0.0343448668718338,
0.7684070467948914,
0.04292665049433708,
0.004557254258543253,
-0.18432152271270752,
0.24806438386440277,
-0.46070122718811035,
-0.22011834383010864,
-0.949727475643158,
-0.31337013840675354,
0.6124900579452515,
-0.17272327840328217,
0.1488210856914... | |
a new virtual machine
3. In the advanced disk options select "use and existing disk" and find the VMDK file you just created | [
0.18701426684856415,
-0.23563146591186523,
0.6395484805107117,
0.17170464992523193,
0.014232703484594822,
-0.19393977522850037,
0.14737363159656525,
-0.2873353660106659,
-0.0925719290971756,
-0.8220949172973633,
0.015934143215417862,
0.6689497828483582,
-0.21517592668533325,
0.271541774272... | |
What is the best way to use multiple EVAL fields in a GridView ItemTemplate?
Looking to have some control over formatting for appearance as well as setting up hyperlinks/javascript etc.
Even clearer, IMO, is:
```
<%# String.Format("{0} - {1}", Eval("Name1"), Eval("Name2")) %>
``` | [
0.19182153046131134,
-0.14872083067893982,
0.5061324238777161,
0.14775307476520538,
-0.24383604526519775,
0.07680444419384003,
0.011312210932374,
-0.37769511342048645,
-0.3193603754043579,
-0.8066732287406921,
-0.034626927226781845,
0.39527395367622375,
-0.27539628744125366,
-0.11658767610... | |
What is the best practice of Unicode processing in C++?
* Use [ICU](http://www.icu-project.org/) for dealing with your data (or a similar library)
* In your own data store, make sure everything is stored in the same encoding
* Make sure you are always using your unicode library for mundane tasks like string length, capitalization status, etc. Never use standard library builtins like `is_alpha` unless that is the definition you want.
* I can't say it enough: ***never iterate over the indices of a `string` if you care about correctness, always use your unicode library for this.*** | [
0.15186168253421783,
0.11981084942817688,
-0.07561720907688141,
-0.05570115149021149,
-0.06608399748802185,
-0.08906213939189911,
0.3041995167732239,
0.08781866729259491,
-0.24630215764045715,
-0.7943753600120544,
-0.21225878596305847,
0.4745660424232483,
-0.25378450751304626,
-0.427940398... | |
I'm going to be implementing a `PHP/mySQL` setup to store credit card information.
It seems like `AES_ENCRYPT/AES_DECRYPT` is the way to go,
**but I'm still confused on one point:**
**How do I keep the encryption key secure?**
Hardwiring it into my PHP scripts (which will live on the same server as the db) seems like a major security hole.
**What's the "best practice" solution here?**
You should think long and hard about whether you REALLY need to keep the CC#. If you don't have a great reason, DON'T! Every other week you hear about some company being compromised and CC#'s being stolen. All these companies made | [
0.8750660419464111,
0.31246063113212585,
0.15484130382537842,
0.21929529309272766,
0.03950522467494011,
-0.4227725565433502,
0.3321296274662018,
0.09788032621145248,
-0.2869698405265808,
-0.5081101059913635,
0.2223230004310608,
0.4367257356643677,
0.09896576404571533,
0.09664846956729889,
... | |
a fatal flaw - they kept too much information. Keep the CC# until the transaction clears. After that, delete it.
As far as securing the server, the best course of action is to secure the hardware and use the internal system socket to MySQL, and make sure to block any network access to the MySQL server. Make sure you're using both your system permissions and the MySQL permissions to allow as little access as needed. For some scripts, you might consider write-only authentication. There's really no encryption method that will be foolproof (as you will always need to decrypt, and thus | [
0.34473514556884766,
0.2881963551044464,
0.32137537002563477,
0.4024137556552887,
0.2931373417377472,
-0.24445299804210663,
0.2147107869386673,
0.034130796790122986,
-0.24637040495872498,
-0.408138632774353,
-0.1847125142812729,
0.6040257215499878,
-0.13852658867835999,
0.19185471534729004... | |
must store the key). This is not to say you shouldn't - you can store your key in one location and if you detect system compromise you can destroy the file and render the data useless. | [
0.41206085681915283,
0.13107573986053467,
0.24617356061935425,
0.34650707244873047,
0.4141876697540283,
-0.1904122680425644,
0.4595191776752472,
-0.6090054512023926,
-0.10872728377580643,
-0.27745309472084045,
-0.33551889657974243,
0.3640405535697937,
-0.18708771467208862,
0.36877667903900... | |
I would like to create a folder that users who do not have privileges to view the rest of the site can see. This user group would be granted access to the site, but I only want them to be able to view one particular page.
Is this possible to do without going to every single page and removing the new user group's access?
yeah, you should be able to create a new group and add the users to that list/subweb/whatever and just that. This is assuming that you didn't grant access to all users somewhere. If you did, then hopefully the | [
0.837654709815979,
0.10098440200090408,
0.20259711146354675,
0.3144085705280304,
0.17882275581359863,
-0.354074627161026,
0.037912897765636444,
0.18725880980491638,
-0.3403683602809906,
-0.38403260707855225,
0.16510941088199615,
0.282066285610199,
-0.10227010399103165,
0.24890030920505524,... | |
default access is granted to a default user group (like sharepoint visitors) and you can alter that group to exclude the users you only want to access the limited part of the site.
If created correctly the new group shouldn't have access to the rest of the site. | [
-0.07282475382089615,
-0.19779959321022034,
0.2807587683200836,
0.12467097491025925,
0.19042399525642395,
-0.2561712861061096,
0.41979047656059265,
0.20505990087985992,
-0.31531059741973877,
-0.48470211029052734,
-0.4671154320240021,
0.33727577328681946,
-0.2614675760269165,
0.153072580695... | |
What's the simplest way to add a click event handler to a canvas element that will return the x and y coordinates of the click (relative to the canvas element)?
No legacy browser compatibility required, Safari, Opera and Firefox will do.
If you like simplicity but still want cross-browser functionality I found this solution worked best for me. This is a simplification of @Aldekein´s solution but **without jQuery**.
```
function getCursorPosition(canvas, event) {
const rect = canvas.getBoundingClientRect()
const x = event.clientX - rect.left
const y = event.clientY - rect.top
console.log("x: " + | [
-0.1426086127758026,
-0.3157377243041992,
0.4097895622253418,
0.040982700884342194,
-0.0018539052689448,
-0.06859560310840607,
0.15269702672958374,
-0.32404446601867676,
-0.1901039481163025,
-0.8537967801094055,
0.016903242096304893,
0.6653710007667542,
-0.49217602610588074,
-0.23448088765... | |
x + " y: " + y)
}
const canvas = document.querySelector('canvas')
canvas.addEventListener('mousedown', function(e) {
getCursorPosition(canvas, e)
})
``` | [
-0.08975180238485336,
-0.15809981524944305,
0.7445755004882812,
-0.23903852701187134,
0.08641044050455093,
0.11119658499956131,
0.17143625020980835,
-0.45227497816085815,
-0.17523522675037384,
-0.6985880732536316,
-0.3235040307044983,
0.6878677010536194,
-0.3881796896457672,
-0.22480739653... | |
How often should you use git-gc?
The [manual page](http://www.kernel.org/pub/software/scm/git/docs/git-gc.html) simply says:
> Users are encouraged to run this task on a regular basis within each repository to maintain good disk space utilization and good operating performance.
Are there some commands to get some object counts to find out whether it's time to gc?
It depends mostly on how much the repository is used. With one user checking in once a day and a branch/merge/etc operation once a week you probably don't need to run it more than once a year.
With several dozen developers working on several dozen projects each checking in 2-3 times | [
0.48656797409057617,
0.17309047281742096,
0.32369905710220337,
-0.12426669895648956,
-0.12607577443122864,
-0.3610858619213104,
0.15137788653373718,
-0.024612028151750565,
-0.37361299991607666,
-0.5500864386558533,
-0.11182475835084915,
0.6845802664756775,
-0.2217862755060196,
-0.076575763... | |
a day, you might want to run it nightly.
It won't hurt to run it more frequently than needed, though.
What I'd do is run it now, then a week from now take a measurement of disk utilization, run it again, and measure disk utilization again. If it drops 5% in size, then run it once a week. If it drops more, then run it more frequently. If it drops less, then run it less frequently. | [
0.7233710289001465,
-0.11238221824169159,
0.40354710817337036,
0.08355746418237686,
-0.06526149064302444,
-0.03230905160307884,
0.1320871263742447,
0.23981542885303497,
-0.42052942514419556,
-0.5476285815238953,
0.2080700397491455,
0.7237198352813721,
0.0669076144695282,
0.0921554043889045... | |
I'm working on a web-based contest which is supposed to allow anonymous users to vote, but we want to prevent them from voting more than once. IP based limits can be bypassed with anonymous proxies, users can clear cookies, etc. It's possible to use a Silverlight application, which would have access to isolated storage, but users can still clear that.
I don't think it's possible to do this without some joker voting himself up with a bot or something. Got an idea?
The short answer is: no. The longer answer is: but you can make it arbitrarily difficult. What I would do:
* | [
0.9385796785354614,
0.03131268918514252,
0.15529245138168335,
0.36577895283699036,
-0.07470104843378067,
-0.14066901803016663,
-0.026585334911942482,
-0.12974202632904053,
-0.36817601323127747,
-0.19835922122001648,
0.4623637795448303,
0.2950473129749298,
-0.1309100091457367,
-0.3033705055... | |
Voting requires solving a captcha (to avoid as much as possible automated voting). To be even more effective I would recommend to have prepared multiple types of simple captchas (like "pick the photo with the cat", "what is 2+2", "type in the word", etc) and rotate them both by the time of the day and by IP, which should make automatic systems ineffective (ie if somebody using IP A creates a bot to solve the captcha, this will become useless the next day or if s/he distributes it onto other computers/uses proxies)
* When filtering by IP you should be careful | [
0.13882653415203094,
-0.09736493974924088,
0.2905285954475403,
0.4100860059261322,
-0.340242862701416,
-0.13442978262901306,
0.20158624649047852,
-0.1549023985862732,
-0.19893711805343628,
-0.5682810544967651,
-0.12534402310848236,
0.010515713132917881,
-0.4282876253128052,
-0.307710975408... | |
to consider situations where multiple hosts are behind one public IP (AFAIK AOL proxies all of their customers through a few IPs - so such a limitation would effectively ban AOL users). Also, many proxies send along headers pointing to the original IP (like X-Forwarded-For), so you can take a look at that too.
* Finally, using something like FSO (Flash Shared Objects - "Flash cookies") is obscure enough for 99.99% of the people not to know about. Silverlight is even more obscure. To be even sneakier, you could buy an other domain and set the FSO from that domain (so, | [
0.543880820274353,
-0.11326813697814941,
-0.019804421812295914,
0.3011091947555542,
-0.06334945559501648,
-0.5241265296936035,
0.514772355556488,
0.24862472712993622,
-0.3967357575893402,
-0.4741891622543335,
0.009038440883159637,
0.18235240876674652,
-0.21605101227760315,
-0.0157512109726... | |
if the user is looking for FSO's set by your domain, they won't see any)
None of these methods is 100%, but hopefully combined they give you the level of assurance you need. If you want to take this a level higher, you need to add some kind of user registration (which can be as simple as asking a valid e-mail address when the vote occurs and sending a confirmation link to the given address and not counting the votes for which the link wasn't clicked - so it doesn't need to be a full-fledged "create an account with username / | [
0.38799819350242615,
0.038513727486133575,
0.4487959146499634,
0.32011374831199646,
-0.008668881841003895,
-0.3347684442996979,
0.4063261151313782,
-0.21636803448200226,
-0.16105063259601593,
-0.5708295106887817,
0.1189609095454216,
0.30312246084213257,
0.023056890815496445,
-0.22481624782... | |
password / firs name / last name / etc"). | [
-0.013954084366559982,
-0.06780931353569031,
0.7179052233695984,
0.28214722871780396,
0.5452971458435059,
-0.3879501223564148,
0.012611525133252144,
-0.06919844448566437,
-0.18645694851875305,
-0.11023734509944916,
-0.3527878522872925,
0.40826350450515747,
-0.17238689959049225,
0.227295890... | |
We're in the process of setting up a new framework and way of doing business for our new internal apps. Our current design dictates that all security logic should be handled by our database, and all information (and I mean all) will be going in and out of the database via stored procedures.
The theory is, the data access layer requests info from a stored procedure and passes over authentication to the database. The database determines the user's role/permissions and decides whether or not to perform the task (whether that be retrieving data or making an update).
I guess this means fewer | [
0.45826980471611023,
0.45670703053474426,
0.4270535111427307,
0.16540639102458954,
0.5457218885421753,
-0.06947245448827744,
0.13998210430145264,
-0.1672079712152481,
0.12822166085243225,
-0.24704812467098236,
-0.28097793459892273,
0.6353262662887573,
-0.26128941774368286,
-0.4243484735488... | |
database transactions. One call to the database. If the security was in our data access layer, this would require 1 database call to determine if the user had proper permissions, and then 1 separate database call to perform the action.
I, for one, find the SQL Management studio completely lacking as an IDE. My main concern is we will end up having to maintain some nasty amount of business logic in our stored procedures for some very minimal performance gains.
Right now, we're using LINQ for our ORM. It seems light and fast, but best of all, its really easy to rapidly | [
0.06375610828399658,
0.20982646942138672,
0.5969519019126892,
0.3697178363800049,
0.25568127632141113,
-0.4030986428260803,
-0.12500876188278198,
-0.06216810271143913,
-0.4249134063720703,
-0.20145784318447113,
-0.03911241516470909,
0.47978702187538147,
-0.1767265796661377,
-0.107816345989... | |
develop in.
Is the maintenance cost worth the performance gain? Are we fooling ourselves into thinking there will even be a noticeable performance gain? Or are we just making a nightmare for ourselves?
Our environment:
* Internal, non-mission critical business apps
* C#/ASP.NET 3.5
* Windows 2003
* MS SQL Server 2005
* 35 Medium sized web apps with approx 500 users
**Don't do that**. We recently had a **VERY BAD** experience when the "database guru" decided to go to another company. The maintenance of all the logic in the procedures are just horrible!!
Yes, you're going to have some performance improvement, but that's not worth it. In fact, | [
0.17649893462657928,
0.20483623445034027,
-0.10694438964128494,
0.2324528843164444,
0.1891225427389145,
0.05541734769940376,
0.5093408226966858,
0.14909051358699799,
0.12939570844173431,
-0.746502161026001,
-0.03727278858423233,
0.6598244905471802,
0.04082081839442253,
-0.12369013577699661... | |
performance is not even a big concern in internal application. Invest more money in good servers. It'll pay off. | [
0.1292465329170227,
0.31615039706230164,
0.31887879967689514,
0.38080310821533203,
0.15426836907863617,
-0.15144112706184387,
0.30549299716949463,
0.3427485227584839,
-0.34087803959846497,
-0.8298738598823547,
-0.06303506344556808,
0.5423466563224792,
0.2190285474061966,
-0.240908384323120... | |
I'm downloading some images from a service that doesn't always include a content-type and doesn't provide an extension for the file I'm downloading (ugh, don't ask).
What's the best way to determine the image format in .NET?
The application that is reading these downloaded images needs to have a proper file extension or all hell breaks loose.
A probably easier approach would be to use Image.FromFile() and then use the RawFormat property, as it already knows about the magic bits in the headers for the most common formats, like this:
```
Image i = Image.FromFile("c:\\foo");
if (System.Drawing.Imaging.ImageFormat.Jpeg.Equals(i.RawFormat))
MessageBox.Show("JPEG");
else if (System.Drawing.Imaging.ImageFormat.Gif.Equals(i.RawFormat)) | [
0.6363499760627747,
-0.11816460639238358,
0.6660634279251099,
0.1407037079334259,
-0.05850386992096901,
-0.36585333943367004,
0.03962999954819679,
-0.19135698676109314,
0.01524422224611044,
-0.7852506041526794,
-0.17185746133327484,
0.6382759213447571,
-0.22582069039344788,
0.1698794215917... | |
MessageBox.Show("GIF");
//Same for the rest of the formats
``` | [
0.5713990330696106,
0.0755147933959961,
0.2013852596282959,
-0.13194957375526428,
-0.19876296818256378,
-0.27051839232444763,
0.09823115170001984,
0.3111829161643982,
-0.22351683676242828,
-0.9075876474380493,
-0.4822494387626648,
0.4511747658252716,
-0.5228613018989563,
-0.051807433366775... | |
MSDN displays the following for CreatePatternBrush:
> You can delete a pattern brush without
> affecting the associated bitmap by
> using the DeleteObject function.
> Therefore, you can then use this
> bitmap to create any number of pattern
> brushes.
My question is the opposite. If the HBRUSH is long lived, can I delete the HBITMAP right after I create the brush? IE: does the HBRUSH store its own copy of the HBITMAP?
In this case, I'd like the HBRUSH to have object scope while the HBITMAP would have method scope (the method that creates the HBRUSH).
The HBRUSH and HBITMAP are | [
0.2612336575984955,
-0.4859916865825653,
0.42092522978782654,
-0.02295682579278946,
0.016144217923283577,
-0.30256444215774536,
0.13848373293876648,
-0.2254774421453476,
-0.13030563294887543,
-0.7090180516242981,
-0.10994290560483932,
0.49382758140563965,
-0.37439078092575073,
0.3305764198... | |
entirely independent. The handles can be deleted entirely independent from each other, and, once created, no changes to either object will effect the other. | [
-0.03151986747980118,
0.08189476281404495,
0.2588222026824951,
0.4394071102142334,
-0.049207501113414764,
0.10775356739759445,
0.21721848845481873,
0.07640127837657928,
-0.12264945358037949,
-0.2850644588470459,
-0.40136176347732544,
0.12898561358451843,
-0.4329577386379242,
0.222874671220... | |
I know how to test an object to see if it is of a type, using the IS keyword e.g.
```
if (foo is bar)
{
//do something here
}
```
but how do you test for it not being "bar"?, I can't seem to find a keyword that works with IS to test for a negative result.
BTW - I have a horrible feeling this is soooo obvious, so apologies in advance...
```
if (!(foo is bar)) {
}
``` | [
0.2903229892253876,
0.5628083348274231,
0.042776886373758316,
-0.2955131232738495,
-0.13666881620883942,
-0.4614608883857727,
0.507785975933075,
-0.03517095744609833,
0.13612404465675354,
-0.2699262499809265,
-0.1501181423664093,
0.3053188920021057,
-0.302799254655838,
0.23392248153686523,... | |
How can i stop the host machine entering `standby` mode while my application is running?
Is there any `win32 api` call to do this?
There are two APIs, depending on what version of Windows.
XP,2000, 2003:
<http://msdn.microsoft.com/en-us/library/aa373247(VS.85).aspx>
Respond to PBT\_APMQUERYSUSPEND.
Vista, 2008:
<http://msdn.microsoft.com/en-us/library/aa373208(VS.85).aspx>
There could be many valid reasons to prevent the computer from going to sleep. For example, watching a video, playing music, compiling a long running build, downloading large files, etc. | [
0.38083088397979736,
-0.15368437767028809,
0.3888707160949707,
0.05125439167022705,
0.22192953526973724,
-0.30561119318008423,
0.37611520290374756,
-0.18296338617801666,
-0.18001152575016022,
-0.42105552554130554,
-0.04528495669364929,
0.8561462759971619,
-0.06631681323051453,
0.1484065353... | |
I have a project which is source controlled using Subversion and VisualSVN. Since the version of web.config is different on the server and the developers' computers I want the file to remain on the computers but to be ignored by Subversion. I added it to the svn:ignore but it still remains (and still has a red exclamation mark too since we are not committing it).
How can I remove it from Subversion safely without it being deleted from the files system
Thanks,
Adin
you'll have to do both the remove and ignore operation
* first make a backup of your local file (like @ibz said)
* | [
0.6858609318733215,
0.09925859421491623,
0.2065708488225937,
0.1751163899898529,
-0.27901893854141235,
-0.23564386367797852,
0.6706430315971375,
0.2285962551832199,
-0.310575395822525,
-0.4993918240070343,
0.16377654671669006,
0.4516831934452057,
-0.23733334243297577,
0.20895352959632874,
... | |
then remove the web.config from the repository.
* then copy back the web.config to the same folder
* finally use svn:ignore so that subversion does not try to add it again to the repository
since i use tortoisesvn i can't really tell you what svn commands you have to use, but using tortoisesvn it would be:
* make backup
* right click on web.config on the folder under source control, select TortoiseSVN | Delete
* right click on web.config on the folder under source control, select SVN Commit => after this you will notice that the file is actually deleted from the file system
* move up | [
0.1404159665107727,
-0.07183189690113068,
0.650056004524231,
-0.03467584028840065,
-0.07846757024526596,
-0.0745934396982193,
0.42588141560554504,
-0.0962265208363533,
-0.5517192482948303,
-0.3647475838661194,
-0.218887597322464,
0.8852329850196838,
-0.2000221163034439,
0.3361031413078308,... | |
and right click on the folder under source control, select TortoiseSVN | Properties
* on the properties window click new + property name "svn:ignore"; property value "web.config". accept changes
* commit changes
on my .net projects i include the following exclusion with svn:ignore: bin, obj, \*.suo, \*.user | [
-0.031102212145924568,
0.03885888680815697,
0.33166125416755676,
-0.21165777742862701,
0.15280558168888092,
-0.03193175792694092,
0.41060706973075867,
-0.08194814622402191,
-0.46050864458084106,
-0.4507346749305725,
-0.24040532112121582,
0.5441189408302307,
-0.2361581176519394,
0.290590703... | |
I would like to start tagging my deployed binaries with the latest SVN revision number.
However, because SVN is file-based and not directory/project-based, I need to scan through all the directory's and subdirectory's files in order to determine the highest revision number.
Using `svn info` on the root doesn't work (it just reports the version of that directory, not files in subdirectories):
I was wondering if there is a shortcut using the `svn` command to do this. Otherwise, can anyone suggest a simple script that is network-efficient (I would prefer if it didn't hit the remote server at all)?
I also understand that one | [
0.15670186281204224,
0.09337005764245987,
0.3016310930252075,
0.06519375741481781,
-0.10369274765253067,
-0.3387243151664734,
0.2655969560146332,
0.07922641932964325,
-0.24735140800476074,
-0.8506695628166199,
-0.08981005847454071,
0.5053815841674805,
0.02162758633494377,
0.188165128231048... | |
alternative approach is to keep a *version file* with the `svn:keywords`. This works (I've used it on other projects), but I get tired of dealing with making sure the file is dirty and dealing with the inevitable merge conflicts.
**Answer** I see my problem lied with not doing a proper `svn up` before calling `svn info` in the root directory:
```
$ svn info
Path: .
...
Last Changed Author: fak
Last Changed Rev: 713
Last Changed Date: 2008-08-29 00:40:53 +0300 (Fri, 29 Aug 2008)
$ svn up
At revision 721.
$ svn info
Path: .
...
Revision: 721
Last Changed Author: reuben
Last Changed Rev: 721
Last Changed Date: 2008-08-31 22:55:22 +0300 (Sun, 31 Aug 2008)
```
One | [
-0.06719445437192917,
0.25532814860343933,
0.8978046774864197,
-0.23483793437480927,
-0.3742666244506836,
-0.047707755118608475,
0.498394638299942,
-0.43365946412086487,
-0.17047598958015442,
-0.5364468693733215,
-0.1527709662914276,
0.6151687502861023,
-0.313751757144928,
0.18922051787376... | |
way. When you check out the code, look at the last line of svn output:
```
$ svn up
...stuff...
Updated to revision 66593.
```
A more direct way:
```
$ svn info
Path: .
URL: https://svn.example.com/svn/myproject/trunk
Repository Root: https://svn.example.com/svn/
Repository UUID: d2a7a951-c712-0410-832a-9abccabd3052
Revision: 66593
Node Kind: directory
Schedule: normal
Last Changed Author: bnguyen
Last Changed Rev: 66591
Last Changed Date: 2008-09-11 18:25:27 +1000 (Thu, 11 Sep 2008)
``` | [
-0.16583412885665894,
0.10733599215745926,
1.0112686157226562,
-0.12300402671098709,
0.03319849818944931,
0.009642054326832294,
0.4033530354499817,
-0.0012507865903899074,
-0.5059772729873657,
-0.5206538438796997,
-0.4603450894355774,
0.3875592052936554,
-0.060616206377744675,
0.4170236289... | |
From what I've seen the tag is ignored when hosting a WCF service in IIS. I understand that when self-hosting this is required but is this harmful or even used when operating under IIS?
ex.
```
<system.serviceModel>
<service blah blah blah>
<host>
<baseAddresses>
<add baseAddress="http://localhost/blah" />
</baseAddresses>
</host>
</service>
</system.serviceModel>
```
From what I've seen you can take a config file describing a service from one machine and use that on a completely different machine and it works fine. It | [
0.5518301129341125,
-0.0012915809638798237,
0.4075017273426056,
-0.17083792388439178,
-0.07156896591186523,
-0.2965785264968872,
0.23171892762184143,
-0.2008352279663086,
-0.22205738723278046,
-0.9088010787963867,
-0.05902598798274994,
0.4631730616092682,
-0.27100834250450134,
0.3692377507... | |
looks as if IIS completely ignores this section.
Thanks,
kyle
As you have guessed, the baseAddresses element is completely ignored when hosting in IIS. The service's base address is determined by the web site & virtual directory into which your wcf service is placed.
Even when self-hosting, baseAddresses is not required. It is merely a convenience that avoids you having to enter a full address for each endpoint. If it is present, the endpoints can have relative addresses (relative to the base address, that is). | [
0.24646583199501038,
0.16821876168251038,
0.5290654301643372,
-0.06860237568616867,
-0.07706307619810104,
-0.2873263657093048,
0.3130694329738617,
-0.06009016931056976,
-0.10437539964914322,
-0.6347663998603821,
-0.024738239124417305,
0.1552060842514038,
-0.20149900019168854,
0.47650393843... | |
I've got my brand new VS2008 and decided to convert my main solution from VS2005. One of the projects is a SQL2005 reporting services project. Now that I've converted I cannot load it in VS2008. Is there anyway around this?
My problem is that my solution is a hybrid and has websites libraries and reports in there.
Separating it out breaks the logic the solution entity.
As you have guessed, the baseAddresses element is completely ignored when hosting in IIS. The service's base address is determined by the web site & virtual directory into which your wcf service is placed.
Even when self-hosting, | [
0.39451727271080017,
0.0746922492980957,
0.6816199421882629,
-0.05230114609003067,
-0.2502731382846832,
-0.16142235696315765,
0.3292923867702484,
-0.2613941431045532,
-0.18134412169456482,
-0.8236846923828125,
0.24947872757911682,
0.3395198583602905,
-0.27327293157577515,
0.615717887878418... | |
baseAddresses is not required. It is merely a convenience that avoids you having to enter a full address for each endpoint. If it is present, the endpoints can have relative addresses (relative to the base address, that is). | [
0.12793314456939697,
0.17216186225414276,
0.7079303860664368,
0.09929898381233215,
-0.02654302306473255,
0.14593744277954102,
0.02364545688033104,
0.058836739510297775,
0.16634972393512726,
-0.44476771354675293,
-0.48843324184417725,
0.24044740200042725,
0.1277828812599182,
0.1259449720382... | |
We used to use SourceSafe, and one thing I liked about it was that when you checked out a file, it automatically got you its latest version.
Now we work with Team System 2005, and it doesn't work that way - you have to "get latest version" before you start working on a file that you've checked out.
Is there a way to configure Team System (2005) to automatically get the latest version when checking out a file?
There's a Visual Studio Add-in for this that someone wrote:
<http://blogs.microsoft.co.il/blogs/srlteam/archive/2007/03/24/TFS-GetLatest-version-on-check_2D00_out-Add_2D00_In.aspx> | [
0.4519317150115967,
-0.023715311661362648,
0.20569893717765808,
0.19840633869171143,
0.1013280600309372,
-0.3309674859046936,
-0.06914066523313522,
-0.15501712262630463,
-0.04354669526219368,
-0.5148495435714722,
0.35221683979034424,
0.7214168906211853,
0.007484390866011381,
-0.36176440119... | |
Suppose that two tables exist: `users` and `groups`.
**How does one provide "simple search" in which a user enters text and results contain both users and groups whose names contain the text?**
The result of the search must distinguish between the two types.
The trick is to combine a `UNION` with a literal string to determine the type of 'object' returned. In most (?) cases, UNION ALL will be more efficient, and should be used unless duplicates are required in the sub-queries. The following pattern should suffice:
```
SELECT "group" type, name
FROM groups
WHERE name LIKE "%$text%"
UNION ALL
SELECT "user" | [
-0.1626717448234558,
0.10792365670204163,
0.13931572437286377,
-0.06390537321567535,
0.10188820213079453,
0.0602283850312233,
-0.02115645818412304,
-0.2557991147041321,
-0.05443006381392479,
-0.6456097960472107,
-0.30940404534339905,
0.35800859332084656,
-0.549216628074646,
-0.042176052927... | |
type, name
FROM users
WHERE name LIKE "%$text%"
```
**NOTE**: I've added the answer myself, because I came across this problem yesterday, couldn't find a good solution, and used this method. If someone has a better approach, please feel free to add it. | [
0.244101881980896,
0.33794012665748596,
0.18290972709655762,
-0.05692115053534508,
-0.10477662831544876,
-0.13864052295684814,
0.19820086658000946,
0.2915458083152771,
0.12447034567594528,
-0.5107057094573975,
-0.06448008120059967,
0.3338847756385803,
-0.35279080271720886,
-0.0584624856710... | |
Put differently:
Is there a good reason to choose a loosely-typed collection over a type-safe one (HashTable vs. Dictionary)? Are they still there only for compatibility?
As far as I understand, generic collections not only are type-safe, but their performance is better.
---
Here's a comprehensive article on the topic: [An Extensive Examination of Data Structures Using C# 2.0](http://msdn.microsoft.com/en-us/library/ms364091%28VS.80%29.aspx).
The non-generic collections are so obsolete that they've been removed from the CoreCLR used in Silverlight and Live Mesh. | [
0.294207364320755,
0.028028098866343498,
0.2222796529531479,
0.1388510763645172,
-0.08498154580593109,
-0.24231603741645813,
0.28769272565841675,
-0.05767277255654335,
-0.22184647619724274,
-0.6694307923316956,
-0.19381318986415863,
0.37650513648986816,
-0.3524842858314514,
0.2538484334945... | |
I'm trying to send messages to Objective-C objects in gdb.
```
(gdb) p $esi
$2 = (void *) 0x1268160
(gdb) po $esi
<NSArray: 0x1359c0>
(gdb) po [$esi count]
Target does not respond to this message selector.
```
I can't send any message to it. Am I missing something? Do I really need the symbols, or something else?
If you must override gdb and send a message to an object when it will not let you, you can use performSelector:
```
(gdb) print (int)[receivedData count]
Target does not respond to this message selector.
(gdb) print (int)[receivedData performSelector:@selector(count) ]
2008-09-15 00:46:35.854 Executable[1008:20b] *** -[NSConcreteMutableData count]:
unrecognized selector sent to instance 0x105f2e0
```
If you need to pass an argument use | [
-0.12722215056419373,
0.149936705827713,
0.11766990274190903,
-0.05518731847405434,
-0.39698389172554016,
0.09811105579137802,
0.6908764839172363,
-0.29089611768722534,
-0.18519923090934753,
-0.4580894410610199,
-0.14896516501903534,
0.5232491493225098,
-0.6580643057823181,
0.0463455095887... | |
withObject:
```
(gdb) print (int)[receivedData performSelector:@selector(count) withObject:myObject ]
``` | [
-0.23739200830459595,
-0.13704706728458405,
0.16032734513282776,
-0.24091340601444244,
-0.11658061295747757,
-0.02027052268385887,
0.2733322083950043,
-0.47342854738235474,
-0.2629210650920868,
-0.3607850968837738,
-0.15205635130405426,
0.5227367281913757,
-0.5706090331077576,
0.0248240698... | |
I'm stuck on a fix to a legacy Visual C++ 6 app. In the C++ DLL source I have put
```
extern "C" _declspec(dllexport) char* MyNewVariable = 0;
```
which results in MyNewVariable showing up (nicely undecorated) in the export table (as shown by dumpbin /exports blah.dll). However, I can't figure out how to declare the variable so that I can access it in a C source file. I have tried various things, including
```
_declspec(dllimport) char* MyNewVariable;
```
but that just gives me a linker error:
unresolved external symbol "\_\_declspec(dllimport) char \* MyNewVariable" (\_\_imp\_?MyNewVariable@@3PADA)
```
extern "C" _declspec(dllimport) char* MyNewVariable;
```
as suggested by Tony (and as I tried before) results in | [
-0.05410683527588844,
0.24681808054447174,
0.4488990902900696,
-0.1853880137205124,
0.16454307734966278,
0.05842181295156479,
0.49485281109809875,
0.13498584926128387,
-0.13848446309566498,
-0.5259321331977844,
-0.1563422679901123,
0.6433426141738892,
-0.4096696674823761,
0.510822713375091... | |
a different expected decoration, but still hasn't removed it:
unresolved external symbol \_\_imp\_\_MyNewVariable
How do I write the declaration so that the C++ DLL variable is accessible from the C app?
---
The Answer
----------
As identified by botismarius and others (many thanks to all), I needed to link with the DLL's .lib. To prevent the name being mangled I needed to declare it (in the C source) with no decorators, which means I needed to use the .lib file.
you must link against the lib generated after compiling the DLL. In the linker options of the project, you must add the `.lib` file. And yes, you | [
0.23823408782482147,
0.14183947443962097,
0.4021129608154297,
0.028406105935573578,
-0.12166104465723038,
0.16777344048023224,
0.2846391797065735,
-0.058488879352808,
-0.2575482428073883,
-0.5534141659736633,
-0.10475867241621017,
0.6438296437263489,
-0.36222442984580994,
0.310032874345779... | |
should also declare the variable as:
```
extern "C" { declspec(dllimport) char MyNewVariable; }
``` | [
0.133601114153862,
0.06865572929382324,
0.346953421831131,
-0.20536881685256958,
0.2913382649421692,
-0.21139965951442719,
0.10516872256994247,
0.050645411014556885,
0.14636071026325226,
-0.0816175565123558,
-0.47010338306427,
0.8202877044677734,
-0.33129456639289856,
0.3265311121940613,
... | |
In C# are the nullable primitive types (i.e. `bool?`) just aliases for their corresponding `Nullable<T>` type or is there a difference between the two?
If you look at the IL using [Ildasm](http://msdn.microsoft.com/en-us/library/f7dy01k1%28v=vs.100%29.aspx), you'll find that they both compile down to `Nullable<bool>`. | [
0.2536061108112335,
0.000437351904110983,
-0.10956652462482452,
-0.21668310463428497,
-0.1732134222984314,
-0.36046749353408813,
0.1682511866092682,
0.028565170243382454,
-0.04891588166356087,
-0.29847609996795654,
-0.42454764246940613,
0.524861216545105,
-0.5862514972686768,
-0.3315095007... | |
How do you actually perform datetime operations such as adding date, finding difference, find out how many days excluding weekends in an interval? I personally started to pass some of these operations to my postgresql dbms as typically I would only need to issue one sql statement to obtain an answer, however, to do it in PHP way I would have to write a lot more code that means more chances for errors to occur...
Are there any libraries in PHP that does datetime operation in a way that don't require a lot of code? that beats sql in a situation | [
0.366923987865448,
-0.1309567093849182,
0.2515939474105835,
0.23811756074428558,
-0.031470801681280136,
-0.11241881549358368,
0.09913347661495209,
-0.08165379613637924,
-0.2548593282699585,
-0.2730458378791809,
0.2959601581096649,
0.6394592523574829,
-0.12001848965883255,
-0.35964033007621... | |
where 'Given two dates, how many workdays are there between the two dates? Implement in either SQL, or $pet\_lang' that is solved by making this query?
```sql
SELECT COUNT(*) AS total_days
FROM (SELECT date '2008-8-26' + generate_series(0,
(date '2008-9-1' - date '2008-8-26')) AS all_days) AS calendar
WHERE EXTRACT(isodow FROM all_days) < 6;
```
PHP5+'s DateTime object is useful because it is leap time and
daylight savings aware, but it needs some extension to really
solve the problem. I wrote the following to solve a similar problem.
The find\_WeekdaysFromThisTo() method is brute-force, but it works | [
0.13811099529266357,
-0.2240951508283615,
0.5554938912391663,
-0.0711648240685463,
-0.029859419912099838,
0.13697382807731628,
0.20118063688278198,
-0.10494644939899445,
-0.351326048374176,
-0.3309604227542877,
-0.05650679022073746,
0.2643638253211975,
-0.19917115569114685,
0.1054838895797... | |
reasonably quickly if your time span is less than 2 years.
```
$tryme = new Extended_DateTime('2007-8-26');
$newer = new Extended_DateTime('2008-9-1');
print 'Weekdays From '.$tryme->format('Y-m-d').' To '.$newer->format('Y-m-d').': '.$tryme -> find_WeekdaysFromThisTo($newer) ."\n";
/* Output: Weekdays From 2007-08-26 To 2008-09-01: 265 */
print 'All Days From '.$tryme->format('Y-m-d').' To '.$newer->format('Y-m-d').': '.$tryme -> find_AllDaysFromThisTo($newer) ."\n";
/* Output: All Days From 2007-08-26 To 2008-09-01: 371 */
$timefrom = $tryme->find_TimeFromThisTo($newer);
print 'Between '.$tryme->format('Y-m-d').' and '.$newer->format('Y-m-d').' there are '.
$timefrom['years'].' years, '.$timefrom['months'].' months, and '.$timefrom['days'].
' days.'."\n";
/* Output: Between 2007-08-26 and 2008-09-01 there are 1 years, 0 months, and | [
-0.2265593260526657,
0.05987609922885895,
0.8030568957328796,
-0.059062764048576355,
0.5195576548576355,
0.023714261129498482,
0.5034086108207703,
0.24559065699577332,
-0.39104586839675903,
-0.738628625869751,
-0.1464584916830063,
0.543911337852478,
0.15188096463680267,
0.12305086106061935... | |
5 days. */
class Extended_DateTime extends DateTime {
public function find_TimeFromThisTo($newer) {
$timefrom = array('years'=>0,'months'=>0,'days'=>0);
// Clone because we're using modify(), which will destroy the object that was passed in by reference
$testnewer = clone $newer;
$timefrom['years'] = $this->find_YearsFromThisTo($testnewer);
$mod = '-'.$timefrom['years'].' years';
$testnewer -> modify($mod);
$timefrom['months'] = $this->find_MonthsFromThisTo($testnewer); | [
0.33516964316368103,
-0.14939357340335846,
0.45229047536849976,
-0.0844937264919281,
0.6598876118659973,
0.05024336650967598,
0.3744567334651947,
-0.26221558451652527,
-0.24013245105743408,
-0.41155701875686646,
-0.20970620214939117,
0.25670862197875977,
0.04452195018529892,
0.660454452037... | |
$mod = '-'.$timefrom['months'].' months';
$testnewer -> modify($mod);
$timefrom['days'] = $this->find_AllDaysFromThisTo($testnewer);
return $timefrom;
} // end function find_TimeFromThisTo
public function find_YearsFromThisTo($newer) {
/*
If the passed is:
not an object, not of class DateTime or one of its children, | [
0.18485525250434875,
-0.1503858119249344,
0.5600982308387756,
-0.21825499832630157,
0.5718273520469666,
0.04664142057299614,
0.26462873816490173,
-0.04306216165423393,
-0.3110569715499878,
-0.4260784089565277,
-0.3107176721096039,
0.2855382263660431,
0.0930115357041359,
0.5652123093605042,... | |
or not larger (after) $this
return false
*/
if (!is_object($newer) || !($newer instanceof DateTime) || $newer->format('U') < $this->format('U'))
return FALSE;
$count = 0;
// Clone because we're using modify(), which will destroy the object that was passed in by reference
$testnewer = clone $newer; | [
0.7991021871566772,
-0.019267583265900612,
0.34213078022003174,
-0.2429114729166031,
0.44601938128471375,
-0.22987109422683716,
0.36893513798713684,
-0.45024386048316956,
0.05624249950051308,
-0.44299814105033875,
-0.05492459237575531,
0.560416579246521,
-0.2803223729133606,
0.588677287101... | |
$testnewer -> modify ('-1 year');
while ( $this->format('U') < $testnewer->format('U')) {
$count ++;
$testnewer -> modify ('-1 year');
}
return $count;
} // end function find_YearsFromThisTo
public function find_MonthsFromThisTo($newer) {
/*
If the | [
0.20003609359264374,
-0.04157894849777222,
0.4343228340148926,
-0.31405243277549744,
0.5936758518218994,
-0.003555341623723507,
0.2010737806558609,
-0.015641536563634872,
-0.08771254867315292,
-0.2901955842971802,
-0.2619541585445404,
0.2745382785797119,
0.2678239047527313,
0.4376635849475... | |
passed is:
not an object, not of class DateTime or one of its children,
or not larger (after) $this
return false
*/
if (!is_object($newer) || !($newer instanceof DateTime) || $newer->format('U') < $this->format('U'))
return FALSE;
$count = 0;
// Clone because | [
0.44869863986968994,
-0.28432831168174744,
0.5974484086036682,
-0.14843007922172546,
0.3758276402950287,
-0.21064329147338867,
0.18083471059799194,
-0.16884955763816833,
-0.1256456971168518,
-0.3486427962779999,
-0.1051112487912178,
-0.24529510736465454,
-0.22511011362075806,
0.57465219497... | |
we're using modify(), which will destroy the object that was passed in by reference
$testnewer = clone $newer;
$testnewer -> modify ('-1 month');
while ( $this->format('U') < $testnewer->format('U')) {
$count ++;
$testnewer -> modify ('-1 month');
}
return $count;
} | [
0.6629564762115479,
0.00008362034714082256,
0.5721620321273804,
-0.04230901971459389,
0.36532750725746155,
-0.018382463604211807,
0.27567917108535767,
-0.38267749547958374,
0.04520127922296524,
-0.4556029438972473,
-0.12820427119731903,
0.42031100392341614,
-0.2678964138031006,
0.529055655... | |
// end function find_MonthsFromThisTo
public function find_AllDaysFromThisTo($newer) {
/*
If the passed is:
not an object, not of class DateTime or one of its children,
or not larger (after) $this
return false
*/
if (!is_object($newer) || !($newer instanceof DateTime) || $newer->format('U') < $this->format('U')) | [
0.00009003547893371433,
-0.16648739576339722,
0.7389074563980103,
-0.11804763227701187,
0.6139601469039917,
-0.07316844910383224,
0.24431529641151428,
0.20533481240272522,
-0.12544672191143036,
-0.47939828038215637,
-0.33442479372024536,
0.26009950041770935,
0.11265838891267776,
0.32821920... | |
return FALSE;
$count = 0;
// Clone because we're using modify(), which will destroy the object that was passed in by reference
$testnewer = clone $newer;
$testnewer -> modify ('-1 day');
while ( $this->format('U') < $testnewer->format('U')) {
$count ++; | [
0.7906464338302612,
-0.044769275933504105,
0.31341585516929626,
-0.2956429421901703,
0.3199591040611267,
-0.11683594435453415,
0.49567073583602905,
-0.4872361123561859,
0.19556434452533722,
-0.3484254777431488,
-0.08360964804887772,
0.4297763705253601,
-0.35455358028411865,
0.5485498905181... | |
$testnewer -> modify ('-1 day');
}
return $count;
} // end function find_AllDaysFromThisTo
public function find_WeekdaysFromThisTo($newer) {
/*
If the passed is:
not an object, not of class DateTime or one of its children,
or not larger (after) $this
return false | [
0.44568029046058655,
-0.1933935135602951,
0.5647947192192078,
-0.20820386707782745,
0.2940232753753662,
-0.07147407531738281,
0.408281534910202,
0.1689128875732422,
-0.11601603031158447,
-0.33205994963645935,
-0.23914645612239838,
0.14430280029773712,
-0.18959186971187592,
0.18103788793087... | |
*/
if (!is_object($newer) || !($newer instanceof DateTime) || $newer->format('U') < $this->format('U'))
return FALSE;
$count = 0;
// Clone because we're using modify(), which will destroy the object that was passed in by reference
$testnewer = clone $newer;
$testnewer -> modify ('-1 day'); | [
0.7441180348396301,
-0.09800021350383759,
0.29320597648620605,
-0.2640955150127411,
0.4781007170677185,
-0.23714467883110046,
0.42721128463745117,
-0.2795329988002777,
0.19682882726192474,
-0.5261095762252808,
-0.14252083003520966,
0.5236235857009888,
-0.24746577441692352,
0.61437904834747... | |
while ( $this->format('U') < $testnewer->format('U')) {
// If the calculated day is not Sunday or Saturday, count this day
if ($testnewer->format('w') != '0' && $testnewer->format('w') != '6')
$count ++;
$testnewer -> modify ('-1 day');
}
return $count; | [
0.4709703326225281,
-0.2815406620502472,
0.3868390917778015,
-0.21158303320407867,
0.2326831966638565,
0.016200758516788483,
0.31044328212738037,
-0.32348039746284485,
0.08219566196203232,
-0.3051423728466034,
-0.4445078372955322,
0.4623523950576782,
-0.2107173502445221,
0.0059492578729987... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.