text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
I have an absolutely positioned `div` containing several children, one of which is a relatively positioned `div`. When I use a `percentage-based width` on the child `div`, it collapses to `0 width` on IE7, but not on Firefox or Safari.
If I use `pixel width`, it works. If the parent is relatively positioned, the perce... | [
0.36346691846847534,
0.13352739810943604,
0.38462021946907043,
-0.09144695103168488,
0.03362520784139633,
0.2223886251449585,
0.15952709317207336,
0.04703124985098839,
0.16300109028816223,
-0.9281088709831238,
-0.14638856053352356,
0.44247904419898987,
-0.10123006999492645,
-0.034093007445... | |
pixels or as a percentage. In Internet Explorer 7, the parent `div` needs a defined `width` for child percentage `div`s to work correctly. | [
0.15191926062107086,
-0.25587400794029236,
0.6354948878288269,
0.020723257213830948,
-0.0793287456035614,
0.21894772350788116,
-0.1288432627916336,
0.17382661998271942,
0.1672404408454895,
-0.7667054533958435,
-0.317180335521698,
0.36258769035339355,
0.08587139844894409,
0.2893849313259125... | |
Given a specific `DateTime` value, how do I display relative time, like:
* `2 hours ago`
* `3 days ago`
* `a month ago`
Jeff, [your code](https://stackoverflow.com/questions/11/how-do-i-calculate-relative-time/12#12) is nice but could be clearer with constants (as suggested in Code Complete).
```csharp
const int SECO... | [
0.24956881999969482,
-0.28400707244873047,
0.42697280645370483,
-0.10366053879261017,
0.26754510402679443,
0.18187139928340912,
0.29238608479499817,
-0.19562628865242004,
-0.29250016808509827,
-0.6917046904563904,
0.006741516292095184,
0.0965135395526886,
-0.013536662794649601,
0.218175485... | |
"a minute ago";
if (delta < 45 * MINUTE)
return ts.Minutes + " minutes ago";
if (delta < 90 * MINUTE)
return "an hour ago";
if (delta < 24 * HOUR)
return ts.Hours + " hours ago";
if (delta < 48 * HOUR)
return "yesterday";
if (delta < 30 * DAY)
return ts.Days + " days ago";
if (delta < 12 * MONTH)
{
in... | [
0.07253585755825043,
-0.07856756448745728,
0.476757287979126,
-0.11133746802806854,
0.3970925509929657,
0.3570560812950134,
0.104275643825531,
-0.2949689030647278,
-0.5174269676208496,
-0.6097415685653687,
-0.2055000513792038,
0.05089900642633438,
0.2416483759880066,
0.6006153225898743,
... | |
: years + " years ago";
}
``` | [
0.14279472827911377,
0.205266073346138,
0.1523635983467102,
-0.20425456762313843,
0.4491024613380432,
0.002300682943314314,
-0.1355222463607788,
0.21907761693000793,
-0.34782448410987854,
-0.19284705817699432,
-0.1489245742559433,
0.1278957575559616,
-0.008299010805785656,
0.71591150760650... | |
I am starting a new web application in PHP and this time around I want to create something that people can extend by using a plugin interface.
How does one go about writing 'hooks' into their code so that plugins can attach to specific events?
You could use an Observer pattern. A simple functional way to accomplish t... | [
0.4421554505825043,
-0.005190020892769098,
0.4554086923599243,
-0.20815224945545197,
-0.07669562101364136,
-0.21639741957187653,
0.3228580951690674,
-0.03867804631590843,
-0.46694716811180115,
-0.5472612380981445,
0.0938263088464737,
0.47780320048332214,
-0.4415806829929352,
0.011794770136... | |
trigger_error("Insufficient arguments", E_USER_ERROR);
// Hook name should always be first argument
$hook_name = array_shift($args);
if(!isset($listeners[$hook_name]))
return; // No plugins have registered this hook
foreach($listeners[$hook_name] as $func) {
$args = $func($args);
... | [
0.07736250013113022,
0.02419062703847885,
0.5367022752761841,
-0.5781400203704834,
-0.24278901517391205,
0.13852280378341675,
0.09308016300201416,
-0.6947160363197327,
-0.057684529572725296,
-0.24940721690654755,
-0.16502289474010468,
0.7794996500015259,
-0.6423627734184265,
-0.08870970457... | |
5);
}
function my_plugin_func2($args) {
return str_replace('sample', 'CRAZY', $args[0]);
}
/////////////////////////
/** Sample Application **/
$a = 1;
$b = 2;
list($a, $b) = hook('a_b', $a, $b);
$str = "This is my sample application\n";
$str .= "$a + $b = ".($a+$b)."\n";
$str .= "$a * $b = ".($a*$b)."\n";
... | [
0.3754497468471527,
-0.0014767521061003208,
0.4796118438243866,
0.046504996716976166,
0.5728389024734497,
-0.2168828696012497,
0.3094688653945923,
-0.3971203565597534,
-0.18876153230667114,
0.22605222463607788,
-0.13674379885196686,
0.2720741033554077,
-0.7520964741706848,
0.12527422606945... | |
is writing the actual documentation which lists what arguments get passed to each hook.
This is just one method of accomplishing a plugin system in PHP. There are better alternatives, I suggest you check out the WordPress Documentation for more information. | [
0.5995470881462097,
0.017877129837870598,
-0.1137194111943245,
0.19938625395298004,
-0.04159931093454361,
-0.11741789430379868,
-0.16675151884555817,
-0.10620588809251785,
0.0985155925154686,
-0.3959710896015167,
0.3599050045013428,
0.7480803728103638,
-0.16251768171787262,
-0.344789922237... | |
I have a `DataTable` with a `Name` column. I want to generate a collection of the unique names ordered alphabetically. The following query ignores the *order by* clause.
```
var names =
(from DataRow dr in dataTable.Rows
orderby (string)dr["Name"]
select (string)dr["Name"]).Distinct();
```
Why does the `... | [
-0.016385691240429878,
0.16897258162498474,
0.4828588366508484,
0.02279658056795597,
-0.10589967668056488,
-0.024910246953368187,
-0.26169976592063904,
-0.3539438843727112,
-0.20900700986385345,
-0.5196703672409058,
-0.13767559826374054,
0.3121918737888336,
-0.42758598923683167,
0.40025031... | |
require
3. Finally, create an ordered list, from `x2` into `x3`, sorting by whatever you desire | [
-0.025671212002635002,
0.15197773277759552,
0.1261376589536667,
-0.01233804039657116,
-0.07477953284978867,
0.006084283348172903,
-0.1126895323395729,
-0.4853145480155945,
-0.21397222578525543,
-0.48161306977272034,
-0.39210954308509827,
0.17122229933738708,
-0.6176410913467407,
-0.2428212... | |
I am porting a game, that was originally written for the Win32 API, to Linux (well, porting the OS X port of the Win32 port to Linux).
I have implemented `QueryPerformanceCounter` by giving the uSeconds since the process start up:
```
BOOL QueryPerformanceCounter(LARGE_INTEGER* performanceCount)
{
gettimeofday(&... | [
0.3094436824321747,
-0.32023996114730835,
1.0692250728607178,
-0.19456009566783905,
0.12836454808712006,
-0.27462708950042725,
0.28511935472488403,
-0.38131383061408997,
0.024111630395054817,
-0.9511324763298035,
-0.24335724115371704,
0.8270329833030701,
-0.0969851091504097,
0.402014166116... | |
the program's start-up.
So *is this portable?* I don't want to discover it works differently if the kernel was compiled in a certain way or anything like that. I am fine with it being non-portable to something other than Linux, however.
Maybe. But you have bigger problems. `gettimeofday()` can result in incorrect timi... | [
0.09044951945543289,
-0.2703722417354584,
0.40060457587242126,
0.11985131353139877,
0.049164220690727234,
-0.17826451361179352,
0.29276043176651,
0.08701144903898239,
-0.3628523051738739,
-0.8910126686096191,
-0.030048027634620667,
0.62862628698349,
-0.2596869170665741,
-0.0091638956218957... | |
your question no.
You should look into `clock_gettime(CLOCK_MONOTONIC)` for timing intervals. It suffers from several less issues due to things like multi-core systems and external clock settings.
Also, look into the `clock_getres()` function. | [
0.40743252635002136,
-0.1223515123128891,
0.2742648124694824,
0.26785436272621155,
0.09110730141401291,
-0.09966125339269638,
0.12890630960464478,
-0.21718494594097137,
-0.15133361518383026,
-0.40677157044410706,
-0.02714494988322258,
0.7128232717514038,
-0.23433516919612885,
-0.0511417761... | |
How do you [branch and merge](http://svnbook.red-bean.com/en/1.8/svn.branchmerge.html) with Apache Subversion using the TortoiseSVN client?
My easy click-by-click instructions (**specific to TortoiseSVN**) are in Stack Overflow question *[What is the simplest way to do branching and merging using TortoiseSVN?](https://... | [
-0.07747363299131393,
-0.5016990303993225,
0.41302913427352905,
-0.025561684742569923,
0.2758564352989197,
-0.22440402209758759,
0.29309332370758057,
-0.0886038988828659,
-0.5776097774505615,
-0.20124614238739014,
-0.18347838521003723,
0.5707523226737976,
0.013024878688156605,
-0.188578650... | |
Recently our site has been deluged with the resurgence of the [Asprox botnet](https://en.wikipedia.org/wiki/Asprox_botnet) [SQL injection](http://en.wikipedia.org/wiki/SQL_injection) attack. Without going into details, the attack attempts to execute SQL code by encoding the [T-SQL](http://en.wikipedia.org/wiki/Transact... | [
0.500487744808197,
0.1792416125535965,
0.38960495591163635,
-0.19775666296482086,
-0.3013199269771576,
0.06475268304347992,
0.36151784658432007,
-0.17302757501602173,
-0.40799278020858765,
-0.5556366443634033,
-0.029543820768594742,
0.41871505975723267,
-0.2925300598144531,
0.3383283317089... | |
tried all of the following commands with no luck:
```
txtDecodedText.Text =
System.Web.HttpUtility.UrlDecode(txtURLText.Text);
txtDecodedText.Text =
Encoding.ASCII.GetString(Encoding.ASCII.GetBytes(txtURLText.Text));
txtDecodedText.Text =
Encoding.Unicode.GetString(Encoding.Unicode.GetBytes(txtURLText.Text... | [
-0.09438242018222809,
0.06099672242999077,
0.297406405210495,
-0.03574668988585472,
0.07466858625411987,
0.15183860063552856,
0.3888634145259857,
-0.0397023968398571,
-0.09023777395486832,
-0.8596802353858948,
-0.250889390707016,
0.43567606806755066,
-0.26468625664711,
0.10811138153076172,... | |
this...
```
txtDecodedText.Text = Encoding.UTF8.GetString(Encoding.UTF8.GetBytes(txtURL.Text));
```
...and all it did was return the exact same thing that I put in since it converted each character into is a byte.
I realized that I need to parse every two characters into a byte manually since I don't know of any me... | [
-0.06417319923639297,
0.15463270246982574,
0.5255129933357239,
-0.31394249200820923,
-0.10719610005617142,
0.16676262021064758,
0.5240745544433594,
-0.5543175935745239,
-0.13334710896015167,
-0.32142508029937744,
-0.34025344252586365,
0.4220837950706482,
-0.5442742705345154,
0.097984962165... | |
boolIsDone = true;
}
}
txtDecodedText.Text = Encoding.UTF8.GetString(bytURL);
```
Things look good for the first couple of pairs, but then the loop balks when it gets to the "4C" pair and says that the string is in the incorrect format.
Interestingly enough, when I step through the debugger and to the GetString... | [
0.23367802798748016,
0.2154482752084732,
0.31609204411506653,
-0.37639278173446655,
0.008065910078585148,
-0.25268250703811646,
0.7703119516372681,
-0.2975888252258301,
-0.1562913954257965,
-0.14971742033958435,
-0.1282278597354889,
0.5583279132843018,
-0.4493895471096039,
0.19565756618976... | |
back to Michael's post, did some more poking and realized that I did need to do a double conversion, and eventually worked out this little nugget:
```
Convert.ToString(Convert.ToChar(Int32.Parse(EncodedString.Substring(intParseIndex, 2), System.Globalization.NumberStyles.HexNumber)));
```
From there I simply made a ... | [
0.45894965529441833,
0.3111284673213959,
0.2788161039352417,
-0.10015000402927399,
-0.280887246131897,
0.133483424782753,
0.30929410457611084,
0.18554121255874634,
-0.25205686688423157,
-0.6836779713630676,
0.07645153999328613,
0.15510165691375732,
-0.4047987759113312,
0.040666233748197556... | |
I have a website that plays mp3s in a flash player. If a user clicks 'play' the flash player automatically downloads an mp3 and starts playing it.
Is there an easy way to track how many times a particular song clip (or any binary file) has been downloaded?
---
> Is the play link a link to the actual
> mp3 file or ... | [
0.5549465417861938,
0.21741612255573273,
0.1662733107805252,
0.09115917235612869,
-0.05676177144050598,
-0.3801269233226776,
-0.22183677554130554,
0.08043500036001205,
-0.30891427397727966,
-0.5697299838066101,
0.15793369710445404,
0.7766667008399963,
-0.1567070484161377,
0.025443829596042... | |
former, you'll need something
> that can track the web server log
> itself and make that distinction. My
> hosting plan comes with Webalizer,
> which does this nicely.
It's a javascript code so that answers that.
However, it would be nice to know how to track downloads using the other method (without switching h... | [
0.2611217200756073,
0.13180051743984222,
0.7261233925819397,
0.32564353942871094,
0.11655770987272263,
-0.3044450283050537,
-0.018419548869132996,
-0.12345638126134872,
-0.5275558829307556,
-0.6079345941543579,
0.11775972694158554,
0.8780531287193298,
-0.2182609587907791,
0.185261130332946... | |
public");
header('Content-disposition: attachment; filename='.basename($filename));
header("Content-Transfer-Encoding: binary");
header('Content-Length: '. filesize($filename));
// Put either file counting code here, either a db or static files
//
readfile($filename); //and spit the user the file
function base64_ur... | [
0.2547852396965027,
0.19268831610679626,
0.46486470103263855,
-0.14959676563739777,
-0.11514370888471603,
-0.26942646503448486,
0.2529810965061188,
-0.15558327734470367,
-0.20084673166275024,
-0.4601380228996277,
-0.6155524849891663,
0.6066221594810486,
-0.5130912661552429,
0.2910292446613... | |
without affecting the file link. | [
0.040743812918663025,
0.04027979448437691,
0.34639015793800354,
0.05194270610809326,
0.12811526656150818,
-0.2584969699382782,
0.16704320907592773,
-0.06818071007728577,
-0.2047058343887329,
-0.35559403896331787,
-0.4014594852924347,
0.3438870310783386,
-0.06255817413330078,
0.053870256990... | |
Stack Overflow has a subversion version number at the bottom:
> svn revision: 679
I want to use such automatic versioning with my `.NET Web Site/Application`, Windows Forms, WPD projects/solutions.
How do I implement this?
Looks like Jeff is using [CruiseControl.NET](https://web.archive.org/web/20090130045625/http:/... | [
-0.2307431697845459,
-0.04088889807462692,
0.6215137243270874,
0.04950765520334244,
0.3056453764438629,
-0.15713994204998016,
0.1825382262468338,
-0.16687460243701935,
-0.5677107572555542,
-0.25953367352485657,
-0.05419092997908592,
0.569230318069458,
-0.017915047705173492,
-0.002906730398... | |
This is something I've pseudo-solved many times and have never quite found a solution for.
The problem is to come up with a way to generate `N` colors, that are as distinguishable as possible where `N` is a parameter.
My first thought on this is "how to generate N vectors in a space that maximize distance from each ot... | [
0.3885340690612793,
-0.28406888246536255,
-0.10851825773715973,
0.12397102266550064,
0.0016562845557928085,
0.21461130678653717,
-0.35265791416168213,
0.040807824581861496,
-0.3821687698364258,
-0.8426895141601562,
0.39551499485969543,
0.27313271164894104,
-0.48119208216667175,
0.191393762... | |
in a hash table or something for later, and just perform random rotations on them to get all the colors you desire that are maximally apart from each other!
Thinking about this problem more, it would be better to map the colors in a linear manner, possibly (0,0,0) → (255,255,255) lexicographically, and then distribute... | [
0.09654178470373154,
-0.031092870980501175,
0.2570190727710724,
0.007908494211733341,
0.03785601258277893,
-0.05279766023159027,
0.16520647704601288,
-0.2710069417953491,
-0.48241326212882996,
-0.7473191618919373,
-0.23593741655349731,
0.5312584042549133,
-0.5185238122940063,
-0.0790092870... | |
the algorithm to avoid overflow and probably add some minor speed improvements. | [
-0.20138610899448395,
0.25008833408355713,
0.5488809943199158,
0.19507090747356415,
0.10505948960781097,
0.08148542791604996,
0.22409507632255554,
-0.0945533737540245,
-0.01846614107489586,
-0.6925172209739685,
-0.05010971799492836,
0.4072766602039337,
-0.10229986160993576,
-0.215368866920... | |
Does anybody know if there is a way to create an SQLite database based on an XSD `DataSet`? In the past, I've just used a basic SQLite manager, but I want to fuse things a bit more with my `.NET` development if possible.
I suspect in the general case this is hard; XML Schema allows for some quite bizarre type construct... | [
0.37352386116981506,
0.24252799153327942,
-0.06095628812909126,
0.2548395097255707,
0.03425000607967377,
-0.27866438031196594,
0.1799774467945099,
0.11450792104005814,
-0.2470097541809082,
-0.6035146713256836,
0.25443270802497864,
0.4543845057487488,
-0.1419605165719986,
0.0709218606352806... | |
(i.e. sequence and choice elements with a few simple data types). | [
0.04292970895767212,
0.03251860290765762,
-0.23171266913414001,
0.27392712235450745,
0.2733028829097748,
0.1348276436328888,
-0.17118464410305023,
-0.2290576845407486,
-0.035541996359825134,
-0.5609593391418457,
-0.4829797148704529,
0.21245704591274261,
-0.19417628645896912,
-0.00182105542... | |
I have a little game written in C#. It uses a database as back-end. It's
a [trading card game](http://en.wikipedia.org/wiki/Collectible_card_game), and I wanted to implement the function of the cards as a script.
What I mean is that I essentially have an interface, `ICard`, which a card class implements (`public clas... | [
0.3697289526462555,
0.01188751682639122,
0.13299493491649628,
0.3780822157859802,
0.1624370515346527,
-0.35147401690483093,
-0.37030938267707825,
-0.07191001623868942,
-0.24039477109909058,
-0.13522426784038544,
0.16397009789943695,
0.3200318217277527,
-0.08183694630861282,
0.2762309312820... | |
add it to the database and tell my application to refresh, without needing any assembly deployment (especially since we would be talking about 1 assembly per card which means hundreds of assemblies).
Is that possible? Register a class from a source file and then instantiate it, etc.
```
ICard Cards[current] = new MyG... | [
0.1279614120721817,
0.07140643894672394,
0.29131078720092773,
0.17205357551574707,
0.04623683914542198,
-0.20128211379051208,
-0.0815558061003685,
-0.1728701889514923,
-0.3821239769458771,
-0.49983012676239014,
0.05274006724357605,
0.2553313076496124,
-0.18876147270202637,
0.04754956811666... | |
for scripting, such as [IronRuby](https://en.wikipedia.org/wiki/IronRuby), [IronPython](https://en.wikipedia.org/wiki/IronPython), or [Lua](https://en.wikipedia.org/wiki/Lua_%28programming_language%29).
IronPython and IronRuby are both available today.
For a guide to embedding IronPython read
[How to embed IronPython... | [
0.06356718391180038,
0.2169915735721588,
0.12070569396018982,
-0.04159945249557495,
0.072174571454525,
0.25472140312194824,
0.22037777304649353,
-0.16409452259540558,
-0.20761403441429138,
-0.6873155236244202,
-0.245703786611557,
0.3827753961086273,
-0.2981489598751068,
-0.2273095101118087... | |
I often have to sort a dictionary (consisting of keys & values) by value. For example, I have a hash of words and respective frequencies that I want to order by frequency.
There is a `SortedList` which is good for a single value (say frequency), that I want to map back to the word.
[SortedDictionary](http://msdn.micr... | [
-0.003946809098124504,
0.09239714592695236,
0.3790617883205414,
-0.10281109064817429,
0.11739430576562881,
0.09341292083263397,
0.2873866856098175,
-0.41345033049583435,
-0.007849257439374924,
-0.7230545878410339,
-0.41143491864204407,
0.355297714471817,
-0.2008722871541977,
0.177503585815... | |
}
);
```
Since you're targeting .NET 2.0 or above, you can simplify this into lambda syntax -- it's equivalent, but shorter. If you're targeting .NET 2.0 you can only use this syntax if you're using the compiler from Visual Studio 2008 (or above).
```
var myList = aDictionary.ToList();
myList.Sort((pair1,pair2) => ... | [
0.2758241891860962,
-0.043128471821546555,
0.4683094918727875,
-0.5024014115333557,
-0.17758455872535706,
0.1874658316373825,
0.17786318063735962,
-0.29298755526542664,
0.060049157589673996,
-0.7564420700073242,
-0.11654595285654068,
0.7372617721557617,
-0.7401696443557739,
-0.408340960741... | |
When is it appropriate to use an unsigned variable over a signed one? What about in a `for` loop?
I hear a lot of opinions about this and I wanted to see if there was anything resembling a consensus.
```
for (unsigned int i = 0; i < someThing.length(); i++) {
SomeThing var = someThing.at(i);
// You get t... | [
0.3691323697566986,
-0.0055847130715847015,
-0.15741804242134094,
-0.30866774916648865,
-0.10168980062007904,
-0.3239680230617523,
0.2878040671348572,
-0.282443106174469,
-0.39198818802833557,
-0.48857972025871277,
-0.013877451419830322,
0.35293450951576233,
-0.1831618845462799,
0.02525807... | |
hadn't really given it much thought before.
In summary, signed is a good general choice - even when you're dead sure all the numbers are positive - if you're going to do arithmetic on the variable (like in a typical for loop case).
unsigned starts to make more sense when:
* You're going to do **bitwise things** like... | [
0.595941960811615,
-0.08781109005212784,
0.05730557441711426,
0.06374514102935791,
-0.2077506184577942,
-0.22127921879291534,
0.4430799186229706,
-0.010635980404913425,
-0.4228188097476959,
-0.5134925842285156,
0.13524676859378815,
0.4631331264972687,
-0.04582174867391586,
-0.1477516442537... | |
I am about to build a piece of a project that will need to construct and post an XML document to a web service and I'd like to do it in Python, as a means to expand my skills in it.
Unfortunately, whilst I know the XML model fairly well in .NET, I'm uncertain what the pros and cons are of the XML models in Python.
... | [
0.6846240758895874,
0.11768028140068054,
-0.086746945977211,
0.09974072873592377,
0.1645241677761078,
-0.15187856554985046,
-0.09230206906795502,
0.3208775818347931,
-0.22653397917747498,
-0.642114520072937,
0.17388202250003815,
0.516829252243042,
0.08100719004869461,
0.013709175400435925,... | |
XML-heavy project and have settled on [pulldom](http://docs.python.org/lib/module-xml.dom.pulldom.html) as the best choice for less complex documents.
Especially for small simple stuff, I like the event-driven theory of parsing rather than setting up a whole slew of callbacks for a relatively simple structure. [Here i... | [
0.1581829935312271,
-0.17819562554359436,
0.5070423483848572,
-0.033759575337171555,
-0.2039262056350708,
-0.4772859513759613,
-0.12467370927333832,
-0.307794451713562,
-0.20264723896980286,
-0.44776293635368347,
-0.34215712547302246,
0.6616685390472412,
-0.15812264382839203,
-0.2355232238... | |
How would I go about generating a list of all possible permutations of a string between x and y characters in length, containing a variable list of characters.
Any language would work, but it should be portable.
There are several ways to do this. Common methods use recursion, memoization, or dynamic programming. The b... | [
0.11697577685117722,
0.0011925061699002981,
-0.11350996047258377,
0.06788124144077301,
-0.0641728863120079,
0.3503550887107849,
0.008177319541573524,
-0.3100689649581909,
0.008340086787939072,
-0.48338767886161804,
0.08779186755418777,
0.3137931525707245,
-0.10855070501565933,
-0.032195080... | |
of the last and the next iteration)
Some pseudocode:
```
list = originalString.split('')
index = (0,0)
list = [""]
for iteration n in 1 to y:
index = (index[1], len(list))
for string s in list.subset(index[0] to end):
for character c in originalString:
list.add(s + c)
```
you'd then need to remove all... | [
-0.060662925243377686,
-0.10612655431032181,
0.627216637134552,
-0.2371629774570465,
0.17609380185604095,
0.029154840856790543,
0.15463753044605255,
-0.3427885174751282,
-0.3673235774040222,
-0.44318312406539917,
-0.37216290831565857,
0.332490473985672,
-0.24467812478542328,
0.175882577896... | |
Please note that this question is from 2008 and now is of only historic interest.
---
What's the best way to create an iPhone application that runs in landscape mode from the start, regardless of the position of the device?
Both programmatically and using the Interface Builder.
Historic answer only. Spectacularly ou... | [
-0.04973069950938225,
0.17992913722991943,
0.6171727180480957,
-0.15041004121303558,
0.49849653244018555,
-0.22180113196372986,
0.370156854391098,
0.23354017734527588,
-0.2367316633462906,
-0.19445374608039856,
-0.08023980259895325,
0.39567750692367554,
0.044036731123924255,
0.110030114650... | |
specific serious problem of landscape "only working the first time" has been resolved.
As of April 2011, it is not possible to test or even build anything below 4.0, so the question is purely a historic curiosity. It's incredible how much trouble it caused developers for so long!
---
Here is the original discussion ... | [
-0.133313849568367,
0.14461544156074524,
0.42374083399772644,
-0.38056185841560364,
0.1840820610523224,
-0.07044541835784912,
0.3705439865589142,
-0.23509034514427185,
-0.2048121690750122,
-0.45457762479782104,
-0.03229561448097229,
0.6708493232727051,
-0.3510569930076599,
-0.0782034918665... | |
properly everywhere"* it means everywhere, all your fullscreen views.
Hope it helps in this nightmare!
An important reminder of the ADDITIONAL well-known problem at hand here: if you are trying to swap between ***MORE THAN ONE*** view (all landscape), ***IT SIMPLY DOES NOT WORK***. It is essential to remember this or... | [
0.7506231665611267,
-0.18814224004745483,
0.5110433101654053,
0.21256954967975616,
0.22858548164367676,
-0.1749671995639801,
0.4819462299346924,
0.2427414208650589,
-0.4987559914588928,
-0.6151233911514282,
-0.14066073298454285,
0.7976043224334717,
-0.5780196189880371,
-0.21827884018421173... | |
have a trivial master UIViewController that does nothing but sit there and let you swap between your views.
In other words, in iOS because of a major know bug:
```
[window addSubview:happyThing.view];
[window makeKeyAndVisible];
```
***You can do that only once***. Later, if you try to remove happyThing.view, and i... | [
0.06516248732805252,
-0.19244761765003204,
0.6117445826530457,
0.15925465524196625,
-0.005877574905753136,
0.009128079749643803,
0.4468650221824646,
0.03109302930533886,
-0.21011897921562195,
-0.9164502620697021,
-0.19755248725414276,
0.5488723516464233,
-0.47687655687332153,
0.04717582836... | |
it helps! | [
0.13970184326171875,
0.318431556224823,
0.11038588732481003,
0.054232385009527206,
0.11053875833749771,
-0.09183011204004288,
0.3095228970050812,
0.22899043560028076,
-0.08420000970363617,
-0.3054017126560211,
0.16388341784477234,
0.24865098297595978,
0.3417918086051941,
0.0014685764908790... | |
I have a cross-platform (Python) application which needs to generate a JPEG preview of the first page of a PDF.
On the Mac I am spawning [sips](http://web.archive.org/web/20090309234215/http://developer.apple.com:80/documentation/Darwin/Reference/ManPages/man1/sips.1.html). Is there something similarly simple I can do... | [
0.07582158595323563,
-0.09093516319990158,
0.5218530893325806,
0.04107962176203728,
-0.39708632230758667,
-0.01908615045249462,
0.4977585971355438,
-0.2298607975244522,
-0.19221679866313934,
-0.6739040017127991,
0.061241038143634796,
0.33824676275253296,
-0.26177215576171875,
0.19790013134... | |
resolution you need. (Obviously, strip out the backslashes if you're writing out the whole command as one line.)
This is good for two reasons:
1. You don't need to have ImageMagick installed anymore. Not that I have anything against ImageMagick (I love it to bits), but I believe in simple solutions.
2. ImageMagick do... | [
-0.36048001050949097,
-0.4146837592124939,
0.8458788394927979,
0.15590344369411469,
-0.3622385263442993,
-0.03160135820508003,
0.020007360726594925,
-0.29566073417663574,
-0.48581570386886597,
-0.9996569156646729,
-0.02836833894252777,
0.895606279373169,
0.05102882906794548,
-0.04616586863... | |
> #### Moderator note:
>
>
> This question is not a good fit for our question and answer format with the [topicality rules](/help/on-topic) which currently apply for Stack Overflow. We normally use a "historical lock" for such questions where the content still has value. However, the answers on this question are acti... | [
0.07966691255569458,
0.15525291860103607,
0.44983088970184326,
0.2561293840408325,
-0.23411990702152252,
-0.49853184819221497,
0.22523850202560425,
-0.10259933024644852,
-0.22429516911506653,
-0.3592158257961273,
-0.21331602334976196,
0.4611688256263733,
-0.045858222991228104,
0.2043298929... | |
good example of an on-topic question for Stack Overflow).
Form-based authentication for websites
--------------------------------------
We believe that Stack Overflow should not just be a resource for very specific technical questions, but also for general guidelines on how to solve variations on common problems. "Fo... | [
-0.0895659551024437,
0.13712942600250244,
0.2559617757797241,
0.2734670639038086,
0.13677257299423218,
-0.5666630268096924,
0.33419299125671387,
-0.2783257067203522,
-0.383955717086792,
-0.5138978958129883,
-0.38583824038505554,
0.5481789708137512,
0.0704377219080925,
-0.18033301830291748,... | |
me" checkbox
* Browser autocompletion of usernames and passwords
* Secret URLs (public [URL](https://en.wikipedia.org/wiki/Uniform_Resource_Locator) protected by digest)
* Checking password strength
* E-mail validation
* *and much more about* [form based authentication](http://en.wikipedia.org/wiki/Form-based_authentic... | [
0.49692994356155396,
0.3356494903564453,
0.2610229551792145,
0.18931804597377777,
-0.17203879356384277,
-0.3013196289539337,
0.37877073884010315,
-0.18109534680843353,
0.19967851042747498,
-0.7110591530799866,
-0.10029840469360352,
0.48966094851493835,
-0.07891063392162323,
-0.150583609938... | |
most common security pitfalls.
**To HTTPS or not to HTTPS?**
Unless the connection is already secure (that is, tunneled through HTTPS using SSL/TLS), your login form values will be sent in cleartext, which allows anyone eavesdropping on the line between browser and web server will be able to read logins as they pass ... | [
0.8677945733070374,
-0.19773654639720917,
0.36296701431274414,
0.2552074193954468,
0.258044958114624,
-0.6660443544387817,
0.3797481954097748,
-0.12879931926727295,
-0.43396231532096863,
-0.42004653811454773,
-0.36532166600227356,
0.44594237208366394,
-0.28311118483543396,
0.02376027777791... | |
[TLS](https://en.wikipedia.org/wiki/Transport_Layer_Security)) or a proven & tested challenge-response scheme (for example, the [Diffie-Hellman](https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange)-based SRP). *Any other method can be easily circumvented* by an eavesdropping attacker.
Of course, if you a... | [
0.4126549959182739,
-0.35779449343681335,
0.2129797637462616,
0.2921864688396454,
-0.11971575021743774,
-0.4651317000389099,
0.5733652114868164,
-0.1071239709854126,
-0.31743642687797546,
-0.5704998970031738,
-0.5823391675949097,
0.4533231854438782,
-0.38576561212539673,
-0.001385667826980... | |
cost and technical difficulty of setting up an SSL certificate on your website, some developers are tempted to roll their own in-browser hashing or encryption schemes in order to avoid passing cleartext logins over an unsecured wire.
While this is a noble thought, it is essentially useless (and can be a [security flaw... | [
0.3658970296382904,
0.17728807032108307,
0.25594377517700195,
0.22208045423030853,
0.0049082618206739426,
-0.6592990756034851,
0.5260458588600159,
0.07582507282495499,
-0.2485767900943756,
-0.4733107089996338,
-0.2620237469673157,
0.02031552977859974,
-0.0892016589641571,
0.042649429291486... | |
and most difficult to implement concepts in digital security).
While it is true that hashing the password *can be* effective against **password disclosure**, it is vulnerable to replay attacks, Man-In-The-Middle attacks / hijackings (if an attacker can inject a few bytes into your unsecured HTML page before it reaches... | [
-0.14392082393169403,
0.02532622218132019,
0.015984874218702316,
0.23535311222076416,
-0.15822428464889526,
-0.288822740316391,
0.3136886954307556,
-0.015527425333857536,
-0.19032567739486694,
-0.7735961675643921,
-0.3559562861919403,
0.31220027804374695,
-0.13823826611042023,
0.2593834996... | |
is a real threat, however, there are ways of dealing with it seamlessly that don't require a CAPTCHA, specifically properly designed server-side login throttling schemes - we'll discuss those later.
Know that CAPTCHA implementations are not created alike; they often aren't human-solvable, most of them are actually ine... | [
0.5729320645332336,
0.10574066638946533,
0.432923287153244,
0.1308511197566986,
0.21833640336990356,
-0.35081297159194946,
0.6080067157745361,
0.15410025417804718,
-0.4103837013244629,
-0.49972206354141235,
-0.062066733837127686,
0.34521549940109253,
-0.41216838359832764,
-0.24493137001991... | |
(since it uses already OCR-misclassified book scans) and tries very hard to be user-friendly.
Personally, I tend to find CAPTCHAS annoying, and use them only as a last resort when a user has failed to log in a number of times and throttling delays are maxed out. This will happen rarely enough to be acceptable, and it ... | [
0.2773246169090271,
0.17587566375732422,
0.15256282687187195,
0.12738268077373505,
0.2649443447589874,
-0.7044089436531067,
0.9100233316421509,
0.4081646502017975,
-0.22179964184761047,
-0.6438577771186829,
-0.26629844307899475,
0.4927423298358917,
0.0028146563563495874,
0.0557560808956623... | |
User databases are routinely hacked, leaked or gleaned through SQL injection, and if you are storing raw, plaintext passwords, that is instant game over for your login security.
So if you can't store the password, how do you check that the login+password combination POSTed from the login form is correct? The answer is... | [
-0.02505265735089779,
0.03713662549853325,
-0.027498705312609673,
0.36796990036964417,
0.02988729067146778,
-0.30367469787597656,
0.24209603667259216,
0.16141760349273682,
-0.27441948652267456,
-0.6600226759910583,
-0.19959400594234467,
0.36239489912986755,
-0.29616889357566833,
0.33829194... | |
safer to store in your database. To verify a login, you run the same hash function on the entered password, this time passing in the salt and compare the resulting hash string to the value stored in your database. Argon2, bcrypt and scrypt store the salt with the hash already. Check out this [article](https://security.... | [
0.1410219520330429,
0.04705348238348961,
0.0010325413895770907,
0.1819935441017151,
0.12347149103879929,
-0.4480457603931427,
0.3664543330669403,
-0.3963938355445862,
0.017959102988243103,
-0.7847141027450562,
0.06480883806943893,
0.429443895816803,
-0.16983886063098907,
-0.053714696317911... | |
as the same hash value, preventing the whole database being scanned in one run if an attacker is executing a password guessing attack.
A cryptographic hash should not be used for password storage because user-selected passwords are not strong enough (i.e. do not usually contain enough entropy) and a password guessing ... | [
0.31954389810562134,
-0.2907404601573944,
0.21036700904369354,
-0.016327308490872383,
-0.0029092675540596247,
-0.3990248441696167,
0.34798184037208557,
-0.38986316323280334,
-0.45144590735435486,
-0.5040165781974792,
-0.27432680130004883,
0.3216399848461151,
-0.1513478010892868,
0.13552683... | |
causes the attacker to guess the password 10,000 times slower.
**Session data - "You are logged in as Spiderman69"**
Once the server has verified the login and password against your user database and found a match, the system needs a way to remember that the browser has been authenticated. This fact should only ever ... | [
0.35861292481422424,
-0.22095036506652832,
0.37160035967826843,
0.08743652701377869,
-0.03405648097395897,
-0.2124893069267273,
0.4768889248371124,
0.27494120597839355,
-0.371503621339798,
-0.7891873121261597,
0.16208449006080627,
0.13120800256729126,
-0.21529322862625122,
0.12193848192691... | |
If you are using an MVC framework, this is undoubtedly handled already.
If at all possible, make sure the session cookie has the secure and HTTP Only flags set when sent to the browser. The HttpOnly flag provides some protection against the cookie being read through XSS attack. The secure flag ensures that the cookie ... | [
0.15187513828277588,
0.0363033302128315,
0.4173707962036133,
0.10223358124494553,
-0.10388214886188507,
-0.3856567442417145,
0.7412837743759155,
0.07753101736307144,
-0.3921130895614624,
-0.5961609482765198,
-0.41120508313179016,
0.49809181690216064,
-0.4371883273124695,
0.0565884411334991... | |
on the client side. This is achieved by using techniques like JWT (JSON Web Token).
PART II: How To Remain Logged In - The Infamous "Remember Me" Checkbox
----------------------------------------------------------------------
Persistent Login Cookies ("remember me" functionality) are a danger zone; on the one hand, t... | [
0.11777141690254211,
0.10314314812421799,
0.5969565510749817,
0.17820177972316742,
0.15586784482002258,
-0.49258023500442505,
0.4209999144077301,
0.07828778028488159,
-0.3587895929813385,
-0.4628031849861145,
-0.30597513914108276,
0.5514276027679443,
0.3108619153499603,
0.06905423849821091... | |
persistent logins for the websites I visit on a regular basis, but I know how to handle them safely. If you are positive that your users know the same, you can use persistent logins with a clean conscience. If not - well, then you may subscribe to the philosophy that users who are careless with their login credentials ... | [
0.3832157552242279,
0.3113613724708557,
0.4953712224960327,
0.1454460769891739,
-0.072141133248806,
-0.22765663266181946,
0.48681262135505676,
0.5349184274673462,
-0.5803166627883911,
-0.3667389154434204,
0.15695872902870178,
0.46144357323646545,
-0.1771395057439804,
0.2738408148288727,
... | |
afford to have *any* accounts hacked; for such systems, there is no way you can justify having persistent logins.
**If you DO decide to implement persistent login cookies, this is how you do it:**
1. First, take some time to read [Paragon Initiative's article](https://paragonie.com/blog/2015/04/secure-authentication-... | [
0.20469479262828827,
0.153934508562088,
0.061817992478609085,
0.1603022813796997,
0.3128328025341034,
-0.13379086554050446,
0.2606913447380066,
-0.05545835196971893,
-0.15625151991844177,
-0.886481523513794,
0.385600745677948,
0.9097573161125183,
-0.0799732506275177,
-0.09206723421812057,
... | |
got their hands on your database, they could use the tokens to log in to any account, just as if they were cleartext login-password combinations. Therefore, use hashing (according to <https://security.stackexchange.com/a/63438/5002> a weak hash will do just fine for this purpose) when storing persistent login tokens.
... | [
0.5353406071662903,
-0.10739604383707047,
0.07202023267745972,
0.34225380420684814,
0.24190649390220642,
-0.25971052050590515,
0.2823202311992645,
0.021474819630384445,
-0.5197387337684631,
-0.26918312907218933,
0.21096017956733704,
0.4134982228279114,
-0.06168166548013687,
-0.111859083175... | |
"Wasilla High School"!
Even with user-specified questions, it is highly likely that most users will choose either:
* A 'standard' secret question like mother's maiden name or favorite pet
* A simple piece of trivia that anyone could lift from their blog, LinkedIn profile, or similar
* Any question that is easier to a... | [
0.29948678612709045,
-0.17163927853107452,
0.21782830357551575,
0.26454269886016846,
0.03141559660434723,
-0.48250892758369446,
0.32121458649635315,
0.3116028308868408,
-0.17905472218990326,
0.0507374070584774,
-0.0901956707239151,
-0.09337826818227768,
0.10481160134077072,
0.1519498676061... | |
is that they conveniently save the cost of a few support calls from users who can't access their email to get to a reactivation code. This at the expense of security and Sarah Palin's reputation. Worth it? Probably not.
PART IV: Forgotten Password Functionality
-----------------------------------------
I already ment... | [
0.18082734942436218,
0.05069168657064438,
0.15703491866588593,
0.2767123281955719,
0.24250565469264984,
0.09209460765123367,
0.5763548016548157,
-0.04960213974118233,
-0.36218640208244324,
-0.09297844767570496,
0.0315001979470253,
0.856705367565155,
0.19990351796150208,
0.01139040105044841... | |
to remember, which means the user must either change it or write it down - say, on a bright yellow Post-It on the edge of their monitor. Instead of setting a new password, just let users pick a new one right away - which is what they want to do anyway. (An exception to this might be if the users are universally using a... | [
0.3460043966770172,
-0.015400408767163754,
0.341427206993103,
0.09779924154281616,
0.27358588576316833,
-0.20658905804157257,
0.45649221539497375,
0.2079637050628662,
-0.322510302066803,
-0.7435687184333801,
-0.027230937033891678,
0.658446192741394,
0.07874175906181335,
-0.0829090401530265... | |
it MUST be hashed in case an attacker got their hands on your database. When a lost password code is requested, send the plaintext code to the user's email address, then hash it, save the hash in your database -- and *throw away the original*. Just like a password or a persistent login token.
A final note: always make... | [
0.10607126355171204,
0.1478053480386734,
0.266940712928772,
0.11269228905439377,
0.1188490092754364,
-0.11460539698600769,
0.46178701519966125,
0.011006202548742294,
-0.31964433193206787,
-0.4887333810329437,
-0.12051611393690109,
0.4546246826648712,
-0.04457622393965721,
0.116149365901947... | |
case-sensitive alphanumeric characters) is a good start, but consider adding the same throttling scheme that you do for the login form itself.
PART V: Checking Password Strength
----------------------------------
First, you'll want to read this small article for a reality check: [The 500 most common passwords](http:/... | [
-0.11852725595235825,
-0.02045506425201893,
0.5427528619766235,
0.3969467878341675,
0.20919635891914368,
-0.22019332647323608,
0.19626973569393158,
-0.03502345457673073,
-0.20788055658340454,
-0.43481507897377014,
-0.19162581861019135,
0.8223466873168945,
0.028592580929398537,
0.1465478390... | |
With no minimum password strength requirements, 2% of users use one of the top 20 most common passwords. Meaning: if an attacker gets just 20 attempts, 1 in 50 accounts on your website will be crackable.
Thwarting this requires calculating the entropy of a password and then applying a threshold. The National Institute... | [
-0.21267203986644745,
0.09685107320547104,
0.09323965013027191,
0.10618294030427933,
-0.08082837611436844,
-0.0007160318200476468,
0.5402998328208923,
-0.18269866704940796,
-0.09378274530172348,
-0.661452054977417,
-0.2062499225139618,
0.5200908184051514,
0.11960896849632263,
0.06920076161... | |
Simply calculating password strength and [showing a visual strength meter](https://blogs.dropbox.com/tech/2012/04/zxcvbn-realistic-password-strength-estimation/) to a user is good, but insufficient. Unless it is enforced, a lot of users will most likely ignore it.
And for a refreshing take on user-friendliness of high... | [
-0.02120819315314293,
-0.20438960194587708,
0.216720312833786,
0.20392069220542908,
-0.12673042714595795,
-0.2440011203289032,
0.3281624913215637,
-0.5056613683700562,
-0.11119028180837631,
-0.4502827525138855,
-0.07764344662427902,
0.8110529780387878,
0.030205506831407547,
-0.240145698189... | |
tables in that link, here's the list of them:
1. It takes *virtually no time* to crack a weak password, even if you're cracking it with an abacus
2. It takes *virtually no time* to crack an alphanumeric 9-character password if it is **case insensitive**
3. It takes *virtually no time* to crack an intricate, symbols-an... | [
-0.42716625332832336,
0.20683550834655762,
0.10953456908464432,
0.08989793062210083,
-0.12173443287611008,
0.18923978507518768,
0.49036741256713867,
-0.08578729629516602,
-0.46533486247062683,
-0.7445547580718994,
-0.321148157119751,
0.45977213978767395,
0.013722884468734264,
-0.2566199898... | |
were limited to one attempt per second!***
So what can we learn from these numbers? Well, lots, but we can focus on the most important part: the fact that preventing large numbers of rapid-fire successive login attempts (ie. the *brute force* attack) really isn't that difficult. But preventing it *right* isn't as easy... | [
0.14304669201374054,
0.06608716398477554,
0.4344373345375061,
0.3114873468875885,
-0.0866471454501152,
-0.033347051590681076,
0.7954061031341553,
-0.010756087489426136,
-0.30425167083740234,
-0.7143234014511108,
-0.30499038100242615,
0.4573097229003906,
-0.05214175954461098,
-0.11549408733... | |
I'm repeating myself here)
* **Locking accounts** and requiring email verification after N failed attempts (this is a [DoS](https://en.wikipedia.org/wiki/Denial-of-service_attack) attack waiting to happen)
* And finally, **login throttling**: that is, setting a time delay between attempts after N failed attempts (yes, ... | [
0.24314028024673462,
0.08399955928325653,
0.4569253623485565,
-0.146473690867424,
0.06415842473506927,
-0.0580185241997242,
1.1844635009765625,
-0.1745186299085617,
-0.6153773665428162,
-0.5822100639343262,
-0.2207861691713333,
0.47921222448349,
0.002629714785143733,
0.14484526216983795,
... | |
sec delay
* 5 failed attempts = 16 sec delay
* etc.
DoS attacking this scheme would be very impractical, since the resulting lockout time is slightly larger than the sum of the previous lockout times.
> To clarify: The delay is *not* a delay before returning the response to the browser. It is more like a timeout or r... | [
-0.015172864310443401,
-0.23515768349170685,
0.43844521045684814,
-0.029075678437948227,
0.09392638504505157,
-0.1659371554851532,
0.908240556716919,
-0.3629872500896454,
-0.3976159989833832,
-0.4632507860660553,
-0.3207376301288605,
0.4588833749294281,
-0.15800659358501434,
0.139974117279... | |
#2:** A medium length time delay that goes into effect after N failed attempts, like:
* 1-4 failed attempts = no delay
* 5 failed attempts = 15-30 min delay
DoS attacking this scheme would be quite impractical, but certainly doable. Also, it might be relevant to note that such a long delay can be very annoying for a ... | [
0.09477401524782181,
-0.1968659609556198,
0.4716191291809082,
-0.1476992666721344,
-0.07430966943502426,
-0.22009490430355072,
0.7534114122390747,
-0.4052373170852661,
-0.2908158004283905,
-0.38360095024108887,
-0.2602291405200958,
0.9041966199874878,
0.0042427908629179,
-0.189575210213661... | |
delay with a fixed upper bound, like:
* 1 failed attempt = 5 sec delay
* 2 failed attempts = 15 sec delay
* 3+ failed attempts = 45 sec delay
This final scheme was taken from the OWASP best-practices suggestions (link 1 from the MUST-READ list) and should be considered best practice, even if it is admittedly on the r... | [
0.02907049097120762,
-0.15877476334571838,
0.32532721757888794,
0.036060310900211334,
0.2735365033149719,
-0.007620958145707846,
0.48136216402053833,
-0.25946611166000366,
-0.443037748336792,
-0.4282294511795044,
-0.2424641102552414,
0.41648587584495544,
-0.11233717948198318,
-0.1201897710... | |
users 2-4 non-delayed password attempts before activating the throttling.*
DoS attacking this final login throttling scheme would be ***very*** impractical. And as a final touch, always allow persistent (cookie) logins (and/or a CAPTCHA-verified login form) to pass through, so legitimate users won't even be delayed *w... | [
-0.012842293828725815,
0.16088272631168365,
0.7574519515037537,
0.11806804686784744,
0.0010642349952831864,
-0.18923167884349823,
0.4846857786178589,
0.07167412340641022,
-0.24528083205223083,
-0.6238380670547485,
-0.36265331506729126,
0.6761906743049622,
-0.20646421611309052,
0.2401179522... | |
their activities':
* Distributing the attempts on a botnet to prevent IP address flagging
* Rather than picking one user and trying the 50.000 most common passwords (which they can't, because of our throttling), they will pick THE most common password and try it against 50.000 users instead. That way, not only do they... | [
0.5532025694847107,
-0.026791153475642204,
0.41127753257751465,
-0.02165662869811058,
0.015376503579318523,
-0.08463738858699799,
0.869541347026825,
0.049658384174108505,
-0.5823779702186584,
-0.5532810688018799,
-0.19762642681598663,
0.37551507353782654,
-0.09611841291189194,
-0.179707303... | |
best practice would be **logging the number of failed logins, system-wide**, and using a running average of your site's bad-login frequency as the basis for an upper limit that you then impose on all users.
Too abstract? Let me rephrase:
Say your site has had an average of 120 bad logins per day over the past 3 month... | [
0.2775818407535553,
0.16400471329689026,
0.2623576521873474,
0.02185625024139881,
0.05572870373725891,
-0.14024144411087036,
1.0419230461120605,
0.17655503749847412,
-0.662906289100647,
-0.6067965626716614,
-0.14113618433475494,
0.43019336462020874,
-0.3278115391731262,
0.08602536469697952... | |
better, monitor the rate of acceleration and trigger on a calculated threshold), it activates system-wide login throttling - meaning short delays for ALL users (still, with the exception of cookie logins and/or backup CAPTCHA logins).
I also posted a question with [more details and a really good discussion of how to a... | [
-0.0034758325200527906,
-0.0711851641535759,
0.2379545271396637,
0.22222165763378143,
-0.06676912307739258,
-0.1676284521818161,
0.3080863654613495,
-0.3648296296596527,
-0.20798052847385406,
-0.573032021522522,
-0.2770441472530365,
0.7711486220359802,
-0.14737293124198914,
-0.101501904428... | |
out-of-band factors such as single-use codes received from a phone call, SMS message, app, or dongle. Several providers offer two-factor authentication services.
Authentication can be completely delegated to a single-sign-on service, where another provider handles collecting credentials. This pushes the problem to a t... | [
0.0694560781121254,
-0.0331108383834362,
0.5138183832168579,
0.07596862316131592,
0.14624923467636108,
-0.428874671459198,
0.23841974139213562,
-0.5725724101066589,
-0.10640627145767212,
-0.4476015269756317,
-0.30056220293045044,
0.4441419839859009,
-0.21459665894508362,
-0.533177375793457... | |
era of Facebook (very readable Berkeley research paper)](https://cups.cs.cmu.edu/soups/2008/proceedings/p13Rabkin.pdf) | [
-0.26075080037117004,
-0.2740252912044525,
-0.0279899463057518,
0.027741655707359314,
-0.17707166075706482,
-0.16844291985034943,
0.1468452662229538,
0.19811564683914185,
-0.8765004277229309,
-0.5172766447067261,
-0.15876953303813934,
-0.08667632192373276,
-0.13480208814144135,
-0.22133757... | |
I would like to test a function with a tuple from a set of fringe cases and normal values. For example, while testing a function which returns `true` whenever given three lengths that form a valid triangle, I would have specific cases, negative / small / large numbers, values close-to being overflowed, etc.; what is mo... | [
0.3709832429885864,
0.1377440243959427,
-0.012933465652167797,
0.032432738691568375,
-0.2481953650712967,
0.37501034140586853,
0.36476221680641174,
-0.4704310894012451,
-0.10588415712118149,
-0.5057061314582825,
-0.09082762151956558,
0.2231709510087967,
-0.17408055067062378,
0.049194082617... | |
a challenge for people here! --will post my answer later on.*
Absolutely, especially dealing with lots of these permutations/combinations I can definitely see that the first pass would be an issue.
Interesting implementation in python, though I wrote a nice one in C and Ocaml based on "Algorithm 515" (see below). He w... | [
-0.003284446196630597,
0.017260350286960602,
0.16235709190368652,
0.20630906522274017,
-0.2214830219745636,
-0.05035114660859108,
0.07775429636240005,
-0.03072407841682434,
-0.36146923899650574,
-0.5775045156478882,
0.06712400913238525,
0.3856951594352722,
-0.18785974383354187,
-0.36667999... | |
nice implementations of the ones mentioned in Knuth 4th volume fascicle 2. I'll an explanation of how this works to the reader. Though if someone is curious, I wouldn't object to writing something up.
```
/** [combination c n p x]
* get the [x]th lexicographically ordered set of [p] elements in [n]
* output is in [c... | [
-0.07917463779449463,
-0.03602347895503044,
0.3652041554450989,
-0.061928197741508484,
-0.11876033246517181,
0.11252900213003159,
0.3053654730319977,
-0.4352937340736389,
-0.17980772256851196,
-0.5691519975662231,
-0.09645383059978485,
0.5290946364402771,
-0.32358795404434204,
-0.217169597... | |
do {
c[i]++;
r = choose(n-c[i],p-(i+1));
k = k + r;
} while(k < x);
k = k - r;
}
c[p-1] = c[p-2] + x - k;
}
```
~"Algorithm 515: Generation of a Vector from the Lexicographical Index"; Buckles, B. P., and Lybanon, M. ACM Transactions on | [
-0.4661000669002533,
-0.08662482351064682,
-0.07111882418394089,
-0.01846289075911045,
0.08365461975336075,
0.5111071467399597,
-0.06839189678430557,
-0.5670270323753357,
-0.04398774355649948,
-0.3896195888519287,
-0.3753832280635834,
0.45402634143829346,
-0.46319255232810974,
-0.162613660... | |
Mathematical Software, Vol. 3, No. 2, June 1977. | [
-0.7335292100906372,
-0.061403919011354446,
0.1757843792438507,
-0.11374242603778839,
-0.040612366050481796,
0.11879425495862961,
0.08319538831710815,
-0.2892390489578247,
0.010085704736411572,
-0.0033438014797866344,
-0.30681708455085754,
0.7403502464294434,
0.00890745222568512,
-0.284633... | |
I want to print the first 10000 prime numbers.
Can anyone give me the most efficient code for this?
Clarifications:
1. It does not matter if your code is inefficient for n >10000.
2. The size of the code does not matter.
3. You cannot just hard code the values in any manner.
[The Sieve of Atkin](http://en.wikipedia.or... | [
0.13942851126194,
-0.004167196340858936,
0.20387248694896698,
0.053491752594709396,
-0.32485586404800415,
0.5113338232040405,
0.3233569860458374,
-0.32484349608421326,
-0.14739473164081573,
-0.5968269109725952,
0.12676139175891876,
0.5281039476394653,
-0.26085785031318665,
0.12296049296855... | |
[Resource for my statement](http://primes.utm.edu/notes/faq/six.html) | [
0.7138174772262573,
0.14910000562667847,
0.11058378964662552,
-0.08562695980072021,
0.07547694444656372,
0.27733004093170166,
0.21611244976520538,
-0.016024233773350716,
-0.04766341298818588,
-0.4431362450122833,
0.1335214525461197,
0.478677362203598,
-0.23282629251480103,
0.40508615970611... | |
I would like the version property of my application to be incremented for each build but I'm not sure on how to enable this functionality in Visual Studio (2005/2008). I have tried to specify the AssemblyVersion as 1.0.\* but it doesn't get me exactly what I want.
I'm also using a settings file and in earlier attempt... | [
0.28833118081092834,
0.21219098567962646,
0.46221330761909485,
-0.6257929801940918,
-0.312326580286026,
0.04285424202680588,
0.519008994102478,
0.026113135740160942,
-0.35176366567611694,
-0.6432396769523621,
0.08749046176671982,
0.7212860584259033,
-0.42128077149391174,
0.0557720623910427... | |
finds a problem I can log the version they are using as well as tell them to upgrade if they have an old release.
A short explanation of how the versioning works would also be appreciated. When does the build and revision number get incremented?
With the "Built in" stuff, you can't, as using 1.0.\* or 1.0.0.\* will re... | [
0.19982367753982544,
0.16577944159507751,
0.4741716980934143,
-0.08880139887332916,
0.2438828945159912,
-0.24058879911899567,
0.3413156569004059,
0.04804655909538269,
-0.5159149765968323,
-0.8676158785820007,
-0.2652541697025299,
0.8159223198890686,
-0.18279212713241577,
0.1896441429853439... | |
the build number.
There are 2 Gotchas:
1. Each of the 4 numbers in the Version string is limited to 65535. This is a Windows Limitation and unlikely to get fixed.
* [Why are build numbers limited to 65535?](http://blogs.msdn.com/msbuild/archive/2007/01/03/why-are-build-numbers-limited-to-65535.aspx)
2. Using with wi... | [
0.04364645108580589,
0.1368645876646042,
0.6378651857376099,
-0.3585399091243744,
-0.12352863699197769,
0.0747729241847992,
0.6554841995239258,
-0.25769004225730896,
-0.39582905173301697,
-0.4433371126651764,
-0.38340866565704346,
0.4511652886867523,
-0.2714816927909851,
0.2515759170055389... | |
people (for example Delphi Developers who are used to Major.Minor.Release.Build) might expect.
In .net, it's Major.Minor.Build.Revision. | [
0.11221632361412048,
-0.20317614078521729,
0.18229053914546967,
-0.3215096890926361,
0.035787586122751236,
-0.668507993221283,
0.16107237339019775,
0.23220615088939667,
-0.22753363847732544,
-0.5373964309692383,
-0.5099143981933594,
0.7238155007362366,
-0.13519395887851715,
0.0764838233590... | |
I've been having trouble getting my ASP.NET application to automatically log users into the Intranet site I'm building. No matter the googling or the experimentation I applied, there is always a login box displayed by IE7.
I've got Windows authentication mode set in the Web.config, disabled anonymous access and config... | [
0.413133442401886,
0.28948482871055603,
0.09722897410392761,
-0.11464492976665497,
-0.08643179386854172,
-0.16967733204364777,
0.643929123878479,
0.3477479815483093,
-0.32450157403945923,
-0.8046095371246338,
-0.15224382281303406,
0.61835116147995,
-0.03738979622721672,
0.27421170473098755... | |
Active Directory is set up incorrectly, or it could just be me missing something very simple. Please note that I don't want to impersonate the user, I just need to know that the IPrincipal.Name property matches that of a valid record in my user database, hence authenticating the user to my application.
To this end, it... | [
0.2874602973461151,
0.15562252700328827,
0.5190608501434326,
0.17972305417060852,
-0.027242371812462807,
-0.4824121296405792,
0.338690847158432,
0.04218073934316635,
-0.20689158141613007,
-0.6677961945533752,
0.038531213998794556,
0.6103319525718689,
-0.3350224196910858,
0.1895471513271331... | |
issue? I assume your users have integrated authentication enabled in IE7? (Tools -> Internet Options -> Advanced -> Security). This is enabled by default.
Also, is your site correctly recognized by IE7 as being in the Local Intranet zone? The IE7 default is to allow automatic logon only in that zone, so users would be... | [
0.041213274002075195,
-0.08498066663742065,
0.6028229594230652,
-0.3026679754257202,
0.3240528404712677,
-0.49275749921798706,
0.5133795738220215,
0.22396160662174225,
-0.4256393611431122,
-0.7118021845817566,
-0.3449307382106781,
0.3950777053833008,
-0.37010714411735535,
-0.09491812437772... | |
This is ASP classic, not .Net. We have to get a way to SFTP into a server to upload and download a couple of files, kicked off by a user.
What have other people used to do SFTP in ASP classic? Not necessarily opposed to purchasing a control.
If you have the ability to use WScript.Shell then you can just execute pscp.e... | [
0.4383351504802704,
-0.4067825376987457,
0.23300135135650635,
0.06545349210500717,
-0.16739895939826965,
-0.3355277478694916,
0.003404619637876749,
-0.05559517815709114,
-0.397230327129364,
-0.42596134543418884,
0.06751643866300583,
0.3027692139148712,
-0.4564627408981323,
-0.0832824185490... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.