text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
I have a couple Windows computers on my network that will be running a python script. A different set of configuration options should be used in the script depending on which computer is running this script.
How would I get that computer name in the python script?
Let's say the script was running on a computer named ... | [
0.17847499251365662,
0.19032928347587585,
0.4780007600784302,
0.1700400412082672,
0.030079424381256104,
0.08112557232379913,
0.19850316643714905,
-0.10701936483383179,
-0.1970890462398529,
-0.6903749108314514,
0.1054285392165184,
0.5091193318367004,
-0.38754257559776306,
0.1335490345954895... | |
I am working with Google App Engine and Python.
I have a model with Items.
Immediately after I insert an item with item.put()
I want to get it's key and redirect to a page using this key.
Something like:
```
redirectUrl = "/view/key/%s/" % item.key
self.redirect(redirectUrl)
```
Thanks for the initiative Sc... | [
0.14829280972480774,
0.02804679237306118,
0.5956497192382812,
-0.128841370344162,
-0.23838099837303162,
-0.19316793978214264,
0.4655038118362427,
-0.20674555003643036,
-0.2029760777950287,
-0.8472602367401123,
-0.11362667381763458,
0.7506062388420105,
-0.37678876519203186,
0.30313351750373... | |
I need to use .htaccess file to replace a word in a URL; something like this:
Example URL:
```
http://example.com/oldword/test-page.html
```
Redirect to:
```
http://example.com/newword/test-page.html
```
How can I use mod\_rewrite to redirect every URL containing **/oldword/** to the same URL after replacing... | [
0.39402109384536743,
0.11799439787864685,
0.4080236852169037,
0.010755756869912148,
0.03643205389380455,
-0.14745405316352844,
0.3533632457256317,
-0.4408840537071228,
0.16822932660579681,
-0.7357263565063477,
0.15193727612495422,
0.6505442261695862,
-0.1608603447675705,
-0.036584455519914... | |
**problem**
I'm using [LilyPond](http://lilypond.org/web/) to typeset sheet music for a church choir to perform. Depending on who is available on any given week, songs will be played in various keys. We have an amazing pianist who can play anything we throw at her and the guitarists will typically pencil in alternate ... | [
0.2051098644733429,
0.31847912073135376,
0.14996343851089478,
-0.1866988092660904,
0.24341322481632233,
0.5632774829864502,
0.38247010111808777,
-0.05212091654539108,
-0.4427242577075958,
-0.3198665678501129,
0.10634928196668625,
0.6179037094116211,
-0.1888251006603241,
-0.1416436135768890... | |
g g
a a g2
f f e e
d d c2 }
```
I want the ability to transpose this automatically, so if I want the whole thing in 'G' I wrap the song in a \transpose call like so:
```
melody = \transpose c g \relative c' {
c c g g
a a g2
f f e e
d d c2 }
```
What I really want is to substitute someth... | [
0.020584797486662865,
-0.034919705241918564,
0.18837876617908478,
-0.06552981585264206,
-0.1756308227777481,
0.06427580863237381,
0.14271296560764313,
-0.1763117015361786,
-0.21506868302822113,
-0.3801286220550537,
-0.07427328824996948,
0.5831686854362488,
-0.4210676848888397,
0.0400891713... | |
Simple LilyPond variables don't seem to work here, and so far I've been unsuccessful in defining a scheme function to do this.
What I've resorted to for the moment is taking the above file, call it twinkle.ly and turning it into an M4 script called twinkle.ly.m4, the contents of which look like this:
```
melody = \tr... | [
0.1869540959596634,
-0.16247162222862244,
0.47536608576774597,
0.0125960074365139,
0.12300686538219452,
0.2923332452774048,
0.269387423992157,
0.16946417093276978,
-0.07987500727176666,
-0.39242926239967346,
0.10217540711164474,
0.515855610370636,
-0.40897801518440247,
0.1505691558122635,
... | |
every song I have and every key I'm interested in.
**question**
There's got to be a better way of going about this. Given that Lilypond supports embedded scheme, I would prefer to not use a macro preprocessed on it. Has anybody else come up with a solution to this same problem?
You can refer to the melody variable and... | [
0.2218378335237503,
-0.08534073829650879,
0.4249650835990906,
0.22762861847877502,
0.30979040265083313,
0.21330249309539795,
-0.01890723966062069,
-0.07645885646343231,
-0.235166534781456,
-0.4474549889564514,
-0.052404243499040604,
0.4487244784832001,
-0.1627514362335205,
0.06852307915687... | |
blocks. | [
0.20607821643352509,
0.5094565153121948,
0.04545214772224426,
0.08716372400522232,
-0.06773771345615387,
-0.010715581476688385,
-0.12852007150650024,
-0.21350400149822235,
-0.16577927768230438,
-0.446571946144104,
-0.12272261828184128,
0.05929628759622574,
-0.14929021894931793,
0.287954479... | |
We are using a Subversion server at my job for source control. I was thinking that rather than keeping up with my own branch, I would run Mercurial on my workstation, commit locally, and then commit to the Subversion trunk whenever I’m done with whatever feature I’m working on.
From my understanding of DVCS this is th... | [
0.4232245683670044,
-0.2538415789604187,
0.19085732102394104,
-0.09409135580062866,
-0.0664471685886383,
-0.2115493267774582,
0.2413298487663269,
0.40114039182662964,
-0.21896253526210785,
-0.47995829582214355,
-0.16929936408996582,
0.37374454736709595,
-0.12705709040164948,
0.044015109539... | |
I am learning udp in the next few days. This weekend I am going to be in one of those 72hour competition and I would like to have my UDP code work online by the end of it. During the competition I wont have any internet (so no calling someone and having them test).
I know of some of the problems about UDP like packet... | [
0.6381669044494629,
0.13930481672286987,
0.40098699927330017,
-0.03426239266991615,
-0.09092379361391068,
-0.5131359100341797,
0.33295732736587524,
-0.006297518033534288,
-0.2999504804611206,
-0.7997353076934814,
0.1534813642501831,
0.33914345502853394,
0.16137295961380005,
0.1170986667275... | |
some of the things that happen to you after moving from LAN to internet?
NOTE: I will be running some code ASAP and testing it online. Hopefully what my end code will look like but I may also miss a few things.
Have you looked at [this page in Mercurial wiki](https://www.mercurial-scm.org/wiki/WorkingWithSubversion) ? | [
0.6239139437675476,
-0.10696909576654434,
0.25348129868507385,
0.21203608810901642,
0.1711825430393219,
-0.6104916334152222,
0.2989995777606964,
0.5641176700592041,
-0.2230098992586136,
-0.7784830331802368,
0.01886568032205105,
0.3768506348133087,
0.19677935540676117,
0.06441358476877213,
... | |
Many types in WPF derive from `Freezable`. It provides immutability to mutable POCO objects and allows for improved performance in certain situations.
So my question is, how can I freeze objects in XAML markup?
(Note that I have posted a [similar but different question](https://stackoverflow.com/questions/799911/) to... | [
-0.1330122947692871,
-0.2745409309864044,
0.4780028164386749,
-0.07120800018310547,
-0.14496701955795288,
0.11550019681453705,
-0.09634983539581299,
-0.6663921475410461,
-0.558290421962738,
-0.35464027523994446,
-0.1556994467973709,
0.17482328414916992,
-0.2903467118740082,
-0.052980761975... | |
<!-- This brush is frozen -->
<SolidColorBrush x:Key="MyBrush" po:Freeze="True" Color="Red" />
</Page.Resources>
<!-- Use the frozen brush -->
<Button Background="{StaticResource MyBrush}">Click Me</Button>
</Page>
```
Source: [Freezable Objects Overview](http://msdn.microsoft.com/en-us/library/ms750509.a... | [
-0.08758601546287537,
-0.21503864228725433,
0.5355452299118042,
0.0795777440071106,
-0.03869136422872543,
0.15271826088428497,
0.2363903820514679,
-0.12572234869003296,
-0.18617503345012665,
-0.33002525568008423,
0.09737978130578995,
-0.09686360508203506,
-0.19838254153728485,
0.5414249300... | |
I want to develop a scalable pub-sub system
it has to be on port 80
firewalls \ NAT should just work
and I cannot deploy a WCF client ( server can be WCF if needed )
any thouhts \ suggestions on how to get going
Select the text you wish to save, in either line visual or block visual mode, and
```
:w new.txt
```
That... | [
0.5074359178543091,
0.16675017774105072,
0.6505199670791626,
-0.24574604630470276,
0.008395286276936531,
0.006027142982929945,
0.4232786297798157,
0.007556265685707331,
-0.1298411786556244,
-0.812185525894165,
-0.08411911875009537,
0.6367663741111755,
-0.2802973985671997,
0.067024528980255... | |
get
```
:'<,'>w new.txt
```
...and press enter. | [
0.10882057994604111,
0.254624605178833,
0.30941784381866455,
-0.10628444701433182,
0.4108145236968994,
-0.30984872579574585,
0.2653694152832031,
0.15725207328796387,
-0.014143765904009342,
-0.5873098373413086,
-0.5481561422348022,
0.5072507858276367,
-0.3966582417488098,
0.3361880779266357... | |
Many types in WPF derive from `Freezable`. It provides immutability to mutable POCO objects and, apparently, allows for improved performance in certain situations.
Has anyone found that freezing objects within their WPF application has greatly improved performance? If so, then which items gave the biggest performance ... | [
0.18318064510822296,
-0.2726311683654785,
-0.04158822074532509,
0.15273377299308777,
-0.3651096224784851,
-0.18615548312664032,
0.2138664871454239,
-0.3509134352207184,
-0.5583723783493042,
-0.46697166562080383,
-0.12236277759075165,
-0.02455201931297779,
-0.44214916229248047,
0.1505758315... | |
them, and then pass them to the UI thread. It is nice that WPF does not copy the image to freeze it, but the ability to do all this preparation on a background thread was the key benefit for me.
From what I understand, all visuals need to be frozen so they can be safely rendered by the WPF render thread. If you rende... | [
0.3947029113769531,
-0.23470282554626465,
0.6617098450660706,
0.30296388268470764,
-0.08101724833250046,
0.20428697764873505,
0.08381596207618713,
0.12210187315940857,
-0.11871740967035294,
-0.8399211168289185,
-0.07974480837583542,
0.2099599987268448,
-0.26914137601852417,
0.3820581436157... | |
even get copied repeatedly if WPF is not aware wether the object is changed from the last time it was rendered. Frozen objects eliminate the need for all this copying. | [
-0.004489922896027565,
-0.23397551476955414,
0.33356723189353943,
0.5605633854866028,
0.02330620586872101,
-0.16601894795894623,
0.18890932202339172,
0.13794025778770447,
-0.5532478094100952,
-0.5904166102409363,
-0.14960992336273193,
-0.02397792600095272,
-0.15272516012191772,
0.332261532... | |
I have read my first book on c# and feel completely clueless about LINQ. Please suggest reader-friendly linq material.
Thanks
[LINQ in Action](http://linqinaction.net/) has been recommnded to me by several people. | [
0.30420994758605957,
-0.09719748795032501,
0.16876830160617828,
0.2069355547428131,
-0.43847760558128357,
-0.40963828563690186,
-0.14441804587841034,
0.22207047045230865,
-0.18570221960544586,
-0.4086739718914032,
-0.4635680913925171,
0.10665712505578995,
0.3413350284099579,
-0.42901086807... | |
I'm trying to learn F#, but since I have never done any functional programming or taken a class in it, I find it very hard to generalize the trivial fibonacci or factorial examples into how I would do something usable.
So, what simple but nontrivial non-trivial and usable F# code is there on the net?
I like to use it ... | [
0.2947843670845032,
0.09031186252832413,
0.13384664058685303,
0.16747722029685974,
-0.1272229254245758,
-0.08994884043931961,
0.14776919782161713,
0.11277321726083755,
-0.31096622347831726,
-0.6606900691986084,
-0.09857857972383499,
0.39195117354393005,
-0.25840118527412415,
-0.33639356493... | |
of basic filters (that processes the subject, etc.) and higher-order logic filters that combine other filters with AND/OR/NOT operators.
The implementation simplifies such "expressions" by converting them to CNF, collecting by type and using special rules (like a < 5 && a < 10 => a < 5, etc.)
On top of this I createt a... | [
0.2150077521800995,
-0.13266035914421082,
0.2574117183685303,
-0.05041888728737831,
-0.11680527031421661,
-0.059881873428821564,
0.04222331941127777,
-0.5942540168762207,
0.0033715786412358284,
-0.5215540528297424,
0.00966711901128292,
0.6178832650184631,
-0.7542585730552673,
-0.3395080566... | |
I have a script that uses `$(document).ready`, but it doesn't use anything else from jQuery. I'd like to lighten it up by removing the jQuery dependency.
How can I implement my own `$(document).ready` functionality without using jQuery? I know that using `window.onload` will not be the same, as `window.onload` fires a... | [
0.11063368618488312,
-0.02656959556043148,
0.5681352019309998,
0.028301458805799484,
0.01669919863343239,
-0.27677690982818604,
0.12766562402248383,
-0.18153837323188782,
-0.04962141811847687,
-0.793761134147644,
-0.317608118057251,
0.7431730031967163,
-0.21554331481456757,
0.1819982826709... | |
readyBound = true;
// Mozilla, Opera and webkit nightlies currently support this event
if ( document.addEventListener ) {
// Use the handy event callback
document.addEventListener( "DOMContentLoaded", function(){
document.removeEventListener( "DOMContentLoaded", arguments.callee, fa... | [
0.03274426609277725,
-0.37020888924598694,
0.3038455545902252,
-0.15716706216335297,
0.3412116467952728,
-0.13724906742572784,
0.49033719301223755,
-0.25110599398612976,
-0.2232903689146042,
-0.4037550687789917,
-0.5643755197525024,
0.5879643559455872,
-0.4382980763912201,
-0.0462080240249... | |
} else if ( document.attachEvent ) {
// ensure firing before onload,
// maybe late but safe also for iframes
document.attachEvent("onreadystatechange", function(){
if ( document.readyState === "complete" ) {
document.detachEvent( "onreadystatechange", arguments.callee... | [
0.0510067455470562,
0.03226302191615105,
0.4631699025630951,
-0.1824238896369934,
0.7858546376228333,
0.08435462415218353,
0.4157578945159912,
-0.478938490152359,
0.35440337657928467,
-0.32884475588798523,
-0.5536510348320007,
1.0296084880828857,
-0.24397633969783783,
0.06747325509786606,
... | |
}
});
// If IE and not an iframe
// continually check to see if the document is ready
if ( document.documentElement.doScroll && window == window.top ) (function(){
if ( jQuery.isReady ) return;
try { | [
0.001806378597393632,
-0.1495589166879654,
0.8208397626876831,
-0.15174110233783722,
0.5146423578262329,
-0.11531698703765869,
0.5063949227333069,
-0.31347256898880005,
0.030975759029388428,
-0.6879488825798035,
-0.5193719267845154,
0.6278683543205261,
-0.029637785628437996,
0.119550257921... | |
// If IE is used, use the trick by Diego Perini
// http://javascript.nwbox.com/IEContentLoaded/
document.documentElement.doScroll("left");
} catch( error ) {
setTimeout( arguments.callee, 0 ); | [
0.21553896367549896,
-0.17423798143863678,
0.41636767983436584,
0.030657285824418068,
0.11665113270282745,
0.0025948730763047934,
0.39754199981689453,
-0.5830073952674866,
-0.05095434561371803,
-0.29425424337387085,
-0.12626485526561737,
0.4596696197986603,
-0.3285404145717621,
-0.04742770... | |
return;
}
// and execute any waiting functions
jQuery.ready();
})();
}
// A fallback to window.onload, that will always work
jQuery.event.add( window, "load", jQuery.ready );
}
``` | [
-0.05148337036371231,
-0.40202611684799194,
0.4358217418193817,
-0.19421693682670593,
0.39125722646713257,
-0.113253153860569,
0.12419933825731277,
-0.04368263855576515,
-0.18648777902126312,
-0.42204686999320984,
-0.558771014213562,
0.7183442115783691,
-0.3225586414337158,
0.1296417713165... | |
I'm creating a grid based game in Java and I want to implement game recording and playback. I'm not sure how to do this, although I've considered 2 ideas:
1. Several times every second, I'd record the entire game state. To play it back, I write a renderer to read the states and try to create a visual representation. W... | [
0.43852680921554565,
-0.13172663748264313,
-0.034161243587732315,
-0.002710747066885233,
-0.0007840433390811086,
-0.11764860153198242,
0.09957294911146164,
-0.2901178300380707,
0.15386009216308594,
-0.7310476899147034,
0.3989887833595276,
0.47302502393722534,
-0.22353994846343994,
0.165721... | |
play back with less lag. However, the slightest error at the start of the game (For example, shooting 1 millisecond later) would result in a vastly different game state several minutes into the game.
What, then, is the best way to implement game playback?
Edit- I'm not sure exactly how deterministic my game is, so I'... | [
0.041308872401714325,
0.29253503680229187,
0.2612079381942749,
0.2602393329143524,
0.1701955944299698,
0.04646153748035431,
0.1138252317905426,
-0.49265581369400024,
-0.052862346172332764,
-0.4185692369937897,
0.08643320947885513,
0.7938264012336731,
0.07621870934963226,
-0.189941287040710... | |
mind. The [command pattern](http://en.wikipedia.org/wiki/Command_pattern) can be used to achieve such a game infrastructure.
For example:
```
public interface Command{
void execute();
}
public class MoveRightCommand implements Command {
private Grid theGrid;
private Player thePlayer;
public MoveRightCom... | [
0.06579665839672089,
-0.377951055765152,
0.1566547304391861,
-0.15178583562374115,
0.249559223651886,
-0.19489969313144684,
-0.11139710992574692,
-0.1793590486049652,
-0.13823442161083221,
-0.8430946469306946,
-0.11025026440620422,
0.8635298013687134,
-0.5018230080604553,
0.136906921863555... | |
user presses a keyboard button, moves the mouse or without a trigger with the playback mechanism. The command object can have a time-stamp value (relative to the beginning of the playback) for precise playback... | [
-0.1628318578004837,
0.13186854124069214,
0.7103234529495239,
0.36789003014564514,
0.38366907835006714,
-0.017509954050183296,
-0.04882987216114998,
-0.2007826715707779,
-0.08713413029909134,
-0.30225318670272827,
-0.5423607230186462,
0.878723680973053,
0.2468481957912445,
0.16462224721908... | |
I have a python program that reads floating point values using the following regular expression
```
(-?\d+\.\d+)
```
once I extract the value using float(match.group(1)), I get the actual floating point number. However, I am not able to distinguish if the number was 1.2345678 or 1.234 or 1.2340000.
The problem I a... | [
-0.013301708735525608,
0.39528775215148926,
0.3649068772792816,
-0.12667091190814972,
-0.154536634683609,
0.19359426200389862,
-0.25212013721466064,
-0.2619200348854065,
-0.20943017303943634,
-0.297913521528244,
0.08888578414916992,
0.3183238208293915,
-0.03962588310241699,
0.1767742037773... | |
as
```
print "%"+str(total_len)+"."+str(fractional_len)+"f" % value
```
but maybe you know a standard way to achieve the same result ?
You method is basically correct.
String formatting has a less often used `*` operator you can put for the formatting sizes, here's some code:
```
import re
def parse_float(str):
... | [
-0.09325307607650757,
0.18788571655750275,
0.7585620880126953,
-0.12310425937175751,
-0.13475587964057922,
0.2294437289237976,
0.22970759868621826,
-0.7226133346557617,
-0.5094611644744873,
-0.287647545337677,
-0.3417278826236725,
0.5441120862960815,
-0.1244940236210823,
-0.032587017863988... | |
What is the simplest way to remove all the carriage returns `\r` from a file in Unix?
I'm going to assume you mean carriage returns (`CR`, `"\r"`, `0x0d`) at the *ends* of lines rather than just blindly within a file (you may have them in the middle of strings for all I know). Using this test file with a `CR` at the en... | [
-0.3140545189380646,
0.20950034260749817,
0.45135873556137085,
-0.05867971107363701,
0.08053164929151535,
-0.004103943705558777,
0.18209464848041534,
0.05151459202170372,
-0.16003058850765228,
-0.5072245597839355,
-0.11087324470281601,
0.4295886754989624,
-0.35314077138900757,
0.4424629807... | |
o d b y e \n
0000017
```
`dos2unix` is the way to go if it's installed on your system:
```
$ cat infile | dos2unix -U | od -c
0000000 h e l l o \n g o o d b y e \n
0000016
```
If for some reason `dos2unix` is not available to you, then `sed` will do it:
```
$ cat infile | sed 's... | [
0.046125758439302444,
0.12760454416275024,
0.6085167527198792,
-0.21662455797195435,
0.5472447276115417,
0.014404666610062122,
0.2909030318260193,
-0.027969932183623314,
0.019561218097805977,
-0.5911217927932739,
-0.5215210318565369,
0.5931118726730347,
-0.11061784625053406,
0.064184233546... | |
e l l o \n g o o d b y e \n
0000016
```
If for some reason `sed` is not available to you, then `ed` will do it, in a complicated way:
```
$ echo ',s/\r\n/\n/
> w !cat
> Q' | ed infile 2>/dev/null | od -c
0000000 h e l l o \n g o o d b | [
0.06128181144595146,
0.17422933876514435,
0.3218314051628113,
-0.24606719613075256,
0.2165040820837021,
0.0909985676407814,
0.4443886876106262,
-0.2103281170129776,
0.02528284303843975,
-0.44837915897369385,
-0.5670530796051025,
0.396868497133255,
-0.5373947620391846,
0.17476046085357666,
... | |
y e \n
0000016
```
If you don't have *any* of those tools installed on your box, you've got bigger problems than trying to convert files :-) | [
0.14744138717651367,
0.5291991829872131,
0.001303270342759788,
0.08857100456953049,
0.314799427986145,
0.11824896931648254,
0.35289591550827026,
0.0058325729332864285,
-0.15238341689109802,
-0.7331407070159912,
-0.3991747200489044,
0.5397202968597412,
-0.23918229341506958,
0.26506420969963... | |
Say I have two arrays, items and removeItems and I wanted any values found in removeItems to be removed from items.
The brute force mechanism would probably be:
```
var animals = ["cow","dog","frog","cat","whale","salmon","zebra","tuna"];
var nonMammals = ["salmon","frog","tuna","spider"];
var mammals = [];
var isMam... | [
0.004244523122906685,
0.025193387642502785,
0.273660272359848,
-0.22179976105690002,
-0.009255746379494667,
0.336687833070755,
0.48836955428123474,
-0.4740365743637085,
-0.26516634225845337,
-0.3010667562484741,
-0.16620829701423645,
0.4812832772731781,
-0.4621487855911255,
0.2677154541015... | |
* N)`.
Probably you could do better sorting the `animals` array first, then doing a binary search. You'll be able to reduce to `O(N * log N)` - well, that's if `log N < M` anyway.
Anyway, if you're working with JS and that runs client-side, then just try to keep amount of data at minimum, or their browsers will yell ... | [
0.3385281264781952,
-0.03357120230793953,
-0.03907165676355362,
-0.212051659822464,
-0.060721784830093384,
0.038060639053583145,
0.2866385579109192,
0.0600162036716938,
-0.4119165539741516,
-0.6238881945610046,
-0.21353140473365784,
0.5575399398803711,
-0.2789072096347809,
0.12867072224617... | |
What is the cleanest way to validate an email address that a user enters on iOS 2.0?
**NOTE**: This is a historical question that is specific to iOS 2.0 and due to its age and how many other questions are linked to it it cannot be retired and MUST NOT be changed to a "modern" question.
The best solution I have found s... | [
0.21681265532970428,
-0.03056364879012108,
0.4613450765609741,
0.09053145349025726,
0.09442553669214249,
-0.046837300062179565,
0.5122455358505249,
-0.19286474585533142,
-0.1533576101064682,
-0.5266215801239014,
-0.029819725081324577,
0.2638126313686371,
-0.33518972992897034,
-0.2510571181... | |
of the regular expression email validation logic will work. | [
0.24923178553581238,
0.11890687793493271,
0.3994951546192169,
0.2799789607524872,
0.05482706427574158,
-0.19699284434318542,
0.4746140241622925,
0.09050494432449341,
0.11588939279317856,
-0.3106590509414673,
-0.15637809038162231,
0.5290246605873108,
-0.2988743185997009,
-0.3437531590461731... | |
> **Possible Duplicate:**
>
> [Why is there not a ForEach extension method on the IEnumerable interface?](https://stackoverflow.com/questions/101265/why-is-there-not-a-foreach-extension-method-on-the-ienumerable-interface)
I've noticed when writing LINQ-y code that `.ForEach()` is a nice idiom to use. For example, ... | [
0.01907600648701191,
0.2583906054496765,
0.6493518948554993,
-0.33737218379974365,
0.1509905606508255,
0.2380884289741516,
0.021309660747647285,
-0.42513948678970337,
-0.21507887542247772,
-0.4539770483970642,
-0.3014103174209595,
0.5539259910583496,
-0.3359822630882263,
-0.039676245301961... | |
{
if (pos == 0) return new { Word = word, Leading = string.Empty };
if (pos == wordList.Count - 1) return new { Word = word, Leading = " and " };
return new { Word = word, Leading = ", " };
});
wordsAndSeparators.ToList().ForEach(v => sb.Append(v.Leading).Append(v.Word))... | [
-0.27916067838668823,
-0.29760462045669556,
0.6251130104064941,
-0.6807727813720703,
0.10710980743169785,
0.23698578774929047,
0.7460313439369202,
-0.7318577766418457,
-0.18712253868579865,
-0.7109341621398926,
-0.5947936773300171,
0.4057328701019287,
-0.19790594279766083,
0.25735652446746... | |
return sb.ToString();
}
```
Note the interjected `.ToList()` before the `.ForEach()` on the second to last line.
Why is it that `.ForEach()` isn't available as an extension method on `IEnumerable<T>`? With an example like this, it just seems weird.
Because [`ForEach(Action)`](http://msdn.microsoft.com/en-us/library/... | [
0.20678597688674927,
-0.1664435863494873,
0.3775123059749603,
-0.38179463148117065,
0.08144522458314896,
-0.1556795984506607,
0.28422340750694275,
-0.37237733602523804,
-0.14794600009918213,
-0.5760810971260071,
-0.3363465666770935,
0.6068630814552307,
-0.46677589416503906,
0.1354093402624... | |
public static void ForEach<T>(this IEnumerable<T> source, Action<T> action)
{
foreach (T item in source)
action(item);
}
}
``` | [
-0.0785505548119545,
-0.13024650514125824,
0.1941639482975006,
-0.07463086396455765,
0.07168678194284439,
0.19662316143512726,
0.10717595368623734,
-0.1863875538110733,
-0.07921088486909866,
-0.41460657119750977,
-0.5206570029258728,
0.6369823217391968,
-0.4253995418548584,
0.2383647710084... | |
I am looking for the best way to do exception handling, for example.. when an error occurs in the business logic layer, is the best way to stop the METHOD using a catch and return an EVENT to the presentation layer?
What should this event contain?
Or should i always BUBBLE up exceptions and handle them in the present... | [
0.03993523493409157,
0.07060252875089645,
-0.07319466769695282,
0.25877225399017334,
-0.17730973660945892,
-0.27141252160072327,
0.1263442188501358,
0.002119280630722642,
-0.4551107585430145,
-0.3794496953487396,
0.04455053433775902,
0.51645427942276,
-0.23537637293338776,
-0.0132391816005... | |
whats the best way and return to the presentaiton layer and informing it of the issue..
Event? or another try / Catch in the presentation?
We use Amazon EC2 for dev and qa. Saves us a ton of money since the load is relatively low. We are currently evaluating if we should move the prod environments as well. | [
0.5130265355110168,
-0.33123111724853516,
0.18191061913967133,
0.46083858609199524,
-0.1338232457637787,
-0.2131834328174591,
0.10394465178251266,
0.052786655724048615,
0.08106803148984909,
-0.6943925619125366,
-0.04575018212199211,
0.6215965747833252,
0.016178159043192863,
-0.124991662800... | |
I'm trying to write a simple Python script that will copy a index.tpl to index.html in all of the subdirectories (with a few exceptions).
I'm getting bogged down by trying to get the list of subdirectories.
I did some **speed testing** on various functions to return the *full path* to all current subdirectories.
tl;... | [
0.046056751161813736,
-0.22338560223579407,
0.6530502438545227,
0.11333015561103821,
-0.03492270037531853,
-0.15772627294063568,
0.19269493222236633,
0.05642157420516014,
-0.4329627454280853,
-0.9955464601516724,
-0.15844863653182983,
0.6711736917495728,
-0.27467867732048035,
0.03493070229... | |
1, 10, 2. To get natural sorting (1, 2, 10), please have a look at <https://stackoverflow.com/a/48030307/2441026>
---
**Results**:
`scandir` is: 3x faster than `walk`, 32x faster than `listdir` (with filter), 35x faster than `Pathlib` and 36x faster than `listdir` and 37x (!) faster than `glob`.
```
Scandir: ... | [
-0.5361043214797974,
-0.4535020887851715,
0.5338222980499268,
-0.2186853140592575,
-0.260253369808197,
0.3377446234226227,
0.2597379684448242,
-0.484992653131485,
-0.47707563638687134,
-0.994243860244751,
-0.3127119541168213,
0.13126221299171448,
-0.6268677711486816,
-0.260175496339798,
... | |
36.277
```
Tested with W7x64, Python 3.8.1. Folder with 440 subfolders.
In case you wonder if `listdir` could be speed up by not doing os.path.join() twice, yes, but the difference is basically nonexistent.
Code:
```
import os
import pathlib
import timeit
import glob
path = r"<example_path>"
def a():
list_... | [
-0.3025384843349457,
-0.17470358312129974,
0.56661456823349,
-0.13980716466903687,
0.21654267609119415,
0.3073572516441345,
0.06994476914405823,
-0.26154378056526184,
-0.4904893934726715,
-0.6696308851242065,
-0.18756109476089478,
0.7899462580680847,
-0.6070849895477295,
-0.152483373880386... | |
for dir in dirs:
list_subfolders_with_paths.append( os.path.join(root, dir) )
break
# print(len(list_subfolders_with_paths))
def d():
list_subfolders_with_paths = glob.glob(path + '/*/')
# print(len(list_subfolders_with_paths))
def e():
list_subfolders_with_paths = list(filter(os.p... | [
-0.421405166387558,
-0.6818928718566895,
0.5106563568115234,
-0.29944097995758057,
0.08226780593395233,
0.25758153200149536,
0.06777676939964294,
-0.6092080473899841,
-0.16164171695709229,
-0.6716223359107971,
-0.3412040174007416,
0.798633873462677,
-0.5053480267524719,
-0.1794795393943786... | |
{timeit.timeit(b, number=1000):.3f}")
print(f"Walk: {timeit.timeit(c, number=1000):.3f}")
print(f"Glob: {timeit.timeit(d, number=1000):.3f}")
print(f"Listdir (filter): {timeit.timeit(e, number=1000):.3f}")
print(f"Pathlib: {timeit.timeit(f, number=1000):.3f}")
``` | [
-0.01843973435461521,
-0.6053833365440369,
0.6362800598144531,
-0.229815274477005,
0.3548251688480377,
0.1128138080239296,
0.2574852406978607,
-0.5869280695915222,
-0.2546423077583313,
-1.0728868246078491,
-0.3542112112045288,
0.498172789812088,
-0.6564696431159973,
-0.19387464225292206,
... | |
Basically I have some variables that I don't want to preinitialize:
```
originalTime = None
recentTime = None
postTime = None
def DoSomething ( ) :
if originalTime == None or (postTime - recentTime).seconds > 5 :
...
```
I get compile error on the if:
```
UnboundLocalError: local variable 'originalTime... | [
0.1956390142440796,
0.021236233413219452,
0.30597054958343506,
0.022345084697008133,
0.4246074855327606,
-0.15332147479057312,
0.1807795912027359,
-0.11435368657112122,
-0.14919619262218475,
-0.6638457179069519,
0.056901805102825165,
0.7311807870864868,
-0.11627744138240814,
0.360341131687... | |
correct Jarret Hardie, and since I don't have enough rep to comment.
The global scope is not an issue. Python will automatically look up variable names in enclosing scopes. The only issue is when you want to change the value. If you simply redefine the variable, Python will create a new local variable, unless you use ... | [
-0.1222475990653038,
0.0889635756611824,
0.5307838916778564,
-0.26138636469841003,
0.18847933411598206,
-0.1680273860692978,
0.5105520486831665,
-0.27295392751693726,
-0.4132119417190552,
-0.4450397193431854,
-0.1605592966079712,
0.8719738721847534,
-0.5160607695579529,
0.08718863129615784... | |
originalTime
originalTime = True
doSomething()
doSomethingElse()
doSomething()
doSomethingCompletelyDifferent()
doSomething()
```
Should output:
```
originalTime is None or evaluates to False
originalTime is None or evaluates to False
originalTime is not None and does not evaluate to False
```
I second his warn... | [
0.062153443694114685,
0.062160879373550415,
0.5303005576133728,
-0.2542624771595001,
0.46729686856269836,
-0.10843703150749207,
0.42073872685432434,
-0.7380929589271545,
0.04594368860125542,
-0.5617359280586243,
-0.0593184195458889,
0.5876935124397278,
-0.39814627170562744,
0.2596999108791... | |
I have css that works on all tr tags for the table.
so in my html I have no styling for tr tag. However, for one TR tag in my table I do not want to apply the TR that is generic to all tables. Is there a way to exclude this TR?
```
.statisticsTable {
border:2px solid #990000;
width:100%;
}
.statisticsTable t... | [
-0.34286636114120483,
-0.20690539479255676,
0.8689150214195251,
0.2199411392211914,
-0.359590619802475,
0.3053740859031677,
0.0010046594543382525,
-0.06618596613407135,
-0.31532278656959534,
-0.5546673536300659,
-0.20423518121242523,
0.10660382360219955,
-0.3379139006137848,
0.030698696151... | |
<tr>
<th colspan="2">HUB</th>
<th >House Houlds Evaluated</th>
<th >Total Debt Owed</th>
</tr>
<tr class="<s:if test="#status.even">even</s:if><s:else>odd</s:else>">
<td rowspan=3 valign=top>213-65-6425</td>
<td >All</td>
<td >t1</td>
<td >t2</t... | [
-0.2180219292640686,
0.06627403944730759,
0.5402038097381592,
0.09904340654611588,
0.003397059626877308,
0.2088695764541626,
-0.0023879418149590492,
-0.5611410737037659,
-0.3524579107761383,
-0.30342191457748413,
-0.1756177544593811,
0.5304656028747559,
0.062119998037815094,
0.141422256827... | |
or 'odd' I do not want this `<tr>` to have .statisticsTable tr properties. is this possible?
Main think I want to avoid is background-color: #990000; and color: #ffffff;
CSS cascades, meaning you can overwrite the values of previously defined properties.
You would do:
```
.statisticsTable tr.even, .statisticsTable t... | [
-0.27387136220932007,
-0.050102729350328445,
0.3815723657608032,
0.24124324321746826,
0.002965341554954648,
0.02972724288702011,
0.08023102581501007,
0.07048194855451584,
-0.4427928328514099,
-0.6546070575714111,
-0.027919281274080276,
0.3310876786708832,
-0.4124741852283478,
0.08505620062... | |
you can use [:not](http://www.w3.org/TR/css3-selectors/#negation) to only apply the following styles to TR elements which don't have the even or odd class:
```
.statisticsTable tr:not(.even):not(.odd) {
font: bold 9pt Arial,Helvetica,sans-serif,Verdana,Geneva;
color: #fff;
background:#990000;
}
```
**EDI... | [
-0.11974271386861801,
-0.17514759302139282,
0.535627007484436,
0.1947295218706131,
-0.149308979511261,
0.22162304818630219,
0.02970065362751484,
-0.17062333226203918,
-0.3179302513599396,
-0.641291081905365,
-0.2156686633825302,
0.2809794545173645,
-0.3713625371456146,
-0.34820425510406494... | |
Is there anyway to create a dialog that is modal to a view and not the entire shell (application)? So if say, I have one view called A that is overlaying another view called B, I want to open a dialog that is only modal to view A, so when I switch to view B, the dialog and the view A will be covered by view B. Is there... | [
0.4953940808773041,
-0.010094080120325089,
0.36544162034988403,
-0.049387529492378235,
-0.15308846533298492,
0.012380984611809254,
0.10783147066831589,
-0.17795126140117645,
-0.47098878026008606,
-0.23865129053592682,
0.12229838967323303,
0.9025625586509705,
-0.3440389335155487,
-0.2291488... | |
modal dialog in View A, you use a TabFolder. Then, you can open the contents of the dialog in a new Tab instead and force this tab to stay on top until you dismiss it. This is a similar behavior to the one you need.
This will also allow you to drag and drop something from View B into View A. | [
-0.1060037836432457,
-0.27645567059516907,
0.6215596795082092,
0.010419031605124474,
-0.2649976909160614,
-0.016902122646570206,
0.1851428747177124,
-0.08213570713996887,
-0.22819815576076508,
-0.5043473243713379,
-0.3697601556777954,
0.9023060202598572,
-0.545807957649231,
-0.093789316713... | |
I'm looking for xaml that can represent a loading icon, like vista does.
Visual Description:
* Round ( about 1/3 inch in width )
* lighter blue color
* transparent center
* gel button looking (rounded edges wtih a little shadow)
* white spinner around the edge, to give the movement
light(er) sky blue / gel pack lo... | [
0.5804259181022644,
-0.20255881547927856,
0.6370357275009155,
0.10578689724206924,
-0.196088507771492,
0.12950006127357483,
-0.05821424722671509,
-0.17435117065906525,
-0.5709524750709534,
-0.5554106831550598,
0.45747843384742737,
-0.011204762384295464,
-0.14375826716423035,
0.072290346026... | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Width="400" Height="300">
<UserControl.Resources>
<Storyboard x:Name="Animiation" RepeatBehavior="Forever">
<DoubleAnimation To=".5" AutoReverse="True" BeginTime="0:... | [
0.18813905119895935,
-0.1311132311820984,
0.4494803547859192,
-0.016473567113280296,
-0.32565540075302124,
0.15906625986099243,
0.17339496314525604,
-0.2744405269622803,
-0.19171543419361115,
-0.13360072672367096,
-0.27681565284729004,
0.5809808969497681,
0.10267428308725357,
0.21064713597... | |
Storyboard.TargetName="e4" Storyboard.TargetProperty="Opacity"/>
<DoubleAnimation To=".5" AutoReverse="True" BeginTime="0:0:0.5" Duration="0:0:.25" Storyboard.TargetName="e5" Storyboard.TargetProperty="Opacity"/>
<DoubleAnimation To=".5" AutoReverse="True" BeginTime="0:0:0.625" Duration="0:0:.... | [
0.1778344362974167,
-0.22777210175991058,
0.25948366522789,
0.014910420402884483,
-0.0688014104962349,
0.3663748502731323,
0.09872805327177048,
-0.21186809241771698,
-0.3448389768600464,
-0.6174148321151733,
-0.13301007449626923,
0.6943509578704834,
-0.06753409653902054,
-0.193173632025718... | |
<Grid Width="100" Height="100" x:Name="gridSpinner">
<Ellipse x:Name="e1" Margin="40,80,0,0" Height="20" Width="20" Fill="Gray" Stretch="Fill" VerticalAlignment="Top" HorizontalAlignment="Left"/>
<Ellipse x:Name="e2" Margin="12,68,0,0" Height="20" Width="20" Fill="Gray" Stretch="Fill" VerticalAl... | [
-0.9466214179992676,
-0.01948108896613121,
0.5996601581573486,
0.011595240794122219,
-0.058429282158613205,
0.5904697775840759,
-0.22861923277378082,
-0.23141460120677948,
-0.3159632980823517,
-0.7050079107284546,
-0.34097152948379517,
0.331615686416626,
0.3194632828235626,
-0.102389343082... | |
Margin="40,0,0,0" Height="20" Width="20" Fill="Gray" Stretch="Fill" VerticalAlignment="Top" HorizontalAlignment="Left"/>
<Ellipse x:Name="e6" Margin="68,12,0,0" Height="20" Width="20" Fill="Gray" Stretch="Fill" VerticalAlignment="Top" HorizontalAlignment="Left"/>
<Ellipse x:Name="e7" Margin="80,... | [
-0.9097281098365784,
0.014014754444360733,
0.7791269421577454,
-0.022364238277077675,
0.07087860256433487,
0.49689802527427673,
-0.2331516146659851,
-0.22498539090156555,
-0.3481981158256531,
-0.6500400304794312,
-0.37554413080215454,
0.46665021777153015,
0.35575705766677856,
0.03650033473... | |
Our site is running ASP.NET 1.1, and I need to have ASP.NET 2.0 running in a separate section to the same site until we get it fully converted over. I created the new folder and in IIS, I ‘create application’ process on the folder. Then, I went to the ASP.NET tab and changed the version for my new app to 2.0. This work... | [
0.659292459487915,
0.0325598381459713,
0.40013715624809265,
-0.036604832857847214,
-0.13796302676200867,
-0.19581495225429535,
0.37543126940727234,
-0.08334539085626602,
-0.16431844234466553,
-0.9416492581367493,
0.03208096697926521,
0.5913106203079224,
-0.36489740014076233,
-0.02660551108... | |
following error message (below). I ‘removed application’ on my new folder and it fixed the error.
```
=====================================
Server Application Unavailable
The web application you are attempting to access on this web server is
currently unavailable. Please hit the "Refresh" button in your web
browser ... | [
-0.04257701709866524,
0.11119336634874344,
0.43551957607269287,
0.022922532632946968,
0.008652911521494389,
-0.024505561217665672,
0.469827800989151,
-0.09982447326183319,
-0.3529239296913147,
-0.874369204044342,
-0.15039348602294922,
0.7616004347801208,
-0.5787241458892822,
0.257962495088... | |
called .NET 2.0.
When you run 'create application', make sure you select the correct AppPool for the .NET version the application uses.
That should take care of any errors when you run your application. | [
0.2650863528251648,
-0.284837007522583,
0.10445769131183624,
0.006396307609975338,
-0.081097312271595,
-0.4199109971523285,
0.09818307310342789,
0.12818771600723267,
-0.07050219923257828,
-0.987301230430603,
-0.12349928915500641,
0.5216413140296936,
-0.6052014827728271,
-0.1455663889646530... | |
I have an NSCell subclass that I do all kinds of custom drawing in. The only time things seem to be entirely out of my control is when right clicking a cell to show the associated context menu. While showing it's context menu, the table (or cell - not sure which exactly is doing this) draws a focus rect. I would like t... | [
0.22272542119026184,
-0.13570080697536469,
0.3284302353858948,
-0.07332749664783478,
-0.1168128252029419,
0.06110136955976486,
0.18201281130313873,
0.19477394223213196,
-0.23558980226516724,
-0.615394651889801,
0.15587098896503448,
0.3442549407482147,
-0.18682143092155457,
0.07703682780265... | |
over this focus rect drawing itself (various first responder methods, various drawing methods, various highlight color methods, etc.), but I have yet to find something that changes anything about it.
Screenshot of the problem: <http://twitpic.com/3zx2t>
I am almost annoyed enough to class-dump AppKit and try to find ... | [
0.22980566322803497,
-0.0925566703081131,
0.49498656392097473,
0.12628567218780518,
-0.3129495084285736,
-0.33304277062416077,
0.3527911901473999,
0.3919358551502228,
-0.24829013645648956,
-0.5821043848991394,
0.005885090213268995,
0.5451726317405701,
-0.0593111515045166,
0.363615185022354... | |
the context menu highlight rect.
```
- (void)_drawContextMenuHighlightForIndexes:(NSIndexSet *)rowIndexes clipRect:(NSRect)rect {
return;
}
```
This is the method, used in Leopard at least, to draw the highlight around cells that will be activated upon by a context menu. It is unfortunately called directly by `N... | [
0.01431612204760313,
-0.22590206563472748,
0.5050789713859558,
-0.26081275939941406,
-0.3622169494628906,
-0.21314246952533722,
0.48182785511016846,
0.057876285165548325,
-0.35424014925956726,
-0.5203333497047424,
-0.17406035959720612,
0.40477046370506287,
-0.6671468019485474,
-0.065726540... | |
your programs on newer releases or some other functionality using this method may not work later. *You have been warned.* | [
0.709800660610199,
0.29084426164627075,
0.05278821662068367,
0.2718503773212433,
0.1417439579963684,
-0.27406635880470276,
0.5620327591896057,
0.4324718713760376,
-0.37968364357948303,
-0.7626981735229492,
-0.35198402404785156,
0.5471893548965454,
0.0763273760676384,
0.0032248760107904673,... | |
When I go to <http://localhost:3000/hello/sayhello>, Rails outputs:
```
hello world!
```
as HTML.
But when I run this Flex remote "Hello World" app, I see a button and a textbox but it does not pick up the output of the HTTPService call to my Rails url. Any ideas why?
```
<?xml version="1.0" encoding="utf-8"?>
<mx... | [
-0.11946851760149002,
0.007406243588775396,
0.6992512345314026,
-0.14117179811000824,
-0.18016169965267181,
0.28986164927482605,
0.04969538748264313,
-0.18106712400913239,
-0.27205517888069153,
-0.6508414149284363,
-0.1473916918039322,
0.5532664060592651,
-0.1941407173871994,
-0.0697293132... | |
label="call hello service"
click="helloSvc.send()"/>
<mx:TextInput text="{helloSvc.lastResult}"/>
</mx:Application>
```
Without completely overriding your table view's `-drawRect:` this is the only other way I know to get rid of the context menu highlight rect.
```
- (void)_drawContextMenuHighlightForInde... | [
-0.030988816171884537,
-0.01870950311422348,
0.4900802671909332,
-0.37748563289642334,
-0.3193291127681732,
-0.09658382087945938,
0.5723318457603455,
-0.11713019758462906,
-0.3754775822162628,
-0.5540342926979065,
-0.19060122966766357,
0.31268614530563354,
-0.6009887456893921,
0.0910627245... | |
this is private API, it may stop working in Snow Leopard, or some other release. But at worst that means that somewhere along the way the context menu highlight may start up again in your programs on newer releases or some other functionality using this method may not work later. *You have been warned.* | [
0.5310657024383545,
-0.06199680641293526,
0.17942288517951965,
0.10053074359893799,
-0.08637464791536331,
-0.44049131870269775,
0.6950623393058777,
0.3058357536792755,
-0.38574835658073425,
-0.5445050597190857,
-0.18063890933990479,
0.29342567920684814,
-0.49641525745391846,
0.050945647060... | |
At one point I had a nice little compression utility that smashed my Delphi compiled EXE's to a smaller download size, but now I can't find it. Any recommendations?
Also, are there any downsides to using these kinds of utilities? (I mainly use them to shorten download times for rural / dial-up users).
---
Related qu... | [
0.35589540004730225,
0.1780204474925995,
0.19777007400989532,
0.204739511013031,
0.04417332634329796,
-0.14915691316127777,
0.19619357585906982,
0.21882420778274536,
-0.5045605301856995,
-0.5611911416053772,
0.012740612961351871,
0.5244612097740173,
-0.20447233319282532,
0.0967220962047576... | |
it create a single EXE that will install/uninstall your program, but it also compresses that EXE practically as much as a separate compressor would do to your executable alone.
When the program is installed it gets decompressed, so it never appears to be a virus and does not increase load times.
So I get the benefi... | [
0.2892443537712097,
0.041951984167099,
0.2753698229789734,
0.03798652067780495,
-0.040808696299791336,
-0.3206956684589386,
0.2092519849538803,
0.17047660052776337,
0.042523350566625595,
-0.7557654976844788,
-0.1843952238559723,
0.945033073425293,
-0.3067331612110138,
-0.09067370742559433,... | |
I want to be able to email a report daily from a glpi database in MySQL. I would like to create a SSIS job to pull data from MySQL. How do I do this?
I would suggest using [ODBC](http://dev.mysql.com/doc/refman/5.1/en/connector-odbc.html) or the MySQL [.NET adapter](http://dev.mysql.com/downloads/connector/net/5.2.html... | [
0.2877521514892578,
-0.20513935387134552,
0.3588184118270874,
0.02934660017490387,
-0.19804631173610687,
-0.22673997282981873,
-0.001468996750190854,
-0.03407168388366699,
-0.28577497601509094,
-0.9576112627983093,
-0.06963833421468735,
0.2973562777042389,
-0.2753034830093384,
0.0889882519... | |
I am defining a number, as follows:
```
NSNumber *nn0 = [NSNumber numberWithInt:0];
```
It works fine without any alloc. My understanding is that if I use numberWithInt, alloc and init are called automatically.
If I try to release at the end of my function, I run into problems:
```
[nn0 release];
```
I get a run... | [
0.12664921581745148,
0.035241030156612396,
0.1360805779695511,
-0.1694868952035904,
0.12408078461885452,
-0.011014486663043499,
0.19235758483409882,
-0.0629921481013298,
-0.15091422200202942,
-0.5708639621734619,
-0.07867206633090973,
0.6539707779884338,
-0.1665215939283371,
0.093472249805... | |
manually release these objects - they will be released when the current NSAutoreleasePool is released/drained.
See this page for a description of convenience constructors, and how to mange the memory for these.
<http://www.macdevcenter.com/pub/a/mac/2001/07/27/cocoa.html?page=3> | [
-0.13803261518478394,
-0.042618364095687866,
0.36204516887664795,
0.29821348190307617,
0.08037108182907104,
-0.13700613379478455,
0.17498674988746643,
-0.09153181314468384,
-0.340406209230423,
-0.1980849802494049,
-0.5313589572906494,
0.6452187895774841,
-0.20946907997131348,
-0.0822546109... | |
Alright, so I just took an introductory class into Computer Science and the school's language choice was Java (I have basic knowledge of concepts like polymorphism, encapsulation, etc..). I want to learn C++ then C (I hear that one should learn C++ first then go to C), and was wondering if C# is a nice transitional lan... | [
0.1886289417743683,
0.09533089399337769,
-0.3386068642139435,
0.06754958629608154,
-0.18097169697284698,
-0.18290896713733673,
0.20140966773033142,
0.5463082194328308,
-0.20271629095077515,
-0.45893624424934387,
0.12264254689216614,
0.6542004942893982,
0.04022432863712311,
-0.1824423819780... | |
code, but beyond that I can't think of any reason it would make an especially good bridge from Java to C++. Also that is a feature I suspect more likely to be used by developers coming from the other direction. If you have other reasons for learning C# I say go for it, but for the purposes of transitioning more easily ... | [
0.34869152307510376,
0.13940849900245667,
-0.14466916024684906,
0.321534126996994,
-0.24344751238822937,
-0.4847278892993927,
0.6281493902206421,
0.4430656135082245,
-0.4132872521877289,
-0.539530873298645,
0.07186035811901093,
0.6385257244110107,
-0.25899720191955566,
-0.3619908392429352,... | |
Firstly, here's my script:
```
#!/usr/bin/python
import sys, os
sys.path.append('/home/username/python')
sys.path.append("/home/username/python/flup")
sys.path.append("/home/username/python/django")
# more path stuff
os.environ['DJANGO_SETTINGS_MODULE'] = "project.settings"
from django.core.servers.fastcgi import r... | [
-0.13047891855239868,
0.2710164785385132,
0.36750900745391846,
-0.09766848385334015,
-0.3482893109321594,
-0.12020029872655869,
0.31194770336151123,
-0.6161423325538635,
-0.4837280511856079,
-0.24035802483558655,
-0.08133815228939056,
0.6240360140800476,
-0.2580934166908264,
-0.22196634113... | |
web server just gives me an internal server error.
---
Instead of the last two lines of my script, I can use
```
from flup.server.fcgi import WSGIServer
from django.core.handlers.wsgi import WSGIHandler
WSGIServer(WSGIHandler()).run()
```
But I still get the exact same error...
Solved it. This .htaccess file did ... | [
-0.1623552292585373,
0.1639864444732666,
0.7184763550758362,
-0.07501186430454254,
-0.15793363749980927,
-0.34409385919570923,
0.5916575789451599,
-0.23212891817092896,
-0.20698343217372894,
-0.9086001515388489,
-0.14644266664981842,
0.25521498918533325,
-0.5214717984199524,
0.068727374076... | |
I am a .NET developer, I am interested in writing about Silverlight, .NET and other stuff...
Which free blog provider would you recommend me?
<http://www.dotnetblogengine.net/> | [
0.9704902768135071,
-0.14896145462989807,
0.153554767370224,
-0.14371377229690552,
0.07420644909143448,
0.18207545578479767,
-0.025857551023364067,
0.6106315851211548,
-0.1602175235748291,
-0.749248743057251,
0.4499495327472687,
0.4792103171348572,
-0.12671394646167755,
0.06609474122524261... | |
The .NET framework ships with 6 different hashing algorithms:
* MD5: 16 bytes (Time to hash 500MB: 1462 ms)
* SHA-1: 20 bytes (1644 ms)
* SHA256: 32 bytes (5618 ms)
* SHA384: 48 bytes (3839 ms)
* SHA512: 64 bytes (3820 ms)
* RIPEMD: 20 bytes (7066 ms)
Each of these functions performs differently; MD5 being the fastes... | [
-0.3458874821662903,
-0.0728919580578804,
0.6246548295021057,
-0.05346740037202835,
-0.3660127818584442,
-0.09719552099704742,
0.45929571986198425,
-0.3540700376033783,
-0.20650821924209595,
-0.9237725734710693,
0.004547554533928633,
0.1772802621126175,
-0.2097228765487671,
0.3693284690380... | |
[collision attacks](http://en.wikipedia.org/wiki/Cryptographic_hash_function), SHA-1 is also vulnerable but to a lesser degree.
### Under what conditions should I use which hashing algorithm?
Particular questions I'm really curious to see answered are:
* Is MD5 not to be trusted? Under normal situations when you use... | [
-0.09241653978824615,
0.14018693566322327,
0.2566382586956024,
0.01028247270733118,
-0.4734223484992981,
-0.2672799229621887,
0.3870866298675537,
-0.20095182955265045,
-0.4502994418144226,
-0.6237674355506897,
0.0834537073969841,
0.4162366986274719,
-0.18468493223190308,
0.175164595246315,... | |
non-malicious collisions when hashing file-names (or other short strings)? (Eg. 2 random file-names with same MD5 hash) (with MD5 / SHA1 / SHA2xx) In general what are the odds for non-malicious collisions?
This is the benchmark I used:
```
static void TimeAction(string description, int iterations, Action func) {
... | [
0.1560901403427124,
-0.49936434626579285,
0.4624384343624115,
-0.0377732589840889,
0.11727295070886612,
0.04487069696187973,
0.28845593333244324,
-0.03942813724279404,
-0.49688720703125,
-0.3147614300251007,
-0.041038867086172104,
0.591917097568512,
-0.6114789247512817,
0.11486000567674637... | |
}
watch.Stop();
Console.Write(description);
Console.WriteLine(" Time Elapsed {0} ms", watch.ElapsedMilliseconds);
}
static byte[] GetRandomBytes(int count) {
var bytes = new byte[count];
(new Random()).NextBytes(bytes);
return bytes;
}
static void Main(s... | [
0.017497466877102852,
-0.4724363386631012,
0.6422295570373535,
-0.3850034475326538,
0.4252737760543823,
0.19193749129772186,
0.1520400047302246,
-0.1694541871547699,
-0.585930347442627,
-0.44304484128952026,
-0.2883080244064331,
0.5782658457756042,
-0.19807961583137512,
0.4834153354167938,... | |
MD5CryptoServiceProvider();
var sha1 = new SHA1CryptoServiceProvider();
var sha256 = new SHA256CryptoServiceProvider();
var sha384 = new SHA384CryptoServiceProvider();
var sha512 = new SHA512CryptoServiceProvider();
var ripemd160 = new RIPEMD160Managed();
var source = Ge... | [
-0.389873743057251,
0.10467454791069031,
0.5081321001052856,
-0.3955523371696472,
-0.29771843552589417,
0.5016233325004578,
0.36140117049217224,
-0.42919936776161194,
-0.3362487852573395,
-0.6754079461097717,
-0.3044748306274414,
0.569084644317627,
-0.15616649389266968,
0.18076199293136597... | |
algorithms["sha1"] = sha1;
algorithms["sha256"] = sha256;
algorithms["sha384"] = sha384;
algorithms["sha512"] = sha512;
algorithms["ripemd160"] = ripemd160;
foreach (var pair in algorithms) {
Console.WriteLine("Hash Length for {0} is {1}",
pair.Key, | [
-0.4148387908935547,
-0.07853583991527557,
0.28739133477211,
-0.3394916355609894,
0.21063394844532013,
0.5151968598365784,
0.2625824213027954,
-0.5058258771896362,
-0.02564428560435772,
-0.5798160433769226,
-0.3307797908782959,
0.18496891856193542,
-0.3763470947742462,
0.24753785133361816,... | |
pair.Value.ComputeHash(source).Length);
}
foreach (var pair in algorithms) {
TimeAction(pair.Key + " calculation", 500, () =>
{
pair.Value.ComputeHash(source);
});
} | [
-0.09151969105005264,
-0.1794261634349823,
0.20382097363471985,
-0.3697451055049896,
0.23021572828292847,
0.3531129062175751,
0.28166747093200684,
-0.8238735795021057,
0.05117962881922722,
-0.6290860176086426,
-0.17776842415332794,
0.4117267429828644,
-0.40232887864112854,
0.26054546236991... | |
Console.ReadKey();
}
```
In cryptography, hash functions provide three separate functions.
1. **Collision resistance**: How hard is it for someone to find two messages (*any* two messages) that hash the same.
2. **Preimage Resistance**: Given a hash, how hard is it to find another message that hashes the same? Al... | [
-0.28744837641716003,
-0.28018590807914734,
0.010614107362926006,
0.09755241870880127,
0.004878893028944731,
0.0652543231844902,
0.06570957601070404,
-0.30954352021217346,
0.018854008987545967,
-0.7565247416496277,
-0.09745148569345474,
0.5937167406082153,
-0.3101575970649719,
0.2063607126... | |
requirements, needing one or more of these properties. A hash function for securing passwords on a server will usually only require preimage resistance, while message digests require all three.
It has been shown that MD5 is not collision resistant, however, that does not preclude its use in applications that do not re... | [
-0.29874715209007263,
0.02127012424170971,
0.16935810446739197,
0.11873220652341843,
-0.021421965211629868,
-0.27102160453796387,
0.11253825575113297,
-0.2769290506839752,
-0.4546037018299103,
-0.6512699723243713,
-0.36187446117401123,
0.4276488721370697,
-0.07491960376501083,
0.1366632133... | |
than the 2^80 steps a secure hash function of its length would require. The attack is continually being revised and currently can be done in ~2^63 steps - just barely within the current realm of computability (as of April, 2009). For this reason NIST is phasing out the use of SHA1, stating that the SHA2 family should b... | [
-0.3745967447757721,
-0.06460081040859222,
0.4895469844341278,
0.09999366849660873,
-0.12083277851343155,
-0.19430355727672577,
0.5107148885726929,
-0.2225480079650879,
-0.33989280462265015,
-0.8679090142250061,
-0.11999956518411636,
0.4275153577327728,
-0.25679296255111694,
0.100338883697... | |
much on, except to note that it isn't as commonly used as the SHA families, and so has not been scrutinized as closely by cryptographic researchers. For that reason alone I would recommend the use of SHA functions over it. In the implementation you are using it seems quite slow as well, which makes it less useful.
In ... | [
0.19970740377902985,
0.17484115064144135,
0.35006773471832275,
0.019338494166731834,
0.15690670907497406,
-0.41996702551841736,
0.3380375802516937,
0.09120950102806091,
-0.17976951599121094,
-0.7925249338150024,
-0.08047439157962799,
0.344472199678421,
-0.15831704437732697,
0.3750103414058... | |
SHA-1 OR MD5 FOR CRYPTOGRAPHIC APPLICATIONS.** Both of these algorithms **are broken** (MD5 can be cracked in 30 seconds by a cell phone).
--- | [
-0.22542232275009155,
0.012107383459806442,
-0.053853072226047516,
0.03157963976264,
-0.16425161063671112,
-0.4002014398574829,
0.3866441547870636,
-0.11281663924455643,
-0.3774854242801666,
-0.452062726020813,
-0.14071016013622284,
0.34354859590530396,
0.10175920277833939,
0.3359715342521... | |
Wanted to know if someone had a suggestion on code or maybe there's a plugin (!) which would allow very basic forum functionality that I can integrate into my application so that it is single sign-on?
Otherwise...maybe a tutorial on how to build one from scratch and I just leverage our existing authentication?
Thanks... | [
0.4461638629436493,
0.0939280241727829,
-0.029812997207045555,
0.10381335020065308,
-0.3556816875934601,
-0.11603040248155594,
0.2612626850605011,
-0.04610862955451012,
-0.3532927334308624,
-0.4936180114746094,
0.49233347177505493,
0.2867525815963745,
0.1534477174282074,
-0.028884287923574... | |
the way you describe, is Beast. It's simple but yet nice and functional. It doesn't integrate as a plugin, but it's not difficult to use it in your site and pass your user session to it.
(Use the newer version called AlteredBeast: <http://github.com/courtenay/altered_beast/tree/master>) | [
0.5183110237121582,
-0.2038356512784958,
0.10842324793338776,
-0.044743262231349945,
0.06661871075630188,
-0.007398023270070553,
0.11474260687828064,
-0.03493642061948776,
-0.12123779952526093,
-0.3936610817909241,
-0.02992887608706951,
0.6665200591087341,
-0.29002413153648376,
-0.11745952... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.