text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
I have developed a kind of brochure website template that I base most of my clients' websites on. The template and derived sites are stored together in a Subversion repository. Bleeding-edge (but stable) code lives in `/trunk`; and each website has its own branch, to make customization easier. Now that I'm approaching ... | [
0.5896400213241577,
0.22609181702136993,
0.4563077390193939,
-0.03485466539859772,
0.22767047584056854,
-0.25227952003479004,
0.006877156440168619,
-0.12051404267549515,
-0.2639763057231903,
-0.37277135252952576,
-0.14916671812534332,
0.41682130098342896,
-0.1988276243209839,
0.17325943708... | |
template, and already there is new code in the trunk. If I want to create a new branch based on 2.0 code, how do I go about it?
Do I branch off `/tags/2.0`? That can't be right. Where would I commit my changes? I'd have to deliberately circumvent my branch's ancestry. Do I have to manually look up the trunk revision t... | [
0.7862690091133118,
-0.1474170833826065,
0.18913552165031433,
0.13369229435920715,
0.16197271645069122,
-0.31147196888923645,
0.27577441930770874,
-0.12712697684764862,
-0.44742605090141296,
-0.5299283862113953,
0.16322225332260132,
0.3273124396800995,
-0.4810667037963867,
0.43479889631271... | |
(as opposed to *what* *they* *are*) would be helpful. Thanks.
Edit: Where I said "branch off `/tags/2.0`", I meant to say, "check out `/tags/2.0`". But that mistake was also the answer to my question. For some reason, I had never thought of *copying* a tag. Stupid, right? But in my mind, tags were "final".
And by the... | [
0.6142151951789856,
-0.2618684470653534,
0.3492700159549713,
-0.012848026119172573,
-0.07499781250953674,
-0.2480214387178421,
0.19993756711483002,
-0.13778726756572723,
-0.21605323255062103,
-0.5707284808158875,
-0.19695205986499786,
0.4667122960090637,
-0.11371681839227676,
-0.0533934347... | |
immediately copy /branches/Foobar-1.2.3.X to /tags/Foobar-1.2.3.0 (this makes diffs easier later, I can diff /branches/Foobar-1.2.3.X to /tags/Foobar-1.2.3.0 and see what has changed in my branch, since by that time /trunk is likely to be different). Final development proceeds on the features in /branches/Foobar-1.2.3.... | [
0.4232026934623718,
-0.1651633232831955,
0.5841303467750549,
-0.04028505086898804,
0.19684915244579315,
-0.17672719061374664,
0.5005804896354675,
-0.14683496952056885,
-0.059179894626140594,
-0.6139759421348572,
-0.3463406264781952,
0.6669344305992126,
-0.19364193081855774,
-0.077874489128... | |
I'm trying to achieve what the code below suggests, but I'm getting the error `Incorrect syntax near the keyword 'view'` on both the create and alter lines.
```
IF Object_ID('TestView') IS NULL
BEGIN
create view TestView
as
. . .
END
ELSE
BEGIN
ALTER view TestView
a... | [
0.28731223940849304,
0.20557089149951935,
0.2807820737361908,
-0.3698066174983978,
-0.1801067739725113,
-0.13021019101142883,
0.623482346534729,
-0.374807208776474,
0.342986136674881,
-0.7466338872909546,
-0.2227819263935089,
0.7172286510467529,
-0.16540849208831787,
0.18404988944530487,
... | |
END
```
Because ALTER/CREATE commands can't be within BEGIN/END blocks. You need to test for existence and the drop it before doing a create
```
IF Object_ID('TestView') IS NOT NULL
DROP VIEW TestView
GO
CREATE VIEW TestView
as
. . .
GO
```
If you are woried about the permissions being lost you can sc... | [
0.38378283381462097,
0.05737341567873955,
0.5193333029747009,
0.04808247834444046,
-0.1068490594625473,
-0.24892763793468475,
0.14377765357494354,
-0.5285680890083313,
0.14467965066432953,
-0.5532960891723633,
-0.2604612112045288,
0.6009360551834106,
-0.1553543657064438,
0.1159368604421615... | |
X, Y, Z FROM TABLE'
IF Object_ID('TestView') IS NULL
SET @SQL = 'CREATE VIEW TestView AS ' + @SQL
ELSE
SET @SQL = 'ALTER VIEW TestView AS ' + @SQL
EXEC(@SQL)
``` | [
0.4756941497325897,
-0.006195881403982639,
0.18493106961250305,
0.08278423547744751,
-0.2538033723831177,
0.0019114089664071798,
0.19768193364143372,
-0.31489184498786926,
0.2713651955127716,
-0.5744850039482117,
-0.24976010620594025,
0.3731553554534912,
-0.30849984288215637,
0.29828107357... | |
I'm learning some Fluent NHibernate and I've run across the semi-awesome PersistenceSpecification class.
I've set it up in a unit test to verify my mappings and it works great. However, it leaves the record in the database when done. I tried throwing it in a transaction so I can rollback the changes but I get an error... | [
0.04359355941414833,
0.3205116093158722,
0.2519318759441376,
0.0665476992726326,
-0.038860224187374115,
0.017656028270721436,
0.4920545816421509,
0.17166195809841156,
0.20816902816295624,
-0.6348499655723572,
0.26472339034080505,
0.623077392578125,
-0.1357867568731308,
0.31706124544143677,... | |
var factory = GetSessionFactory();
using (var session = factory.OpenSession())
using (var transaction = session.BeginTransaction())
{
new PersistenceSpecification<TimePeriod>(session)
.CheckProperty(x => x.EndDate, DateTime.Today) | [
0.0495852455496788,
-0.27510741353034973,
0.5400968790054321,
-0.30699285864830017,
0.5369041562080383,
0.20179015398025513,
0.5595517754554749,
-0.15166154503822327,
-0.4380621016025543,
-0.6122473478317261,
-0.11877022683620453,
0.4269343614578247,
-0.45830875635147095,
0.535956442356109... | |
.VerifyTheMappings();
transaction.Rollback();
}
```
Try setting the IsolationLevel on the transaction. This snippet worked for me:
```
using (var trans = _session.BeginTransaction(IsolationLevel.ReadUncommitted))
{
new PersistenceSpecification<Event>(_session)
.CheckProperty(p ... | [
-0.11851056665182114,
0.011765353381633759,
0.37670743465423584,
-0.14799459278583527,
0.21063150465488434,
0.0007470098207704723,
0.31916871666908264,
-0.1411450356245041,
-0.2961176335811615,
-0.4612205922603607,
0.08968451619148254,
0.5893126130104065,
-0.4810008704662323,
0.39803335070... | |
I have a situation where I'd like a button to respond to two different IBAction methods. Is there a way that I can force a particular method first? When I look at the buttons connections in IB they are in the correct order, but they consistently perform in the opposite order.
Deleting all the connections in IB then rec... | [
-0.09691186249256134,
-0.18059347569942474,
0.23602624237537384,
-0.16653454303741455,
-0.1698315292596817,
0.5595819354057312,
0.03320439159870148,
-0.42152631282806396,
-0.2820056676864624,
-0.6985692381858826,
0.27500292658805847,
0.4789411723613739,
-0.4360031187534332,
0.0050103878602... | |
I'm working on a table design that could involve many NULL values in about 10 fields maybe 75% of the time the fields would be unused.
I just generated some fake data (a million records) and could not sense any impact on SQL Server 2005. Size difference was in the KB. Performance - no measurable difference after addin... | [
0.07990437000989914,
0.27270588278770447,
0.36030566692352295,
0.0933699756860733,
-0.2921326756477356,
-0.17352168262004852,
0.3775639832019806,
-0.0898989886045456,
-0.33323410153388977,
-0.44130417704582214,
0.3470376431941986,
0.3905620574951172,
-0.28768864274024963,
0.233766734600067... | |
values exist in the design of the current SharePoint UserData table.
So if its good enough for Microsoft...
Any good articles, links, white papers on the drawbacks or pain points around many NULL values in SQL Server table? Anyone have any experience on what happens as you scale to 10 mil or 100 mil records?
I have ne... | [
0.5672085881233215,
0.36243724822998047,
0.2913387715816498,
0.18629512190818787,
-0.07643866539001465,
-0.25796571373939514,
0.27329856157302856,
-0.07198090106248856,
-0.3401508033275604,
-0.465230256319046,
0.4125012457370758,
0.5208685994148254,
0.036708809435367584,
0.0463846400380134... | |
not seen this as a problem personally. Then again, I have not created database tables where every field except 3 was nullable.
On the other hand, I see an architecture problem when most of the data is null. the general reason is either a) an improperly normalized database or b) an attempt to allow users to stage data ... | [
0.13054364919662476,
0.5126690864562988,
-0.004131519701331854,
0.023555265739560127,
0.05277743563055992,
0.07470151782035828,
0.5991072058677673,
0.06532487273216248,
-0.2707996666431427,
-0.5744385123252869,
0.19754953682422638,
0.37478381395339966,
-0.15333673357963562,
0.2195283919572... | |
I would like to fill a table with the results of a query on existing table. How can I do that?
(You don't need to match the table schemas)
```
INSERT tbl_name (col1, col2)
SELECT value1, value2
FROM othertable
```
See the reference for [INSERT ... SELECT Syntax](http://dev.mysql.com/doc/refman/5.5/en/insert-... | [
0.11565222591161728,
0.1009586974978447,
0.3757014274597168,
0.04462658241391182,
0.24463696777820587,
-0.0327455960214138,
-0.10448092222213745,
-0.1374775916337967,
-0.10492420941591263,
-0.5736814737319946,
0.010606476105749607,
0.41624948382377625,
-0.24635085463523865,
0.0395042970776... | |
We have a .net remoting application sitting in between web app and database. Occasionally we get strange problem. The remote call simply hangs and never returns. We used package sniffer to check the traffic. It seems to be the server side problem. If we stop the server app, a network exception will be thrown immediatel... | [
0.39913779497146606,
0.02091885916888714,
-0.0753631740808487,
0.0401495136320591,
-0.13780583441257477,
-0.19433093070983887,
0.39006415009498596,
-0.3109917938709259,
-0.37341222167015076,
-0.3995322585105896,
-0.037511471658945084,
0.3252812922000885,
-0.09695795923471451,
0.09193735569... | |
impact of animation on user’s ability to build a mental map of the information in the space:
[Does Animation Help Users Build Mental Maps
of Spatial Information?](http://citeseerx.ist.psu.edu/viewdoc/download;jsessionid=C9F5FE8D978E8EB2134BB4B799895152?doi=10.1.1.63.4244&rep=rep1&type=url&i=0) | [
-0.1735747903585434,
0.1882719248533249,
-0.11860419064760208,
0.30107587575912476,
-0.25422176718711853,
0.4715164601802826,
-0.21104934811592102,
-0.2341586947441101,
-0.49330732226371765,
-0.6903966665267944,
-0.4726157784461975,
0.4170907735824585,
-0.02466275729238987,
0.2648426592350... | |
**Question:**
IE and Firefox / Safari seem to deal differently with BASE HREF and Javascript window.location type requests. First, is this an accurate description of the problem? What's going on? And what's the best cross-browser solution to deal with this situation?
**Context:**
I have a small PHP flat file sitelet... | [
0.4912594258785248,
0.1674189418554306,
0.444886177778244,
-0.03941654786467552,
-0.15416373312473297,
0.061015255749225616,
0.34561190009117126,
-0.44238197803497314,
0.19249151647090912,
-0.6343119740486145,
-0.0005471279728226364,
0.3982198238372803,
-0.15812145173549652,
-0.24170103669... | |
in Javascript, and send to the server using code like this:
```
function allDone() {
// elided code for simplicity of stackoverflow question
var URI = "ProcessUserInput.php?";
URI = URI + "alphakeys=" + encodeURI( keys.join(",") );
URI = URI + "&sortedvalues=" + encodeURI( values.join(",") );
windo... | [
-0.14275729656219482,
0.35883909463882446,
0.27736422419548035,
-0.23951062560081482,
-0.041300684213638306,
-0.009679478593170643,
0.11513698101043701,
-0.3296065032482147,
-0.021313749253749847,
-0.7377136945724487,
-0.22527848184108734,
0.41002407670021057,
-0.25464606285095215,
0.04571... | |
The javascript and the PHP processor live in the same directory, so the call to **ProcessUserInput.php** works out fine. The input gets processed and everything works fine.
But when I test on Firefox, the JavaScript *does* appear to use the BASE HREF, because the script's output gets sent to
```
$basehref . '/Proces... | [
0.2932035028934479,
0.3495520055294037,
0.6402297616004944,
-0.3572024703025818,
-0.06781799346208572,
0.059326544404029846,
0.3906358480453491,
-0.45444250106811523,
-0.1174679547548294,
-0.9670190811157227,
0.02059173211455345,
0.5994548201560974,
-0.3899422287940979,
0.01858798041939735... | |
URI` in the javascript, calling a fully-resolved absolute URL
* Process the **.js** file with PHP and insert the `$basehref` variable into the script
* Move the files around
* Something else?
I'm sure there must be other ways to solve this too. What's the best way to deal with BASE HREF in JavaScript when IE and Firef... | [
0.060447610914707184,
0.1866983324289322,
0.4737564027309418,
-0.22153405845165253,
-0.3365946114063263,
-0.09778337180614471,
-0.05793677270412445,
-0.12184808403253555,
0.2742798924446106,
-0.5653307437896729,
-0.11182539910078049,
0.44350335001945496,
-0.3542137145996094,
0.105362519621... | |
I would like to find a regex that will pick out all commas that fall outside quote sets.
For example:
```
'foo' => 'bar',
'foofoo' => 'bar,bar'
```
This would pick out the single comma on line 1, after `'bar',`
I don't really care about single vs double quotes.
Has anyone got any thoughts? I feel like this shoul... | [
0.3088766038417816,
0.19409221410751343,
0.3341299295425415,
-0.13939161598682404,
-0.23996084928512573,
0.33946332335472107,
0.1234530657529831,
0.03521941602230072,
-0.05690205842256546,
-0.4497101604938507,
-0.10214396566152573,
0.5925616025924683,
-0.4538528025150299,
-0.17504706978797... | |
write:
```
/(,)(?=(?:[^"]|"[^"]*")*$)/
```
which will match all of them. Thus
```
'test, a "comma,", bob, ",sam,",here'.gsub(/(,)(?=(?:[^"]|"[^"]*")*$)/,';')
```
replaces all the commas *not* inside quotes with semicolons, and produces:
```
'test; a "comma,"; bob; ",sam,";here'
```
If you need it to work acro... | [
-0.13213342428207397,
0.25047242641448975,
0.5961286425590515,
-0.25487861037254333,
0.09608293324708939,
0.20375005900859833,
0.41705548763275146,
-0.2478123903274536,
-0.10158337652683258,
-0.38726791739463806,
-0.7364672422409058,
0.5432581901550293,
-0.4042578935623169,
-0.347084403038... | |
I want to be able to hide the header at the top of each grid column in a WPF ListView.
This is the XAML for my ListView:
```
<Window x:Class="ListViewTest.Test0.ListViewTest"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Emp... | [
0.21061024069786072,
-0.22209270298480988,
0.8685817718505859,
-0.2795841693878174,
-0.01815430261194706,
0.12782253324985504,
-0.197212353348732,
-0.4731168746948242,
-0.16571341454982758,
-0.5968964099884033,
0.11460255086421967,
0.3824304938316345,
0.16923029720783234,
0.151653438806533... | |
<GridViewColumn DisplayMemberBinding="{Binding XPath=Code}"/>
<GridViewColumn DisplayMemberBinding="{Binding XPath=Name}"/>
<GridViewColumn DisplayMemberBinding="{Binding XPath=Country}"/>
</GridView>
</ListView.View>
</ListView>
</Window>
```
The data I am ... | [
0.3541274666786194,
-0.14421553909778595,
0.6835450530052185,
-0.08236658573150635,
-0.14988377690315247,
0.07499506324529648,
-0.598517119884491,
-0.3249308168888092,
-0.4484485685825348,
-0.7969419360160828,
-0.21151527762413025,
-0.4577973186969757,
-0.41912218928337097,
0.1796975582838... | |
</Customer>
<Customer>
<Code>3344</Code>
<Name>Juan</Name>
<Country>Spain</Country>
</Customer>
<Customer>
<Code>4321</Code>
<Name>Dodo</Name>
<Country>Mars</Country>
</Customer>
</Customers>
```
Define a Style like so
```
<Window.Resources>
....
<Style x:Key="myHeaderStyle" TargetType="{x:Type Gr... | [
0.16677580773830414,
-0.1397862285375595,
0.5378482937812805,
-0.08753885328769684,
-0.14699237048625946,
-0.06235816329717636,
0.019605200737714767,
-0.09013551473617554,
-0.42120596766471863,
-0.5484722852706909,
-0.07096973806619644,
-0.01751570962369442,
-0.09115822613239288,
-0.140679... | |
In .NET, what is the most reliable way to detect if an instance of the same program is already running? Further, what is the best way to pass command line arguments to the already-running instance (e.g. to open a specific document)?
There appears to be three well-known ways of implementing single-instance applications ... | [
0.3608890175819397,
-0.026948506012558937,
-0.04154657572507858,
-0.08120634406805038,
-0.14774064719676971,
0.10602975636720657,
0.2894528806209564,
-0.4168882966041565,
-0.19092383980751038,
-0.5366132259368896,
-0.19927974045276642,
0.5121768116950989,
-0.6043587923049927,
-0.0808617770... | |
handle of the existing application so that you can then (somehow) communicate with it.
Another [CodeProject article](http://www.codeproject.com/KB/cs/CSSIApp.aspx) describes how to use classes in the Microsoft.VisualBasic namespace (which is accessible from C#) to implement a single-instance application.
I'm not at a... | [
0.08558040857315063,
-0.06496700644493103,
0.02078578807413578,
-0.0018059936119243503,
-0.4919672906398773,
0.2362338900566101,
0.3373478949069977,
-0.20157839357852936,
-0.1734212338924408,
-0.6423383355140686,
-0.04371551796793938,
0.3461625874042511,
-0.3133631646633148,
0.136229708790... | |
suggest you look into using named pipes, if all you need to do is send a relatively small message to the running application. Check out [System.IO.Pipes.NamedPipeClientStream](http://msdn.microsoft.com/en-us/library/system.io.pipes.namedpipeclientstream.aspx) for more information.
I should also note that if you're wor... | [
0.3525417149066925,
0.0024541232269257307,
-0.0037814131937921047,
0.09155239164829254,
0.06877870112657547,
-0.2896653413772583,
0.30372026562690735,
0.008954728953540325,
-0.4251466691493988,
-0.7101996541023254,
-0.054156847298145294,
-0.04965728521347046,
-0.13101400434970856,
0.072788... | |
I'd like to have a nice, tidy way of expressing the following java code as JNI:
```
try {
SomeMethod ();
}
catch (ExceptionType1 e) {
SomeAction ();
}
catch (ExceptionType2 e) {
SomeAction ();
}
catch (ExceptionType3 e) {
SomeAction ();
}
```
Is there a tidy JNI patter for doing this? At present, I h... | [
0.10165803134441376,
-0.03251950070261955,
0.16168677806854248,
-0.37637925148010254,
-0.012469584122300148,
-0.2289072424173355,
0.4024413824081421,
0.026053862646222115,
-0.036151908338069916,
-0.6904047727584839,
-0.0777558982372284,
0.2832433879375458,
-0.22507423162460327,
0.150662556... | |
cleanup ();
}
```
And, of course, this reoccurs for each exception so handled. There has to be a better way. Any recommendations? I'm not interested in porting all of my existing code over to JNA, so I'd like a pattern that can be implemented home-grown, so to speak.
To expand on my comment on C vs C++.
I'd try some... | [
0.3256068825721741,
-0.054980743676424026,
-0.09738194197416306,
-0.22176077961921692,
0.134739950299263,
-0.3270108699798584,
0.2855914831161499,
0.027275554835796356,
-0.3241076171398163,
-0.632404088973999,
-0.14022690057754517,
0.6662261486053467,
-0.5469721555709839,
0.013760460540652... | |
JavaClass(JNIEnv *env, const char *className) {
this.env = env;
cls = env->FindClass(className);
// handle errors
}
~JavaClass() {
env->DeleteLocalRef(cls);
}
bool isInstanceOf(jobject | [
-0.4099178612232208,
-0.13092651963233948,
0.26363757252693176,
-0.32712554931640625,
0.21257111430168152,
0.042941074818372726,
0.6113593578338623,
-0.2341029793024063,
-0.08053556829690933,
-0.3826126754283905,
-0.23088504374027252,
0.7728719115257263,
-0.1950777769088745,
-0.05264678224... | |
obj) {
return env->IsInstanceOf(obj, cls);
}
};
```
The client code would then look something like:
```
JavaClass ext1(env, "ExceptionType1");
JavaClass ext2(env, "ExceptionType2");
JavaClass ext3(env, "ExceptionType3");
SomeMethod();
if (ex = env->ExceptionOccurred()) {
if (ext1.isInstance... | [
-0.3728238642215729,
-0.20898516476154327,
0.7590383291244507,
-0.3586242198944092,
0.09952248632907867,
0.02077322266995907,
0.5313922762870789,
-0.5995990037918091,
-0.2198592871427536,
-0.49431705474853516,
-0.39400213956832886,
0.577419102191925,
-0.3724922239780426,
-0.029761692509055... | |
- in this one it's "`class.instanceof(object)`", instead of "`object instanceof class`"). | [
-0.2650010883808136,
0.06486275047063828,
-0.03563877195119858,
0.11193771660327911,
-0.13499420881271362,
-0.13915175199508667,
0.18324875831604004,
0.03916553035378456,
-0.21237246692180634,
-0.4300132393836975,
-0.2472621500492096,
0.3858523964881897,
-0.17252013087272644,
0.24987900257... | |
I want to store some fragments of an XML file in separate files.
It seems, there is no way to do it in a straight way:
Reading the chunks fails.
I always get the Exception
"javax.xml.transform.TransformerException: org.xml.sax.SAXParseException: The markup in the document following the root element must be well-formed... | [
0.2175542563199997,
0.25323522090911865,
-0.09426429122686386,
0.030407531186938286,
-0.10779226571321487,
-0.46173229813575745,
0.30021512508392334,
-0.19871747493743896,
-0.1522504687309265,
-0.4430024325847626,
-0.35376742482185364,
0.24324186146259308,
-0.1272810846567154,
0.1254112422... | |
API?
Test code:
```
String testChunk1 = "<e1>text</e1>";
String testChunk2 = "<e1>text</e1><e2>text</e2>";
// the following doesn't work with 'testChunk2'
StringReader sr = new StringReader(testChunk1);
StringWriter sw = new StringWriter();
TransformerFactory.newInstance().newTransformer().transform(
new Stream... | [
0.47145384550094604,
-0.1344262957572937,
0.1859215497970581,
0.12938767671585083,
-0.29990240931510925,
-0.08433035016059875,
0.47893738746643066,
-0.6001130938529968,
0.10474594682455063,
-0.5424658060073853,
0.056600023061037064,
0.5600476264953613,
-0.14524295926094055,
0.0125954570248... | |
want to transform such fragments with XSLT, a very common approach is to put a wrapper element around them, which can then act as the root of the DOM. | [
0.16670547425746918,
-0.06322149932384491,
0.16352711617946625,
0.13599152863025665,
0.03882506489753723,
-0.39791399240493774,
0.1550157368183136,
-0.26141777634620667,
0.1367015391588211,
-0.15852737426757812,
-0.2772078514099121,
0.38911372423171997,
-0.2544753849506378,
0.3107150495052... | |
I am designing a class...
there are crucial methods that need an object passed to them or they need to be able to "get" an object.
So the question is, should you use getter/setters OR directly send the object as an argument to the method - in order for the method to work properly. Or should you set objects via the co... | [
0.38510391116142273,
-0.013207861222326756,
-0.1339639276266098,
0.35258418321609497,
-0.035164326429367065,
0.02870272658765316,
0.11376077681779861,
-0.2738392949104309,
0.014668884687125683,
-0.5731614232063293,
-0.012088089250028133,
0.4469606280326843,
-0.32919296622276306,
0.10597008... | |
a database), then it's a "dependency" and should be part of the constructor.
If your class can survive without it, or can use some default value, then you could instead make it a property and check if it's assigned before being used.
I'd strongly advocate constructor dependency injection in most cases though. | [
0.31264936923980713,
-0.18148848414421082,
-0.35037004947662354,
0.3383468687534332,
-0.0733700767159462,
-0.3026522994041443,
0.19745656847953796,
-0.07095883041620255,
0.08027296513319016,
-0.5096817016601562,
-0.08072616159915924,
0.516477108001709,
-0.492575466632843,
0.245002731680870... | |
I get the following error when restarting my rails app. I've had this problem before, on another server with another app, but can't remember what the problem was, or how I solved it.
```
Rails Error: Unable to access log file. Please ensure that /apps/staging/releases/20090310162127/log/staging.log exists and is chmod... | [
-0.3443739116191864,
0.1782311052083969,
0.5168581008911133,
-0.05304824933409691,
0.09369169920682907,
-0.026958543807268143,
0.3418639004230499,
0.1587042659521103,
-0.24509800970554352,
-0.7090269923210144,
-0.17552196979522705,
0.8450586795806885,
-0.3763286769390106,
0.004992302041500... | |
on?
It turned out to be a subtle rails bug:
When an exception is raised in these two lines
```
logger = ActiveSupport::BufferedLogger.new(configuration.log_path)
logger.level = ActiveSupport::BufferedLogger.const_get(configuration.log_level.to_s.upcase)
```
rails assumes it can't find the log file. However, the act... | [
0.2394493818283081,
-0.1391647905111313,
0.5042064189910889,
-0.04963875189423561,
0.5554131865501404,
0.03937026858329773,
0.49180421233177185,
0.02848883345723152,
-0.18080370128154755,
-0.47955092787742615,
-0.36760637164115906,
0.5674585103988647,
-0.669739842414856,
0.2862029075622558... | |
Ok, have a client that has existing links coming in from searchmarketing. I am in process of migrating the program from Cold Fusion to PHP.
```
RewriteEngine on
RewriteRule ^cat_ap~([^~]+)~(.*)\.htm$ /urban/cat_ap.php?$1=$2 [R]
```
Currently I have a URL structure:
```
http://www.test.com/urban/cat_ap~nid~5964.htm
... | [
0.21720722317695618,
0.5041518211364746,
0.5198773741722107,
-0.009019662626087666,
-0.05895841866731644,
-0.14106832444667816,
0.29804527759552,
-0.1240270808339119,
-0.2871844172477722,
-0.7504464983940125,
0.04519728198647499,
0.3293798267841339,
-0.12313060462474823,
0.1508701443672180... | |
that the "long" way...
```
dc.MyTable
.GroupBy(r => new
{
Name = r.UserName,
Year = r.SomeDateTime.Year,
Month = r.SomeDateTime.Month
}) | [
0.28099411725997925,
-0.07616100460290909,
0.7335351705551147,
-0.20217470824718475,
0.24371734261512756,
-0.01668168045580387,
0.1457062065601349,
-0.0249310489743948,
-0.4704493582248688,
0.03526788949966431,
-0.15764035284519196,
0.34951144456863403,
0.19334053993225098,
0.5036193132400... | |
.Select(r => new
{
Name = r.UserName,
Year = r.Year,
Month = r.Month,
Count = r.Count()
})
.OrderBy(r | [
-0.15937304496765137,
0.02251359447836876,
0.702408492565155,
-0.34400850534439087,
0.26178067922592163,
0.2271246761083603,
0.3773236870765686,
-0.24467790126800537,
-0.353289932012558,
-0.44487130641937256,
-0.5788230895996094,
0.11552334576845169,
-0.16246415674686432,
0.757726371288299... | |
=> r.Year)
.ThenBy(r => r.Month)
.ThenBy(r => r.Name);
```
If you need the format as a string, do that later at the UI. Either by reconstructing a `DateTime` etc, or using `CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(...)`. | [
0.2816002368927002,
-0.19157472252845764,
0.696492075920105,
-0.23602725565433502,
0.2635064423084259,
0.02666269801557064,
0.04625444859266281,
0.002626998582854867,
-0.2282494306564331,
-0.36606189608573914,
-0.48103225231170654,
-0.004519532434642315,
0.17604053020477295,
0.510570764541... | |
**EDIT:** I've offered a bounty, since I doubt I'll be getting any answers otherwise.
Lately I've been working with listviews and I've decided to add an **icon** for each item indicating whether it's input or output. The icons add fine, but they're not transparent:
 with LR\_CREATEDIBSECTION to load the bitmap as a 32bpp dib section.
* Add the image using ImageList\_Add()
(the last option is kind of tricky as the number of tools that support writing out 32bit bmp files with properly pre multiplied alpha channels is rather ... | [
0.3819105625152588,
-0.1631910502910614,
1.0324374437332153,
-0.18964889645576477,
-0.33968713879585266,
0.10441043972969055,
0.1373305320739746,
-0.6470483541488647,
-0.3920796513557434,
-0.72776198387146,
-0.32815706729888916,
0.7456676959991455,
-0.549401044845581,
-0.18612296879291534,... | |
I am just trying to write a small web page that can parse some text using a regular expression and return the resulting matches in a table. This is the first I've used python for web development, and I have to say, it looks messy.
My question is why do I only get output for the last match in my data set? I figure it h... | [
0.3224816620349884,
0.17324919998645782,
0.14273864030838013,
0.050752054899930954,
-0.32177987694740295,
-0.22584547102451324,
0.012773181311786175,
-0.07810010761022568,
-0.15272307395935059,
-0.5815983414649963,
0.266399621963501,
0.18717537820339203,
-0.7264270186424255,
-0.17250882089... | |
data:
```
12345 SOME USER
09876 SOMEONE ELSE
54678 ANOTHER USER
```
My simple page:
```
<%
import re
pattern = form['pattern']
p = re.compile(pattern)
data = form['data']
matches = p.finditer(data)
lines = form['groups'].split("\n")
groupids ={}
for line in lines:
key, val = line.split(' ')
groupids[int(key.s... | [
-0.12771905958652496,
0.16022129356861115,
0.6939603686332703,
-0.041530393064022064,
-0.3002076745033264,
0.1838228553533554,
0.5248183608055115,
-0.9222933053970337,
-0.1425711065530777,
-0.534299373626709,
-0.28925687074661255,
0.37986692786216736,
-0.07453272491693497,
-0.1911434680223... | |
groupids[int(key.strip())] = val.strip()
for k,v in groupids.iteritems():
print "%s\t" % v,
print ''
for match in matches:
for i in range(1, len(match.groups())+1):
print "%s\t" % match.group(i),
print ''
```
Output:
```
PIN FNAME LNAME
12345 TESTS USERS
34567 TESTS USERS
56789 TESTS US... | [
-0.28498148918151855,
-0.001541896490380168,
0.7416976690292358,
-0.19825640320777893,
-0.07086091488599777,
0.17946147918701172,
0.45939406752586365,
-0.8820676803588867,
0.02099715732038021,
-0.598980188369751,
-0.12421002984046936,
0.4644604027271271,
-0.32098737359046936,
-0.0936067327... | |
only runs after the first has finished. The second is not inside the first because it isn't indented to say so.
From the [doc](http://www.modpython.org/live/mod_python-3.1.2b/doc-html/pyapi-psp.html), I *think* what you need to be saying is:
```
<%
for match in matches:
# begin
%><tr><%
for group in match.gro... | [
0.20069904625415802,
-0.17782427370548248,
0.378143846988678,
-0.07257092744112015,
-0.14591187238693237,
-0.2134658545255661,
0.5240440964698792,
-0.2638593316078186,
-0.11224400252103806,
-0.4413376450538635,
-0.13924682140350342,
0.27778345346450806,
-0.372462660074234,
-0.1816036105155... | |
and you should look for another, less awful templating syntax. There are many, many templating languages for Python that have a more sensible syntax for control structures. As an example, in the one I use the above would look like:
```
<px:for item="match" in="matches"><tr>
<px:for item="group" in="match.groups()"... | [
0.07196708768606186,
-0.027184996753931046,
0.3970770835876465,
0.18419957160949707,
-0.14774703979492188,
-0.06677168607711792,
0.030223220586776733,
-0.3083924651145935,
-0.22596167027950287,
-0.5295858383178711,
-0.02615281753242016,
0.4232107698917389,
-0.38393634557724,
-0.08119118213... | |
I would like to trigger a click on the browse button on a hidden FileUpload widget.
The following code works fine on IE 6+, but doesn't work in FireFox.
```
final FileUpload upload = new FileUpload();
upload.setVisible(false);
upload.setName("uploadFormElement");
panel.add(upload);
panel.add( new Button("Select Fi... | [
0.30805832147598267,
-0.04426654055714607,
0.8107189536094666,
-0.08259246498346329,
0.2019127607345581,
-0.19969697296619415,
0.5927619934082031,
-0.49309277534484863,
-0.09548251330852509,
-0.7458451986312866,
-0.20406809449195862,
0.7608400583267212,
-0.46130743622779846,
-0.06415727734... | |
so on. Unfortunately
> Mozilla and Opera haven't added this
> method to file upload fields. I wonder
> why, adding it is not really a
> security risk since the worst that can
> happen is that the file selection
> window pops up. | [
0.33142155408859253,
-0.07827950268983841,
0.25151604413986206,
0.08818627893924713,
-0.08873002976179123,
-0.4749721586704254,
0.3693099021911621,
0.17538657784461975,
-0.2703005373477936,
-0.7005718946456909,
-0.19400404393672943,
0.4021758735179901,
-0.3259982168674469,
0.28444921970367... | |
In java why is the following code not allowed by the compiler?
```
public class Test {
public static void main(String[] args) {
int x;
int x = 4;// the error is generated here
}
}
```
Because the second
```
int x = 4;
```
Is attempting to create a variable names "x" of type int, but thi... | [
0.03447701036930084,
0.15240196883678436,
-0.1686028689146042,
-0.26135897636413574,
-0.12984327971935272,
-0.32873860001564026,
0.4535665214061737,
-0.1635461002588272,
-0.14649637043476105,
-0.379124253988266,
-0.1557134985923767,
0.20099371671676636,
-0.6440479159355164,
-0.017433010041... | |
value 4 to x.
Or even better:
```
int x = 4;
```
That creates the variable x of type int and assign the value of 4. | [
0.047257907688617706,
0.15096169710159302,
0.21114717423915863,
-0.21580378711223602,
-0.12099263072013855,
0.12969332933425903,
0.1301364153623581,
-0.16175760328769684,
0.009296998381614685,
-0.19960258901119232,
-0.5128200650215149,
0.6239223480224609,
-0.6789345741271973,
0.08599042147... | |
I've currently got my output audio on the iPhone setup as this :
```
AudioStreamBasicDescription audioFormat;
audioFormat.mSampleRate = 48000;
audioFormat.mFormatID = kAudioFormatLinearPCM;
audioFormat.mFormatFlags = kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked;
audioFormat.mFramesPerPacket = 1;
... | [
0.30058351159095764,
0.21645605564117432,
0.563296377658844,
-0.19436924159526825,
0.10692865401506424,
0.11117762327194214,
0.22739127278327942,
-0.45932736992836,
-0.20907625555992126,
-0.46597856283187866,
-0.012311406433582306,
0.9930928945541382,
0.08467616885900497,
-0.01273464877158... | |
in the menu.
Definitely try using a 44100 Hz sampling rate. With 48000 I see the same function that you posted appearing in the callstacks -- no such function shows up when using 44100. The canonical audio format for Audio Units on the iPhone is non-interleaved 8.24 linear PCM:
```
streamFormat.mFormatID = kA... | [
-0.1991916447877884,
0.13262583315372467,
0.6621758341789246,
0.22914128005504608,
0.27021709084510803,
0.18024949729442596,
0.15874789655208588,
-0.055601611733436584,
0.0947791263461113,
-0.5399309992790222,
-0.23963560163974762,
1.0270241498947144,
-0.07815147191286087,
0.12371478974819... | |
| kLinearPCMFormatFlagIsNonInterleaved
| (24 << kLinearPCMFormatFlagsSampleFractionShift);
streamFormat.mSampleRate = mixing_rate;
streamFormat.mBitsPerChannel = 32;
streamFormat.mChannelsPerFrame = 2;
streamFormat.mFramesPerPacket = 1;
streamFormat.mBytesPerFrame = ( streamFormat.mBitsPerCh... | [
-0.39873433113098145,
-0.17315936088562012,
0.8249708414077759,
-0.02844492346048355,
0.1912904977798462,
0.35238149762153625,
0.3980458974838257,
-0.4227399528026581,
-0.49013617634773254,
-0.6080586910247803,
-0.3053015470504761,
0.38237565755844116,
-0.3308045268058777,
0.46011137962341... | |
I want to use [YUI Compressor](http://developer.yahoo.com/yui/compressor/) to *combine* and compress my css and js file sets when I compile my project. YUI Compressor only takes as input single files. I've tried using the following (Windows) commands to append to the output files, but strange characters appear in the o... | [
0.23112145066261292,
0.09831316024065018,
0.31817978620529175,
-0.14278168976306915,
-0.3077121078968048,
0.17207035422325134,
0.23241041600704193,
-0.3458061218261719,
-0.017414171248674393,
-0.8548979759216309,
-0.07137461751699448,
0.5914508104324341,
-0.2839163541793823,
0.169061258435... | |
in visual studio, as part of a TFS Build or just import the dll's into your application and use it in that (eg. compressing on the fly). | [
0.7560721635818481,
-0.1673150360584259,
-0.024333037436008453,
-0.17898176610469818,
-0.09458421170711517,
-0.3453083634376526,
-0.33712339401245117,
0.08037782460451126,
-0.11365935951471329,
-0.7487621903419495,
-0.3109707832336426,
0.8406507968902588,
-0.25709307193756104,
-0.128945082... | |
I know that for the image onload to work you have to set the src after the onload handler was attached. However I want to attach onload handlers to images that are static in my HTML. Right now I do that in the following way (using jQquery):
```
<img id='img1' src='picture.jpg'>
```
```
$('#img1').load( function() {
... | [
0.3983335793018341,
0.04536053165793419,
0.5330885052680969,
-0.30672118067741394,
-0.3002428710460663,
-0.15584686398506165,
0.16693171858787537,
-0.423348993062973,
-0.2683314383029938,
-0.5142598152160645,
-0.03736152872443199,
0.754613995552063,
-0.7061030268669128,
-0.0820556506514549... | |
one image is that when doing this:
```
<img class='img1' src='picture.jpg'>
<img class='img1' src='picture2.jpg'>
```
```
$('.img1').load( function() {
alert('foo');
})
.attr('src', $('.img1').attr('src'));
```
That both images will have src='picture.jpg'
You can trigger the event (or it's handler) directly by ca... | [
0.28385141491889954,
-0.2899750769138336,
0.3831678032875061,
-0.13507035374641418,
-0.16096177697181702,
-0.1755882203578949,
-0.017222510650753975,
-0.35080528259277344,
-0.29655885696411133,
-0.5566090941429138,
-0.13021504878997803,
0.7278180122375488,
-0.6152387857437134,
-0.158290043... | |
use something like this:
```
$('img.static')
.load(function(){
alert('foo');
return false; // cancel event bubble
})
.each(function(){
// trigger events for images that have loaded,
// other images will trigger the event once they load
if ( this.complete && this.naturalWidth !== 0 ) {
$... | [
0.39361295104026794,
-0.3682228922843933,
0.4377240836620331,
-0.2046792060136795,
0.17436981201171875,
-0.5751674771308899,
0.18782034516334534,
-0.12297527492046356,
-0.28536057472229004,
-0.5268483757972717,
-0.29394659399986267,
0.9889576435089111,
-0.6749215126037598,
-0.2032916694879... | |
in the img handler.
For the record: The `img.src=img.src` triggering solution will unfortunately not work correctly on Safari. You will need to set the `src` to something else (like # or about:blank) and then back for reload to happen. | [
0.14165230095386505,
-0.01704813726246357,
0.09397288411855698,
-0.1620865762233734,
-0.016235169023275375,
-0.4484472870826721,
0.3813985586166382,
0.09142214059829712,
-0.3899618983268738,
-0.408297061920166,
-0.3373381793498993,
0.5047423839569092,
-0.7136033177375793,
-0.02714138105511... | |
I have a situation where I'm marching through a vector, doing things:
```
std::vector<T>::iterator iter = my_list.begin();
for ( ; iter != my_list.end(); ++iter )
{
if ( iter->doStuff() ) // returns true if successful, false o/w
{
// Keep going...
}
else
{
for ( ; iter != m_list.begin(); --iter ) ... | [
0.06157517805695534,
-0.21566535532474518,
0.804332971572876,
-0.41105857491493225,
-0.09202461689710617,
0.5484461188316345,
0.647463858127594,
-0.321898877620697,
-0.589203417301178,
-0.6639920473098755,
-0.20015576481819153,
0.4485408067703247,
-0.39185187220573425,
0.07220732420682907,... | |
loop successfully.
However, if something goes wrong while I'm doing stuff, I want to be able to undo everything - basically retrace my steps back to the very beginning of the vector, undoing everything one at a time in reverse order.
My problem is that when I get to `my_list.begin()` - as shown in the nested for loop... | [
0.4104919731616974,
0.006761710625141859,
0.5163998603820801,
-0.1006883755326271,
0.0125862006098032,
-0.06083947792649269,
0.6714490652084351,
-0.032920606434345245,
-0.5288705229759216,
-0.3335847556591034,
0.07895088195800781,
0.349220335483551,
-0.4112769067287445,
0.169908806681633,
... | |
done when I get to `my_list.rend()`. However, I can't compare a `std::vector::iterator` to a `std::vector::reverse_iterator`.
Given what I'm trying to do, what's the best choice of iterator-type / loop combination?
While using reverse iterators via `rbegin()` and `rend()` works nicely, unfortunately I find that conver... | [
0.13824701309204102,
0.1701207011938095,
0.1706007868051529,
-0.2487652748823166,
-0.01246321015059948,
0.09804275631904602,
0.4287569522857666,
-0.20649823546409607,
-0.14287041127681732,
-0.6371474862098694,
0.03506612777709961,
0.8346162438392639,
-0.17724478244781494,
0.003499201498925... | |
wouldn't have to call `undoStuff()` for the iterator that failed - after all, `doStuff()` said it didn't succeed.
```
// handle the situation where `doStuff() failed...
// presumably you don't need to `undoStuff()` for the iterator that failed
// if you do, I'd just add it right here before the loop:
//
// iter->... | [
-0.11382044851779938,
0.1002236008644104,
0.38266521692276,
-0.44376295804977417,
0.4507543742656708,
-0.027167364954948425,
0.5002914071083069,
-0.44435009360313416,
-0.29258960485458374,
-0.4299318492412567,
-0.5081958770751953,
0.9126410484313965,
-0.33394524455070496,
-0.14653155207633... | |
I was poking around in XNA and saw that the `Vector3` class in it was using public fields instead of properties. I tried a quick benchmark and found that, for a `struct` the difference is quite dramatic (adding two Vectors together a 100 million times took 2.0s with properties and 1.4s with fields). For a reference typ... | [
0.34548676013946533,
-0.16715438663959503,
-0.06612539291381836,
0.1398511379957199,
-0.3955725431442261,
0.011984585784375668,
0.12567904591560364,
-0.1479579359292984,
-0.12980663776397705,
-0.5954179763793945,
0.2321731597185135,
0.29785624146461487,
-0.46793246269226074,
0.148537874221... | |
the JIT? I know you can't guarantee what the JIT decides to do, but surely this is fairly high on the list of probability? What else is there that separates a public field from a property at the machine level?
And one thing I've been wondering: how is an auto-implemented property (`public int Foo { get; set; }`) 'bet... | [
0.33066388964653015,
-0.0030512476805597544,
-0.2833598256111145,
0.10029130429029465,
-0.26122358441352844,
-0.061214204877614975,
0.21880190074443817,
0.012769711203873158,
-0.11310037225484848,
-0.471869558095932,
0.036434613168239594,
0.5697184801101685,
-0.28903433680534363,
0.1760797... | |
.NET 3.5 SP1 which I believe fixed issues where methods with structs (or methods *of* structs, I'm not sure) weren't in-lined, so that isn't it. I think I am using it at least, it's certainly installed but then again, I'm using Vista 64-bit with SP1 which should have DX10.1 except that I don't have DX10.1 ..
Also: yea... | [
0.1794423758983612,
-0.2555529475212097,
0.5096042156219482,
0.18275970220565796,
-0.37782105803489685,
-0.6629095077514648,
0.48364636301994324,
-0.1793866604566574,
-0.11387225240468979,
-0.8852702975273132,
-0.08135921508073807,
0.7373122572898865,
-0.2685737609863281,
-0.12423735111951... | |
field access.
**EDIT 2**: So I created another `struct` that used explicit GetX() methods (o how I don't miss my Java days *at all*) and that performed the same whether I disabled in-lining on it (through `[MethodImplAttribute(MethodImplOptions.NoInlining)]`) or not, so conclusion: non-static methods are apparently n... | [
-0.21931059658527374,
-0.24044860899448395,
0.12938572466373444,
0.08657529950141907,
-0.23278433084487915,
-0.06663424521684647,
0.19886432588100433,
0.14348945021629333,
-0.12275779247283936,
-0.41864660382270813,
0.0857175812125206,
0.5185195207595825,
-0.31047412753105164,
0.0386218689... | |
it?
This is kind of a shame, since it will really make me think about using properties on performance critical stuff, yet using fields makes me feel dirty and I might as well write what I'm doing in C.
**EDIT 3**: I found [this](http://www.ademiller.com/blogs/tech/2008/08/c-inline-methods-and-optimization/) posting ... | [
0.2500075399875641,
-0.039817266166210175,
0.28286683559417725,
0.19386279582977295,
-0.19563175737857819,
-0.3368035852909088,
0.17770102620124817,
-0.332064151763916,
0.10843205451965332,
-0.13802915811538696,
-0.24572083353996277,
0.7315922975540161,
-0.452070951461792,
-0.2660848796367... | |
Edit3 - see my updated comment: I believe this is x86 JIT vs x64 JIT issues. the JIT in x64 is not as mature. I'd expect MS to improve this quickly as more 64 bit systems are coming online every day. – Reed Copsey
And my response to his answer:
> Thanks, this is the answer! I tried forcing a x86 build and all methods... | [
0.24721801280975342,
0.5698650479316711,
-0.1991053968667984,
0.18981681764125824,
-0.44620466232299805,
-0.17367564141750336,
0.22814126312732697,
-0.14648950099945068,
-0.1828981190919876,
-0.47614601254463196,
0.2740274667739868,
0.4994567036628723,
-0.24753309786319733,
0.0052389423362... | |
answer so it stands out better. – JulianR
Thanks everyone!
Edit 2:
I had another potential thought here:
You mentioned that you are running on x64. I've tested this same issue on x86, and seen the same performance when using auto-properties vs. fields. However, if you look around on Connect and mailing list/forum po... | [
0.3197292685508728,
0.17646493017673492,
0.26250016689300537,
0.3197896182537079,
-0.3935118317604065,
-0.21668663620948792,
0.02002570778131485,
0.1042596623301506,
-0.3191318213939667,
-0.42219486832618713,
0.17013980448246002,
0.6055985689163208,
0.009799291379749775,
0.0594746507704257... | |
on the x86 side, and was the fact that method calls that took structs as a parameter would never be inlined on x86 prior to .net3.5sp1. That's pretty much irrelevant to this discussion on your system.
---
Edit 3:
Another thing: As to why XNA is using fields. I actually was at the Game Fest where they announced XNA.... | [
0.09975580871105194,
-0.07113492488861084,
0.10893556475639343,
0.23938274383544922,
-0.5740618705749512,
-0.3935288190841675,
0.023121289908885956,
0.09010320901870728,
-0.396352082490921,
-0.16790522634983063,
0.27128148078918457,
0.7283599376678467,
-0.44061002135276794,
-0.110754199326... | |
properties are better than public fields:
They allow you to change the implementation in v2 of your class, and add logic into the property get/set routines as needed, without changing your interface to your end users. This can have a profound effect on your ability to maintain your library and code over time.
---- Fr... | [
0.2314339429140091,
-0.12367688864469528,
0.006330148316919804,
0.47674041986465454,
0.05664634332060814,
-0.3340962529182434,
0.3207322955131531,
-0.13228487968444824,
-0.08929949998855591,
-0.7151582837104797,
0.07299331575632095,
0.733126163482666,
-0.09867074340581894,
0.10999866575002... | |
of the JIT. This can cause performance benchmarks to change. | [
0.11276965588331223,
0.08023380488157272,
0.022881703451275826,
0.14067481458187103,
-0.2609076201915741,
-0.028988393023610115,
0.27394524216651917,
0.04624861478805542,
0.06874137371778488,
-0.45259612798690796,
0.05688696354627609,
0.5910220742225647,
-0.0005076552042737603,
0.121206670... | |
I thought by setting the first element to a null would clear the entire contents of a char array.
```
char my_custom_data[40] = "Hello!";
my_custom_data[0] = '\0';
```
However, this only sets the first element to null.
or
```
my_custom_data[0] = 0;
```
rather than use `memset`, I thought the 2 examples above sh... | [
0.03121243230998516,
0.09028208255767822,
0.18979601562023163,
-0.28400900959968567,
-0.0992317646741867,
0.2423965334892273,
0.41466474533081055,
-0.15592104196548462,
-0.3545066714286804,
-0.47370636463165283,
-0.22729402780532837,
0.46014404296875,
-0.23104506731033325,
0.22739960253238... | |
to view this as a C/C++ null terminated string, setting the first byte to 0 will effectively clear the string. | [
-0.10681790858507156,
-0.03473038226366043,
0.12747466564178467,
-0.26416274905204773,
0.0920446515083313,
-0.14530763030052185,
0.4188757538795471,
0.2133222222328186,
-0.03948023542761803,
0.06801678240299225,
-0.4109239876270294,
0.17984715104103088,
-0.3064591884613037,
0.2748335897922... | |
My kids asked me this question and I couldn't really give a concise, understandable explanation.
So I'm hoping someone on SO can.
How about, "Because computers just follow instructions, and random numbers are the opposite of following instructions. If you make a random number by following instructions, then it's not v... | [
0.5579888820648193,
-0.16117359697818756,
-0.2613579332828522,
0.5025883316993713,
0.04214441031217575,
-0.11160561442375183,
0.0741368979215622,
0.4298376142978668,
-0.6011723279953003,
-0.4216268062591553,
0.1364496350288391,
0.0780206173658371,
-0.18264852464199066,
0.000587642367463558... | |
I have generated the following regular expression in a project I am working on, and it works fine, but out of professional curiosity I was wondering If it can be "compressed/shortened":
```
/[(]PRD[)].+;.+;.*;.+;.+;.*;.*;.*;/
```
Regexes have always seemed like voodoo to me...
For starters, the single-character bl... | [
0.16104328632354736,
0.1332830786705017,
0.2712903320789337,
0.06363179534673691,
-0.3684749901294708,
0.2775435149669647,
0.2575114667415619,
0.2252553105354309,
-0.4966626763343811,
-0.5603585243225098,
-0.008510136045515537,
0.22959625720977783,
-0.06577383726835251,
0.3877405822277069,... | |
I need to put different codes in one file to many files.
The file is apparantly shared by AWK's creators at their homepage.
The file is also [here](http://dpaste.com/12282/) for easy use.
**My attempt to the problem**
I can get the lines where each code locate by
```
awk '{ print $1 }'
```
However, I do no know ho... | [
0.688095211982727,
0.009500740095973015,
0.010025742463767529,
0.09820582717657089,
-0.2491309493780136,
0.24092723429203033,
0.5526293516159058,
0.2701035737991333,
0.18338291347026825,
-0.8515859842300415,
0.12426836043596268,
0.09738443791866302,
-0.1465764343738556,
0.1711777150630951,... | |
that the problem can be solved by AWK and with Python too. Perhaps, we need to use them together.
**[edit]** after the first answer
I get the following error when I try to execute it with awk
```
$awk awkcode.txt
awk: syntax error at source line 1
context is
>>> awkcode <<< .txt
awk: bailing out at source li... | [
0.28184887766838074,
0.032966434955596924,
0.0020880738738924265,
-0.04369610920548439,
-0.06586267799139023,
-0.030605962499976158,
0.49266910552978516,
-0.354158878326416,
0.18518094718456268,
-0.4809015989303589,
-0.12296470999717712,
0.47444140911102295,
-0.4640216827392578,
0.10347831... | |
a bundle into separate files**
$1 != prev { close(prev); prev = $1 }
{ print substr($0, index($0, " ") + 1) >$1 }
3. Run the following command:
awk -f unbundle.awk awkcode.txt | [
0.5514320731163025,
-0.7834665775299072,
0.36201950907707214,
-0.02332155779004097,
0.07647580653429031,
-0.08607654273509979,
0.2909567952156067,
-0.6575942635536194,
0.2989616096019745,
-0.4101007878780365,
-0.25507766008377075,
0.5175847411155701,
-0.5463271737098694,
-0.066562332212924... | |
I have the following layout for my mvc project:
* /Controllers
+ /Demo
+ /Demo/DemoArea1Controller
+ /Demo/DemoArea2Controller
+ etc...
* /Views
+ /Demo
+ /Demo/DemoArea1/Index.aspx
+ /Demo/DemoArea2/Index.aspx
However, when I have this for `DemoArea1Controller`:
```
public class DemoArea1Controller : Control... | [
-0.06071602180600166,
-0.13464049994945526,
0.3582785725593567,
0.012067193165421486,
0.1468106508255005,
0.1058812290430069,
-0.041013382375240326,
-0.3551390469074249,
-0.3988938629627228,
-0.8007352352142334,
-0.27816420793533325,
0.6621374487876892,
-0.2074146717786789,
0.2570989131927... | |
CustomViewEngine : WebFormViewEngine
{
public CustomViewEngine()
{
var viewLocations = new[] {
"~/Views/{1}/{0}.aspx",
"~/Views/{1}/{0}.ascx",
"~/Views/Shared/{0}.aspx",
"~/Views/Shared/{0}.ascx",
"~/AnotherPath/Views/{0}.ascx" | [
0.23533804714679718,
-0.4636930227279663,
0.9373199343681335,
-0.02866501174867153,
-0.14698277413845062,
0.32593297958374023,
0.0019216142827644944,
-0.10027283430099487,
-0.4876424968242645,
-0.870754599571228,
0.04015206918120384,
0.6847190260887146,
-0.1587907373905182,
0.1443702131509... | |
// etc
};
this.PartialViewLocationFormats = viewLocations;
this.ViewLocationFormats = viewLocations;
}
}
```
Make sure you remember to register the view engine by modifying the Application\_Start method in your Global.asax.cs
```
protected void Application_Start()
{
ViewEngines.Engin... | [
-0.21655485033988953,
0.015604414977133274,
0.7887659072875977,
-0.31607773900032043,
0.24552468955516815,
-0.004814389161765575,
0.30769461393356323,
0.05547293648123741,
-0.24775250256061554,
-0.6939883232116699,
-0.44271716475486755,
0.6887186765670776,
-0.390897661447525,
0.21138790249... | |
Is there an easy and fast way to calculate the rank of a field in a database using Ruby on Rails? For example, if I have a math\_scores table, and would like to find a given a
```
MathScore.find(:all, :condtions => ... :order =>...)
```
then iterate through all of them to find out where the test score falls, but th... | [
0.04745902493596077,
0.14131353795528412,
0.13339978456497192,
-0.029459061101078987,
-0.22689180076122284,
0.03265504166483879,
0.023104669526219368,
-0.4789574444293976,
0.02500051259994507,
-0.5431981682777405,
0.21115688979625702,
0.4692326486110687,
-0.010442587547004223,
0.1644495725... | |
"select count(*) as rank
from (
select * from math_scores
where score > (select score from high_scores where test_id = 33
AND first_name = 'John' AND last_name = 'Doe'
)
order by score desc
) as s"
)
```
I get `[#<HighScore:0x6ca4724 | [
0.08441179990768433,
0.061527300626039505,
0.6243457198143005,
0.258989155292511,
0.16555772721767426,
0.13053590059280396,
0.4343537390232086,
-0.4697728753089905,
-0.33722153306007385,
-0.36160147190093994,
-0.12151706218719482,
0.11055213212966919,
0.3553053140640259,
0.2738037407398224... | |
@attributes={"rank"=>"3"}>]:Array` based upon the query, but how do I get at the rank value?
Thanks in advance,
Ben
```
sql = "select count(*) as rank from (select * from math_scores where score > (select score from high_scores where test_id = 33 AND first_name = 'John' AND last_name = 'Doe') order by score desc) as s... | [
0.025803012773394585,
0.21313844621181488,
0.5911900401115417,
0.06739965826272964,
-0.0053332108072936535,
-0.014221396297216415,
0.3502624034881592,
-0.6620041728019714,
-0.13583005964756012,
-0.4786015450954437,
0.03349122405052185,
0.5866780877113342,
0.23786517977714539,
0.18999502062... | |
I'd like to say that the height of a text area is equal to, say, 50% of the height of the viewport. How can I do that? A simple `height: 50%` doesn't do the trick.
> A simple height: 50% doesn't do the trick.
No, because its parent doesn't have an explicit height. So 50% of what? Parent says ‘auto’, which means base i... | [
0.2849520742893219,
0.3283382058143616,
0.4744583070278168,
0.31751206517219543,
0.027371281757950783,
0.18806695938110352,
0.3134134113788605,
-0.2985600233078003,
0.16545213758945465,
-0.478393018245697,
-0.0984700545668602,
0.7448945045471191,
0.14879508316516876,
-0.3380967676639557,
... | |
doc:
```
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<style type="text/css">
html, body { margin: 0; padding: 0; }
html, body, #mything, #mything textarea { height: 100%; }
</styl... | [
-0.06936546415090561,
-0.060505907982587814,
0.913600742816925,
-0.014194067567586899,
-0.18550586700439453,
0.2396523654460907,
-0.44207635521888733,
-0.6148459911346436,
-0.2501009702682495,
-0.6511781811714172,
0.03923927620053291,
0.5469903945922852,
0.29330679774284363,
-0.02238973602... | |
the nearest ancestor with a ‘position’ setting other than default ‘static’. If there are no ancestor elements with positioning, then dimensions are based on the “Initial Containing Block”, which is the same size as the viewport.
Finally, there's the trivial problem of ‘100%’ being slightly too big because of the addit... | [
-0.06827840954065323,
0.053111836314201355,
0.5266216397285461,
0.12128757685422897,
0.06499610096216202,
0.043951813131570816,
0.41265568137168884,
-0.2252991497516632,
0.17922601103782654,
-0.7705100774765015,
-0.10174117982387543,
0.21047650277614594,
-0.05233785882592201,
0.08788777887... | |
as ‘-moz-box-sizing’). | [
0.03557547926902771,
0.03746054321527481,
0.44518351554870605,
-0.029476361349225044,
0.14103294909000397,
0.08734550327062607,
0.10672546923160553,
-0.43216472864151,
-0.2747695744037628,
0.04361943528056145,
-0.5873026847839355,
0.3898029923439026,
-0.12380926311016083,
0.093956425786018... | |
Hey! I'm relative new to both Java EE and Stackowerflow, please be kind :-)
I have a bunch of devices triggering Java messages to be sent on any state change. These devices are typically active for about 30-90 minute intervals. Each event message contains a device id in addition to the event details.
Central in my ... | [
0.4390660524368286,
0.1433754712343216,
0.35388126969337463,
-0.11836710572242737,
0.011264339089393616,
-0.413565069437027,
0.4506182074546814,
0.23579344153404236,
-0.38014817237854004,
-0.5159785747528076,
-0.002805558731779456,
0.5614710450172424,
-0.058089159429073334,
-0.154231324791... | |
each active device! If this had been a web application I would have used the http session to store a handle or reference to the stateful bean (I'm I right?). Is there any way that I can archive this from my message bean?
It would be nice, except it can't be done like you explained. MDBs (and SLSBs) are stateless by def... | [
0.3194333612918854,
0.12505900859832764,
0.4049563407897949,
-0.03292372450232506,
-0.11679942905902863,
-0.17445218563079834,
0.25684577226638794,
0.01155176293104887,
-0.3548157513141632,
-0.608799159526825,
-0.04317352548241615,
0.4500371217727661,
-0.39809122681617737,
0.19577562808990... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.