text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
- aFolderFile2.aspx
+-bFolder
+-cFolder
| -cFolderFile1.aspx
-bFolderFile1.aspx
```
The real data obviously has more sub folders and files in each.
What I am looking for is some code, be it .NET or SQL to parse my strings. I have tried to use some SQL that used [WITH](http://msdn.microsoft.com... | [
0.018481852486729622,
0.17448033392429352,
0.6011956930160522,
-0.12716194987297058,
-0.20492017269134521,
-0.2066924124956131,
0.06049145758152008,
-0.20529091358184814,
-0.1605720967054367,
-0.5409169793128967,
0.09524249285459518,
0.24647031724452972,
-0.3073897361755371,
0.307478189468... | |
So, for example the parent for the file cFolderFile1.aspx is cFolder and the cFolder has a parent of bFolder, and so on....
Hopefully I've included enough information. If not, please let me know and I will edit the post.
In your derived class:
```
protected override void OnLoad(EventArgs e)
{
//do the specific wor... | [
-0.006637705955654383,
-0.14908188581466675,
0.2997843623161316,
-0.15502914786338806,
0.23001474142074585,
-0.32500454783439636,
0.057958923280239105,
-0.01364558469504118,
-0.07179257273674011,
-0.6054554581642151,
-0.28741908073425293,
0.5767627954483032,
-0.18277183175086975,
0.2248985... | |
A common idiom that my camp uses in rails is as follows:
```
def right_things(all_things, value)
things = []
for thing in all_things
things << thing if thing.attribute == value
end
return things
end
```
how can I make this better/faster/stronger?
thx
-C
```
def right_things(all_things, value... | [
0.07284986972808838,
0.018081434071063995,
0.24969829618930817,
0.07869663834571838,
-0.09869398176670074,
-0.35006722807884216,
0.07965467125177383,
-0.16508862376213074,
-0.31823423504829407,
-0.48229533433914185,
-0.3193742632865906,
0.41489148139953613,
-0.36430349946022034,
0.07433681... | |
The following code sample prints:
```
T
T[]
T[]
```
While first two lines are as expected, why compiler selected param array for a regular array?
```
public class A
{
public void Print<T>(T t)
{
Console.WriteLine("T");
}
public void Print<T>(params T[] t)
{
Console.WriteLine("T[... | [
0.056639913469552994,
-0.13071191310882568,
0.15787045657634735,
-0.34523600339889526,
-0.24122753739356995,
0.3264268636703491,
0.39705541729927063,
-0.701103150844574,
-0.21909132599830627,
-0.07873635739088058,
-0.4382081627845764,
0.1507183164358139,
-0.6935200691223145,
0.195955157279... | |
a.Print("string");
a.Print("string","string");
a.Print(new string[] {"a","b"});
}
}
```
Under the hood
```
a.Print("string","string");
```
is just syntactic sugar for
```
a.Print(new string[]{"string","string"});
```
EDIT: Like I said, the `params` keyword only automagically creates the array... | [
0.07335387170314789,
0.2063211053609848,
0.12112691253423691,
-0.16520975530147552,
-0.12444091588258743,
0.09169253706932068,
0.3883736729621887,
-0.1830453872680664,
-0.13869109749794006,
-0.21516723930835724,
-0.5531845688819885,
0.6408858299255371,
-0.5325411558151245,
-0.2370137274265... | |
I am trying to write a very simple statement that will make it so that, if users of my blog don't have a gravatar, an image chosen randomly will appear. The way it works now is like this:
```
<?php echo get_avatar( $comment, $size = '78', $default = '/images/noavatar2.gif' ); ?>
```
this will give me a random numb... | [
0.09373681247234344,
-0.032798148691654205,
0.31930261850357056,
-0.22571957111358643,
-0.2684132754802704,
0.28494539856910706,
0.32114216685295105,
-0.2647688090801239,
-0.37584272027015686,
-0.5420303344726562,
0.09035471826791763,
0.3798399865627289,
-0.4121640622615814,
0.007931157015... | |
uses a language feature called string concatenation; for more information on how this works in PHP: <http://www.phpf1.com/tutorial/php-string-concatenation.html> | [
-0.11087563633918762,
-0.19514930248260498,
0.18715430796146393,
-0.23496517539024353,
0.006502295844256878,
-0.06480126082897186,
0.044788211584091187,
0.3451162576675415,
-0.23952822387218475,
-0.17194555699825287,
-0.1439935564994812,
0.324743390083313,
-0.33919262886047363,
-0.07255063... | |
I have a batch file which does something like this
```
for %%a in (1 2 3 4 5) do dir > %%a.output
```
`%%a` just gives me a `.`
How can I use the value of the variable `%%a` to assign the file name (e.g. 1.output, 2.output) ?
You have to surround your variable:
```
for %a in (1 2 3 4 5) do dir > %a%.output
``` | [
0.1317729651927948,
0.16125096380710602,
0.26516592502593994,
-0.44347083568573,
0.010012713260948658,
0.06650380045175552,
0.025569144636392593,
-0.17850928008556366,
0.05817018821835518,
-0.08111211657524109,
0.10719848424196243,
0.43579232692718506,
-0.3477151691913605,
0.38035446405410... | |
On the surface Groovy and Scala look pretty similar, aside from Scala being statically typed, and Groovy dynamic.
* What are the other key differences, and advantages each have over the other?
* How similar are they really?
* Is there competition between the two?
+ If so, who do you think will win in the long run?
Th... | [
-0.031877387315034866,
-0.384983092546463,
0.31645169854164124,
0.1575896441936493,
-0.31240713596343994,
0.259284645318985,
-0.17182804644107819,
0.1150248646736145,
-0.40685251355171204,
-0.3953445851802826,
0.07614853978157043,
0.580256462097168,
-0.42733263969421387,
-0.031985301524400... | |
in that it is statically typed and has virtually no dynamic meta-programming beyond the awkward stuff you can do in Java. Note, Scala's static type system is substantially more uniform and sophisticated than Java's.
Groovy is syntactically influenced by Java but semantically influenced more by languages like Ruby.
Sc... | [
-0.13645540177822113,
-0.4509828984737396,
0.4162878096103668,
0.09390314668416977,
-0.1970887929201126,
0.2823795676231384,
-0.129860520362854,
0.01450598519295454,
-0.5186243653297424,
-0.5020771622657776,
0.10363764315843582,
0.23948009312152863,
-0.6503222584724426,
-0.1387061029672622... | |
the same kinds of problems that multiple dispatch is meant to handle. However, where multiple dispatch can only dispatch on runtime type, Scala's pattern matching can dispatch on runtime types, values, or both. Pattern matching also includes syntactically pleasant variable binding. It's hard to overstress how pleasant ... | [
0.0548737533390522,
-0.352961927652359,
0.027477065101265907,
0.07244732975959778,
-0.2604787051677704,
0.2982899844646454,
0.10283012688159943,
-0.2659681439399719,
-0.2831324338912964,
-0.6399027705192566,
0.019256627187132835,
0.45829030871391296,
-0.49656856060028076,
-0.00625173840671... | |
believe Groovy does. That's important in functional programming but less important in imperative programming.
Both Scala and Groovy are eagerly evaluated by default. However, Scala supports call-by-name parameters. Groovy does not - call-by-name must be emulated with closures.
Scala has "for comprehensions", a genera... | [
0.20055454969406128,
0.19956500828266144,
0.3298153877258301,
0.1969335377216339,
-0.2803947925567627,
0.024870341643691063,
0.35479262471199036,
-0.21236763894557953,
-0.15447035431861877,
0.004394242540001869,
-0.04337884858250618,
0.6763402223587036,
-0.42736855149269104,
-0.05361852422... | |
does. In Scala you can name methods very flexibly.
Groovy has the elvis operator for dealing with null. Scala programmers prefer to use Option types to using null, but it's easy to write an elvis operator in Scala if you want to.
Finally, there are lies, there are damn lies, and then there are benchmarks. The compute... | [
0.29924964904785156,
-0.10033886134624481,
0.12735280394554138,
0.07561364024877548,
-0.008611483499407768,
-0.062131367623806,
0.5107465386390686,
-0.4667038023471832,
-0.3036063313484192,
-0.6019020676612854,
0.19504408538341522,
0.6114026308059692,
-0.03992801532149315,
-0.1984463930130... | |
gist.
Is there a competition between them? Yes, of course, but not as much as you might think. Groovy's real competition is JRuby and Jython.
Who's going to win? My crystal ball is as cracked as anybody else's. | [
-0.2339589148759842,
-0.023724373430013657,
0.397929847240448,
0.6105959415435791,
-0.5213359594345093,
0.08398225158452988,
-0.1469905525445938,
0.693444013595581,
-0.41377100348472595,
-0.17115452885627747,
0.08546514809131622,
0.4690375030040741,
0.37341758608818054,
0.4056070148944855,... | |
I'm building an online store to sell products like "Green Extra-large, T-shirts". I.e., the same shirt can have many sizes / colors, different combination can be sold out, different combination might have different prices, etc.
My question is how I should model these products in my Rails application (or really how to ... | [
0.3570863902568817,
-0.11947456002235413,
0.246468186378479,
0.13478493690490723,
0.03644798323512077,
0.06522520631551743,
-0.044856518507003784,
0.008282564580440521,
-0.1316979080438614,
-1.1569912433624268,
0.03552573546767235,
0.28248757123947144,
0.057081785053014755,
0.3616245388984... | |
each characteristic will then have one or more variants (e.g., "Red", "Blue", etc).
The problem with this method is **where do I store price and inventory?** I.e., a given product's price and inventory are determined by the variants its characteristics take. (Green might be more expensive than red, large might be out ... | [
0.2663038969039917,
-0.15529848635196686,
0.16279323399066925,
0.20292913913726807,
0.037079982459545135,
0.5502561330795288,
-0.11425494402647018,
-0.12303465604782104,
0.10158178210258484,
-0.8078643679618835,
0.12338604778051376,
0.6780087351799011,
-0.2649558484554291,
0.46789321303367... | |
"main" product. The challenge here is that in addition to your thoughts for far, in most cases the product will evolve with new manufacturers that bring new aspects to the table. For example, one manufacturer may make a cheaper product, but have a different application method for the logo or stitching that may be signi... | [
0.5308515429496765,
0.09428980946540833,
0.22423280775547028,
0.14542804658412933,
0.09793271869421005,
0.09475531429052353,
-0.0016435219440609217,
0.15452922880649567,
-0.3382661044597626,
-0.5679096579551697,
-0.12921516597270966,
0.33608290553092957,
-0.017141569405794144,
0.4582273960... | |
products attach to works well.
In tables:
```
ProductGroup
--------------------
ProductGroupID
ProductGroupName
ProductGroupDescription
Product
-------------------- | [
-0.22584637999534607,
0.1277969777584076,
0.46764105558395386,
-0.49506109952926636,
-0.06665074080228806,
-0.20004530251026154,
-0.28275632858276367,
-0.11643660068511963,
0.03825189173221588,
-0.5131407976150513,
-0.5063221454620361,
0.33859696984291077,
-0.09095004200935364,
0.068504065... | |
ProductID
ProductGroupID
QtyOnHand
BasePrice
ProductColorID
ProductSizeID
ProductColor
------------
ProductColorID | [
-0.4219777286052704,
-0.27997392416000366,
0.3573659658432007,
-0.46462488174438477,
-0.21230463683605194,
0.06060709431767464,
-0.3784950375556946,
-0.27173513174057007,
0.46838605403900146,
-0.4382156729698181,
-0.444351464509964,
0.16883866488933563,
-0.3148757517337799,
0.1560986489057... | |
ProductColorName
ProductSize
--------------
ProductSizeID
ProductSizeName
...more attributes...
```
The advantages here are that you can easily query for specific attributes, attributes are "flexible" in that more can be added (and old ones adjusted: if yo... | [
0.22555352747440338,
-0.13400186598300934,
0.6716804504394531,
0.016735756769776344,
0.017181310802698135,
-0.16235901415348053,
-0.334977924823761,
-0.12338194996118546,
-0.1533946394920349,
-0.7684577703475952,
-0.019084863364696503,
0.6752234697341919,
0.0125123905017972,
0.215612798929... | |
but then added another "Red" to the color pool, you can change them to "Maroon" and "Bright Red".
You can control price and inventory are at the detail product level (although more tables may be required to account for *sourcing* costs).
**This all assumes that your characteristics are universally shared.** If they a... | [
0.459288626909256,
-0.03971114754676819,
0.27071306109428406,
0.06247377395629883,
0.05203944817185402,
0.15619249641895294,
-0.0013948761625215411,
-0.01996958814561367,
-0.3435502052307129,
-0.8479145169258118,
0.06556768715381622,
0.5500326752662659,
-0.016677098348736763,
0.35751396417... | |
base product table (with Qty and Cost of 0) that I would clone the characteristics from and then adjust as each new product is entered.** As you move forward, when a new variation appears, having a "clone this product" function that allows you to just adjust the *differences* from the base product would be valuable.
F... | [
0.7113093137741089,
-0.16838712990283966,
0.5860816240310669,
0.15946099162101746,
0.08548862487077713,
0.1988637000322342,
-0.14900444447994232,
-0.031413670629262924,
0.11313261836767197,
-0.9861528277397156,
0.29839468002319336,
0.5195529460906982,
0.09058226644992828,
0.214185088872909... | |
I use `nosetests` to run my unittests and it works well. I want to get a list of all the tests `nostests` finds without actually running them. Is there a way to do that?
Version 0.11.1 is currently available. You can get a list of tests without running them as follows:
```
nosetests -v --collect-only
``` | [
0.723174512386322,
0.07314974069595337,
0.3225764036178589,
0.2194252461194992,
-0.0009237474296241999,
-0.12017964571714401,
0.37238800525665283,
-0.3458191752433777,
0.07469689100980759,
-0.7199606895446777,
0.15392781794071198,
0.8681594133377075,
-0.12920142710208893,
0.108827099204063... | |
As a developer, can I safely upgrade to IE8 and use its IE7 compatibility mode to test how sites look in IE7? For IE6, I have a virtual machine and it is quite inconvenient. I don't want to upgrade to IE8 and then have another virtual machine now for IE7.
Or is IE7 compatibility mode really different and I can't rely ... | [
0.195240780711174,
0.07600262761116028,
0.33750423789024353,
-0.14462220668792725,
-0.020573880523443222,
-0.372263103723526,
0.4740714430809021,
-0.1769358068704605,
-0.09206058830022812,
-0.715183436870575,
-0.1275605857372284,
0.7905769944190979,
-0.15259362757205963,
0.1376669704914093... | |
Lets say we have an Edit View to edit our data, and we want to let the user know the result of their edit ie. to confirm that it was indeed saved successfully on the Model.
One solution is to assign a message to ViewData in the Edit Controller action method, and then use the View to display the message back to the use... | [
0.22692830860614777,
-0.22639170289039612,
0.646817147731781,
-0.02650020830333233,
0.06580276787281036,
-0.044449932873249054,
0.2659054100513458,
-0.000003185223022228456,
0.010948525741696358,
-0.6179468631744385,
-0.06525591015815735,
0.7208621501922607,
-0.4173220992088318,
-0.0409534... | |
the View? What are some other alternatives as I seem to be borderline on putting presentation type stuff in the Controller.
A very simple approach would be to pass some boolean or other status flag to the view as part of the model data; the view can then render that information as it sees fit.
Alternatively, you might... | [
0.25639522075653076,
-0.3314119279384613,
0.23933206498622894,
0.5395888090133667,
-0.29520347714424133,
0.21272124350070953,
-0.001673725782893598,
0.15313652157783508,
-0.134103924036026,
-0.35135239362716675,
0.09382093697786331,
0.6722947955131531,
-0.1825304478406906,
0.12173461914062... | |
How would one sort an indexed array and maintain the index association in Actionscript 3.0. The Array.sort(); method seems to reindex the array no matter what. Basically I need to recreate the [arsort](http://us2.php.net/manual/en/function.arsort.php) php function in Actionscript. Possible?
To do so you would need an a... | [
-0.11577355861663818,
-0.13653020560741425,
0.3290676474571228,
0.07773226499557495,
-0.21039456129074097,
0.015653176233172417,
0.2135399580001831,
-0.19859951734542847,
-0.30518025159835815,
-0.6890600323677063,
0.11528442800045013,
0.36654210090637207,
-0.4483261704444885,
-0.2670266032... | |
value for each item in the array :
```
var array:Object = new Array();
array.push({index:0,name:"Tom"});
array.push({index:1,name:"Andrew"});
array.push({index:2,name:"Mark"});
array.sortOn("name");
for each(var item:Object in array)
trace(item.index, item.name);
```
This will trace :
```
1 Andrew
2 Mark
0... | [
-0.11019913852214813,
-0.1887941211462021,
0.608284592628479,
-0.4537736475467682,
-0.037604574114084244,
0.3591006398200989,
0.2089695930480957,
-0.47053468227386475,
-0.4235498607158661,
-0.43753647804260254,
-0.28648996353149414,
0.14886362850666046,
-0.3982926607131958,
0.1317392587661... | |
```
<?php
/* Copyright Date
--------------------------*/
function copyright_date($creation_year) {
$current_year = date('Y');
if ($creation_year == $current_year || $creation_year == '') {
echo $current_year;
}
else {
echo $creation_year . '-' . $current_year;
}
}
?>... | [
-0.017938097938895226,
0.5234224200248718,
0.6224285960197449,
-0.08267615735530853,
0.27676498889923096,
-0.04928889125585556,
0.14532935619354248,
0.16092897951602936,
-0.27695921063423157,
-0.2953130602836609,
-0.26499640941619873,
0.25022539496421814,
-0.08580165356397629,
0.5907778143... | |
was left blank?** In my if statement, that's what $creation\_year == '' is for, but since the argument isn't a string, it doesn't work.
Make `$creation_year` an optional argument with a default value of `NULL`.
```
function copyright_date($creation_year=NULL) {
```
Now inside the function just test if `$creation_yea... | [
0.28493982553482056,
0.028510456904768944,
0.30149221420288086,
-0.20009779930114746,
0.30022627115249634,
-0.07249912619590759,
0.07880175113677979,
0.36542126536369324,
-0.1753644496202469,
-0.3176151514053345,
-0.28285351395606995,
0.44663795828819275,
0.12474318593740463,
0.60475611686... | |
This seems like it should be something easy, yet it is driving me mad!!
I need to be able to position a button, or other input element for that matter to the right of a header element, which also contains text.
The basic markup is:
```
<h3>Order Details <input type="button" value="Refund" id="btnRefund" /></h3>
... | [
-0.02549138478934765,
0.19220702350139618,
0.7883064150810242,
-0.2800188362598419,
-0.1447569727897644,
-0.07988142222166061,
0.3151470720767975,
-0.4857948422431946,
0.07299719005823135,
-0.4789469242095947,
-0.3401111662387848,
0.5354763269424438,
-0.21757808327674866,
-0.21209155023097... | |
the text.
I've tried various combination of the position property on the H3 element and wrapping the text in div and span tags.
I'm sure I kick myself when I get the solution to this.
**Edit/Update:**
I am sticking with nickf's answer (for now anyway) as I'm dealing with quite an old system with the H3 already style... | [
0.3996410369873047,
0.19409169256687164,
0.4230852723121643,
0.0667724460363388,
-0.3349505662918091,
-0.1658877581357956,
0.5346773862838745,
0.03331944718956947,
-0.1205565556883812,
-0.5807294845581055,
-0.6093242764472961,
0.7655011415481567,
0.04151080921292305,
-0.24568817019462585,
... | |
tag to accomodate this.
If I were starting from scratch I might have considered Mark's answer.
You have to put it first
```
<h3><input type="button" style="float: right">Order Details</h3>
``` | [
0.08559706062078476,
-0.12237849831581116,
0.5584032535552979,
-0.08743534982204437,
-0.08453769981861115,
-0.031274765729904175,
-0.20424920320510864,
-0.6175798177719116,
0.0207925196737051,
-0.597611665725708,
0.031013162806630135,
0.5808546543121338,
-0.379190057516098,
-0.416496157646... | |
What are the advantages of defining a private attribute instead of a public attribute? Why should I have the extra work of creating methods to access and modify privates attributes if I can just make them public?
If you use getters/setters you can perform logic upon changes or access. You could validate input, instead ... | [
0.20792166888713837,
-0.20534498989582062,
-0.2848040759563446,
0.5941993594169617,
-0.1718180924654007,
-0.07144343107938766,
0.3104708790779114,
-0.09304048866033554,
-0.1313776671886444,
-0.574317216873169,
0.09288793057203293,
0.8600279092788696,
-0.07615689933300018,
0.080641336739063... | |
doing something wrong. | [
0.08653423935174942,
0.3071154057979584,
-0.2429080456495285,
0.1925228089094162,
-0.5138601064682007,
-0.37707310914993286,
0.21278277039527893,
0.052757617086172104,
-0.36676356196403503,
-0.4781129062175751,
0.42846912145614624,
0.07777959853410721,
-0.3762299120426178,
0.12701502442359... | |
That is my first question around here, my name is Anna!
My problem:
My client has several personal devices (blackbox with gps) to locate people/car... There are about 12000 people/car using that device... It sends their location to specified IP/Port... I can´t do anything on that side...
My job?
Devolope a listener t... | [
0.1899915188550949,
0.10269017517566681,
0.06460516154766083,
-0.22786876559257507,
-0.02097395621240139,
0.42212554812431335,
0.1509765386581421,
0.03242168948054314,
-0.5282120704650879,
-0.6352255940437317,
0.510551393032074,
0.3393141031265259,
-0.0578153170645237,
0.34192314743995667,... | |
think should I use that?
Anna
The number of locations / time, as well as the way the location information is transmitted (is it TCP, UDP, etc) will help determine the optimal approach.
Some questions:
* How frequently do the 12000 devices send a message?
* How are the locations transmitted? UDP? TCP?
* What reliabil... | [
0.23852775990962982,
-0.1127992570400238,
0.5280191898345947,
0.17815542221069336,
0.2143620252609253,
0.17209598422050476,
0.2720368206501007,
-0.01838250830769539,
-0.43007099628448486,
-0.5387502312660217,
0.28953200578689575,
0.4008171558380127,
0.2494107037782669,
0.22499167919158936,... | |
even then, it may or may not be necessary.
---
EDIT: Given the comments below, I would suggest something where you have a TCP listener pass requests off to the threadpool to handle.
I would take a look at [this tutorial](http://www.java2s.com/Tutorial/CSharp/0580__Network/ThreadPoolbasedTcpserver.htm) about setting ... | [
0.33264049887657166,
-0.022617286071181297,
0.2058415561914444,
0.16441692411899567,
-0.16121456027030945,
-0.2609921097755432,
0.043377846479415894,
-0.20270465314388275,
-0.45478931069374084,
-0.6902502775192261,
0.12063943594694138,
0.6162699460983276,
-0.14542362093925476,
0.0871336311... | |
trying to do your own threading, since you'll want to avoid the overhead of having to create new threads constantly. You'll definitely want to have very little delay in the main processing loop (like Sleep(0), or no sleep at all), since you'll have one request per 2.5 ms on average. A single Sleep tends to time slice a... | [
0.48525470495224,
-0.2203056961297989,
-0.01882009766995907,
0.09817787259817123,
0.02504400722682476,
0.11040841788053513,
0.41133177280426025,
0.05859116464853287,
-0.5878221988677979,
-0.7089962363243103,
0.11140280216932297,
0.16186551749706268,
-0.15225738286972046,
-0.027090946212410... | |
to UDP packets being sent, it may get you better throughput (at the expense of some reliability). | [
0.303911030292511,
-0.38406845927238464,
0.2933654487133026,
0.12707316875457764,
-0.18518219888210297,
-0.29458171129226685,
0.1429198980331421,
0.028426146134734154,
-0.44730740785598755,
-0.6197922825813293,
-0.18241764605045319,
0.16943874955177307,
-0.20602035522460938,
0.089033551514... | |
Are there payment gateways that only take a percentage of whatever money is paid, but that have a very small up-front startup fee?
I want to set up a payment gateway for a charity.
By the way - is there any harm in just accepting donations through paypal and avoiding the whole payment gateway hassle?
Many opensource ... | [
0.8270003795623779,
0.17553336918354034,
0.07820066064596176,
0.4777974486351013,
-0.10004479438066483,
0.09485405683517456,
0.10227803140878677,
0.46209415793418884,
-0.34310320019721985,
-0.47379231452941895,
0.43454527854919434,
0.16180366277694702,
0.2198275476694107,
-0.09502177685499... | |
I have an array of objects defined similarly to the below:
```
$scores = array();
// Bob round 1
$s = new RoundScore();
$s->Round_Name = 'Round 1';
$s->Player_Name = 'Bob';
$s->Score = 10;
$scores[0] = $s;
// Bob round 2
$s = new RoundScore();
$s->Round_Name = 'Round 2';
$s->Player_Name = 'Bob';
$s->Score = 7;
$scor... | [
-0.18332865834236145,
0.207946315407753,
0.7943006753921509,
-0.374967485666275,
0.1181822419166565,
-0.0681244432926178,
0.22251467406749725,
-0.7198923230171204,
-0.4874185025691986,
-0.44221460819244385,
0.011614754796028137,
0.2936890423297882,
-0.46043074131011963,
0.32220208644866943... | |
Bob 10
Round 2 Bob 7
Round 1 Jack 6
Round 2 Jack 12
```
What I want, however, is something like this:
```
Player Round 1 Round 2 Total
-------------------------------
Bob 10 7 17
Jack 6 | [
-0.11838335543870926,
0.3563385009765625,
0.7137665152549744,
-0.5502442121505737,
0.07482194155454636,
-0.006375102326273918,
0.17178139090538025,
-0.36020341515541077,
-0.7056916356086731,
-0.20548154413700104,
0.11255650967359543,
0.5537673830986023,
-0.6398284435272217,
-0.094332285225... | |
12 18
```
I'm not going to know in advance how many rounds or players there'll be and let's just say I can't change the way the objects are constructed.
What's the most efficient way to do this in php?
If we can assume that:
* the order of scores in the array is always in the order by player's name
and then b... | [
0.2850351631641388,
0.3890730142593384,
0.39491647481918335,
0.05954157933592796,
-0.17576132714748383,
-0.26352444291114807,
-0.038467779755592346,
-0.34664419293403625,
-0.4245571792125702,
-0.3004869520664215,
0.3277621567249298,
0.6028275489807129,
-0.05407629534602165,
-0.249509871006... | |
total in the process but resetting it if we see a new player:
```
$round_count = 0;
$header_printed = false;
$current_player = NULL;
$current_total = 0;
$current_output_line = "";
foreach ($scores as $score) {
// Check whether we have to move to a new player
if ($score->Player_Name != $current_player) {
... | [
-0.12513530254364014,
-0.15410684049129486,
0.6431593894958496,
-0.3987947404384613,
0.3833405673503876,
-0.027219828218221664,
-0.052193816751241684,
-0.4637626111507416,
-0.7689869403839111,
-0.3428179621696472,
-0.08983436226844788,
0.4604812562465668,
-0.3147350549697876,
0.41517370939... | |
printf("%-10s", "Player");
for ($i = 0; $i < $round_count; $i++) {
printf("%-10s", "Round $i");
}
printf("%-10s\n", "Total"); | [
-0.4343624413013458,
-0.11538544297218323,
0.3580850660800934,
-0.6780030131340027,
0.02206466533243656,
0.293613463640213,
0.12489541620016098,
-0.49856945872306824,
-0.06728479266166687,
-0.17804346978664398,
-0.5866779088973999,
0.7067499160766602,
-0.5289472341537476,
-0.02557558752596... | |
$header_printed = true;
}
$current_output_line .= sprintf("%5d\n", $current_total);
print $current_output_line;
}
// Reset the total and various variables for the new player
$round_count = 0;
$current_player = $score->Player_Name; | [
-0.3830104172229767,
-0.17427635192871094,
0.46659669280052185,
-0.5421159863471985,
0.30035486817359924,
-0.1315261870622635,
-0.11459425836801529,
-0.19764843583106995,
-0.4275602102279663,
-0.15767332911491394,
-0.19749315083026886,
0.4888460636138916,
-0.4502083957195282,
0.23190115392... | |
$current_total = 0;
$current_output_line = sprintf("%-10s", $score->Player_Name);
}
$round_count++;
$current_total += $score->Score;
$current_output_line .= sprintf("%5d ", $score->Score);
}
// The last player is not printed because we exited the loop
// before the print statement, so we n... | [
-0.5827121138572693,
-0.0855872631072998,
0.6760849952697754,
-0.6234237551689148,
0.3785730004310608,
0.0720944032073021,
0.04042050242424011,
-0.13760356605052948,
-0.48950815200805664,
0.02309846691787243,
-0.22990772128105164,
0.23806364834308624,
-0.39923155307769775,
0.32801330089569... | |
10 7 17
Jack 6 12 18
```
This should be quite efficient because it only goes through the array once. | [
0.5357552766799927,
0.5053109526634216,
0.5086798667907715,
-0.36472514271736145,
0.24595719575881958,
-0.16243255138397217,
0.16835428774356842,
-0.3539911210536957,
-0.22706623375415802,
-0.5175559520721436,
0.02860928513109684,
0.732078492641449,
0.007855840027332306,
-0.072642967104911... | |
Other than `Locale.getISOCountries()` that is, because I'm already [getting some strange errors with that](https://stackoverflow.com/questions/712230/weird-error-with-locale-getisocountries). What else is the best way to get the 2-letter country codes as well as the full country name?
For a separate project, I took the... | [
0.3810668885707855,
0.06315160542726517,
0.1369691640138626,
0.31851962208747864,
-0.1010333001613617,
-0.5282987952232361,
0.1919122338294983,
0.6390755772590637,
-0.49612751603126526,
-0.1441594660282135,
-0.5010964274406433,
-0.35575568675994873,
-0.03298273682594299,
0.0811221599578857... | |
A good starting point to learn about the issues is [this blog post](http://www.koziarski.net/archives/2008/9/24/countries-and-controversies). | [
0.27802035212516785,
-0.08016955852508545,
-0.20317021012306213,
0.2516305446624756,
-0.1184837743639946,
-0.508105993270874,
-0.10492470115423203,
0.570069432258606,
-0.7740505337715149,
0.22873984277248383,
-0.3155965805053711,
-0.2682872712612152,
0.15262740850448608,
0.3697284758090973... | |
I'm creating a JSF/Facelets web app in Eclipse. I've configured my project to use a Tomcat (6.0) server that is started/stopped by Eclipse.
Whenever I save a file (eg .xhtml) Eclipse restarts the app, trashing my HTTP session. This is annoying, because I'm frequently updating my .xhtml files, and the app doesn't need ... | [
0.3541491627693176,
0.1261572390794754,
0.5196868777275085,
-0.003836378687992692,
-0.19706067442893982,
-0.07934217154979706,
0.5531510710716248,
0.08204259723424911,
-0.20426170527935028,
-0.609846830368042,
-0.0857277512550354,
0.8392793536186218,
-0.33617547154426575,
0.005088625010102... | |
server.
As I am not sure of which parameter will help you to solve your problem, check the following options in the latter view:
* Automatic Publishing, option "Override default settings" selected, 1 second for the publishing interval.
* In server options, uncheck options "Server modules without publishing" and "publi... | [
-0.025567632168531418,
-0.21134544909000397,
0.6351866126060486,
0.03087327815592289,
0.04962622746825218,
-0.23277242481708527,
0.41381171345710754,
-0.0980934202671051,
-0.6531411409378052,
-0.7084624767303467,
-0.31165531277656555,
0.596154510974884,
-0.16977745294570923,
-0.07905554771... | |
Greetings!
I'm new to WCF and I thought it would be similar to ASP.NET web services, but I'm unable to call a method from client-side JavaScript. My web form looks like this:
```
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
<Scripts>
<asp:... | [
-0.12916554510593414,
0.2311299443244934,
0.6708486676216125,
-0.10951469093561172,
-0.35472962260246277,
-0.07040068507194519,
0.30932512879371643,
-0.17587228119373322,
-0.03931218013167381,
-0.705426037311554,
-0.057815324515104294,
-0.041483428329229355,
0.17309150099754333,
-0.0003460... | |
</Services>
</asp:ScriptManager>
</div>
<button onclick="test()">Click Me</button>
</form>
```
My service's interface looks like this:
```
namespace Test
{
[ServiceContract(Namespace = "Test")]
public interface IMyService
{
[OperationContract]
void DoWork();
[Operatio... | [
0.23004019260406494,
0.0793413445353508,
0.4040141999721527,
-0.1765640377998352,
-0.03903153911232948,
0.13863520324230194,
0.4432198107242584,
-0.20521031320095062,
0.3168491721153259,
-1.0161705017089844,
-0.014586196281015873,
0.40764090418815613,
-0.05443200841546059,
0.28647953271865... | |
{
public void DoWork()
{
}
public string SayHi()
{
return "Hello, World!";
}
}
}
```
And finally the JavaScript:
```
function test() {
Test.MyService.SayHi(SayHiSuccess, SayHiError);
}
function SayHiSuccess(result) {
alert(result[0]);
}
funct... | [
0.17621058225631714,
0.12762872874736786,
0.3181304931640625,
-0.27472615242004395,
0.1351151317358017,
0.052369214594364166,
0.4028061628341675,
0.0018659083871170878,
0.30935534834861755,
-0.36072418093681335,
-0.30851584672927856,
0.431967556476593,
-0.17878322303295135,
0.4304813742637... | |
SayHi() method never executes, although I'm not sure why or how to being troubleshooting. Any suggestions?
You didn't post your web.config contents. What binding are you using? You should probably be using [`webHttpBinding`](http://msdn.microsoft.com/en-us/library/bb412176.aspx).
Also, it may help to know your .svc f... | [
0.30133092403411865,
0.09857050329446793,
0.3869819641113281,
-0.11884868890047073,
-0.35325706005096436,
-0.16610652208328247,
0.4556709825992584,
-0.2552410066127777,
0.10840314626693726,
-0.42691779136657715,
0.13426318764686584,
0.3776572644710541,
-0.2700885832309723,
0.48461621999740... | |
Simple WCF Web...](http://peterkellner.net/2008/09/14/wcf-web-service-json-vs2008/) | [
0.030191319063305855,
-0.1833135485649109,
0.54633629322052,
-0.18067261576652527,
-0.3750438988208771,
-0.20134438574314117,
0.6528652310371399,
-0.477419376373291,
-0.40414008498191833,
-0.46511203050613403,
-0.2898273766040802,
0.5442465543746948,
-0.42453518509864807,
-0.09052414447069... | |
Q: How do I calculate the total time it takes to render an MVC page and display the time on the master page.
In Asp.net Web Form I created a Base page class like so:
```
public class PageBase : System.Web.UI.Page
{
private DateTime startTime = DateTime.Now;
private TimeSpan renderTime;
public Dat... | [
0.0001983786205528304,
-0.21637193858623505,
0.5257346630096436,
-0.24295786023139954,
0.06821111589670181,
0.2904552221298218,
0.19406704604625702,
-0.13746394217014313,
-0.04675258696079254,
-0.8426709175109863,
-0.2172565907239914,
0.33515664935112,
0.04129976034164429,
0.17747859656810... | |
public virtual string PageRenderTime
{
get
{
renderTime = DateTime.Now - startTime;
return renderTime.Seconds + "." + renderTime.Milliseconds + " seconds";
}
}
}
```
I would then call the method on my Master Page like so:
```
<div id="performance"> | [
-0.26899152994155884,
-0.2900122404098511,
0.6996578574180603,
-0.010471262969076633,
0.003761837724596262,
0.03759195655584335,
0.453618586063385,
-0.02814941667020321,
0.006369599141180515,
-0.9442546963691711,
-0.15607793629169464,
0.6881923079490662,
0.07340975850820541,
0.140387043356... | |
<% =PageRenderTime %>
</div>
```
Q: How do I accomplish the same thing with the MVC Framework?
Q: With the MVC framework where do I set the start time when a page is first created?
The best way to do this is calculate the request timing .. Begin Request and End Request ....
Check out this great post:
<http://haac... | [
0.07888506352901459,
0.19403015077114105,
0.6129359006881714,
-0.18152189254760742,
-0.2518830895423889,
-0.10188311338424683,
0.27921873331069946,
-0.12678012251853943,
-0.30098798871040344,
-0.9319818019866943,
-0.046950019896030426,
0.1758490949869156,
0.06356638669967651,
0.23101036250... | |
Here are the first few lines of my page:
```
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<?php include_once "dblogin.php";
session_start();
$loggedIn = 0;
if(isset($_SESSION["login"])) {$loggedIn = 1;}
?>
```
I'm getting the following error:
Cannot send ses... | [
0.2039569616317749,
0.22816219925880432,
0.40749427676200867,
-0.2289922833442688,
-0.08454113453626633,
-0.2510528564453125,
0.5724475383758545,
-0.16920256614685059,
-0.17542710900306702,
-0.7462580800056458,
-0.12703697383403778,
0.5420673489570618,
-0.38163283467292786,
0.1412253230810... | |
the headers are sent.
The solution in your case is:
Move `session_start();` above `<!DOCTYPE html`... | [
0.07516676187515259,
-0.08499209582805634,
0.6436941027641296,
0.006026084069162607,
0.10625692456960678,
-0.42924952507019043,
0.09639336168766022,
-0.16584070026874542,
-0.2509663701057434,
-0.7395381331443787,
-0.425777792930603,
0.5206278562545776,
-0.34749624133110046,
0.1558730304241... | |
This is not academic code or a hypothetical quesiton. The original problem was converting code from HP11 to HP1123 Itanium. Basically it boils down to a compile error on HP1123 Itanium. It has me really scratching my head when reproducing it on Windows for study. I have stripped all but the most basic aspects... You ma... | [
0.0844801589846611,
0.5152480006217957,
0.34367799758911133,
-0.30249056220054626,
0.18037939071655273,
0.1951855570077896,
0.5039016604423523,
-0.0839691162109375,
0.018267212435603142,
-0.6836767792701721,
-0.11451324075460434,
0.40120387077331543,
-0.5653575658798218,
0.2446560710668563... | |
pTOCONST = (int *) &IAMCONST;
(*pTOCONST) = 7;
printf("IAMCONST %d \n",IAMCONST);
printf("WHATISPOINTEDAT %d \n",(*pTOCONST));
printf("Address of IAMCONST %x pTOCONST %x\n",&IAMCONST, (pTOCONST));
cin >> blah;
return 0;
}
```
Here is the output
```
IAMCONST 3
WHATISPOINTEDAT 7
Address ... | [
0.1882009655237198,
0.17629201710224152,
0.567541241645813,
-0.3348924219608307,
-0.022365253418684006,
0.1551407277584076,
0.41889768838882446,
-0.36865225434303284,
-0.1360928863286972,
-0.4999829828739166,
-0.015764907002449036,
0.5523331165313721,
-0.35046035051345825,
0.24188439548015... | |
Windows >> Disassembly had exactly the optimization that was described below.
```
printf("IAMCONST %d \n",IAMCONST);
0024360E mov esi,esp
00243610 push 3
00243612 push offset string "IAMCONST %d \n" (2458D0h)
00243617 call dword ptr [__imp__printf (248338h)]
0024361D add ... | [
-0.32978710532188416,
0.03277057409286499,
0.7199856042861938,
-0.09986664354801178,
0.1464664340019226,
0.15717263519763947,
0.46749579906463623,
-0.2798321545124054,
-0.12634356319904327,
-0.6645444631576538,
-0.4410337209701538,
0.8884133696556091,
-0.47558310627937317,
0.10099156200885... | |
@ILT+325(__RTC_CheckEsp) (24114Ah)
```
Thank you all!
Looks like the compiler is optimizing
```
printf("IAMCONST %d \n",IAMCONST);
```
into
```
printf("IAMCONST %d \n",3);
```
since you *said* that `IAMCONST` is a `const int`.
But since you're taking the address of `IAMCONST`, it has to actually be located on... | [
-0.030887793749570847,
0.44801604747772217,
0.39384424686431885,
-0.0866033211350441,
-0.1503964364528656,
0.010156643576920033,
0.30526769161224365,
-0.2268320918083191,
-0.1437511295080185,
-0.5002456903457642,
-0.2562071979045868,
0.6887887716293335,
-0.22023999691009521,
-0.11465308070... | |
$-16, %esp
pushl -4(%ecx)
pushl %ebp
movl %esp, %ebp
pushl %ecx
subl $36, %esp
movl $3, -12(%ebp)
leal -12(%ebp), %eax
movl %eax, -8(%ebp)
movl -8(%ebp), %eax
movl $7, (%eax)
movl -12(%ebp), %eax
movl | [
-0.36032170057296753,
0.1919253170490265,
1.3691118955612183,
-0.31204068660736084,
-0.02514614351093769,
0.6112529039382935,
0.12572230398654938,
-0.38139456510543823,
-0.06309357285499573,
-0.26436901092529297,
-0.3804279863834381,
0.5614030957221985,
-0.2181074172258377,
0.0799665749073... | |
%eax, 4(%esp)
movl $.LC0, (%esp)
call printf
movl -8(%ebp), %eax
movl (%eax), %eax
movl %eax, 4(%esp)
movl $.LC1, (%esp)
call printf
```
copies from `*(bp-12)` on the stack to `printf`'s arguments. However, using `-O1` (as well as `-Os`, `-O2`, `-O3`, and other optimiz... | [
-0.07281346619129181,
0.4587623178958893,
0.8009417057037354,
-0.3696225583553314,
0.37832003831863403,
0.37303268909454346,
0.13178999722003937,
-0.331875741481781,
-0.03016667254269123,
-0.32593798637390137,
-0.6404752135276794,
0.8402015566825867,
-0.5866555571556091,
-0.180765196681022... | |
$-16, %esp
pushl -4(%ecx)
pushl %ebp
movl %esp, %ebp
pushl %ecx
subl $20, %esp
movl $3, 4(%esp)
movl $.LC0, (%esp)
call printf
movl $7, 4(%esp)
movl $.LC1, (%esp)
call printf
```
you can clearly see that | [
-0.3837953209877014,
-0.030324606224894524,
1.244489312171936,
-0.4239312708377838,
0.22354169189929962,
0.4299975633621216,
0.1923275887966156,
-0.1862315535545349,
-0.2155732363462448,
-0.28918400406837463,
-0.6003730297088623,
0.6578767895698547,
-0.4496171474456787,
0.01686452515423298... | |
the constant `3` is used instead.
If you are using Visual Studio's `CL.EXE`, `/Od` disables optimization. This varies from compiler to compiler.
Be warned that the C specification [allows](http://en.wikipedia.org/wiki/Type_punning) the C compiler to assume that the target of any `int *` pointer never overlaps the mem... | [
0.19611361622810364,
-0.019298791885375977,
0.02918529510498047,
-0.2990536689758301,
-0.14947091042995453,
-0.07191237062215805,
0.16179566085338593,
-0.1082213744521141,
-0.3793000280857086,
-0.3456006348133087,
-0.1703972965478897,
0.5960773229598999,
-0.5432268977165222,
-0.24008056521... | |
This question has always troubled me.
On Linux, when asked for a password, if your input is the correct one, it checks right away, with almost no delay. But, on the other hand, if you type the wrong password, it takes longer to check. Why is that?
I observed this in all [Linux distributions](http://en.wikipedia.org/w... | [
0.307943195104599,
0.09875163435935974,
0.010938436724245548,
0.037929803133010864,
-0.027395136654376984,
-0.17887172102928162,
0.1544288992881775,
0.06357116252183914,
-0.17584462463855743,
-0.6741670370101929,
-0.004253108520060778,
0.7014328241348267,
-0.1733209192752838,
0.06021340563... | |
*no* discernible difference in reasons for failure that can be detected.
That last one is particularly important. It means no helpful messages like:
```
Your user name is correct but your password is wrong, please try again
```
or:
```
Sorry, password wasn't long enough
```
Not even a time difference in response... | [
0.16191565990447998,
0.21184363961219788,
0.20612819492816925,
-0.005972075741738081,
0.09425605088472366,
-0.12915408611297607,
0.731552004814148,
0.24428501725196838,
-0.31063365936279297,
-0.550102174282074,
-0.3441515564918518,
0.5056743621826172,
-0.08424637466669083,
0.12476122379302... | |
I'm implementing a search box using CodeIgniter, but I'm not sure about how I should pass the search parameters through. I have three parameters: the search string; product category; and the sort order. They're all optional. Currently, I'm sending the parameters through `$_POST` to a temporary method, which forwards th... | [
0.4968448579311371,
0.24115359783172607,
0.6422906517982483,
-0.25855752825737,
-0.08863211423158646,
0.2187061756849289,
-0.17564891278743744,
0.19660311937332153,
-0.11488273739814758,
-0.5755575895309448,
-0.14468108117580414,
0.2903040647506714,
-0.1903224140405655,
0.5655299425125122,... | |
up, and just turn `$_GET` methods on? Thanks in advance!
Query Strings
=============
You can [enable query strings in CodeIgniter](http://codeigniter.com/user_guide/general/urls.html) to allow a more standard search function.
**Config.php**
```
$config['enable_query_strings'] = FALSE;
```
Once enabled, you can ac... | [
0.48516905307769775,
0.41650310158729553,
0.7623942494392395,
0.06012687832117081,
0.10116636008024216,
-0.038373179733753204,
0.187491312623024,
-0.380636990070343,
-0.4452875852584839,
-0.6093637347221375,
-0.35968342423439026,
0.7908315062522888,
-0.09746163338422775,
0.0480890609323978... | |
not used for the bulk of your content, only for special cases such as search queries. | [
0.599404513835907,
0.07364394515752792,
-0.024256248027086258,
0.4439527094364166,
0.17850787937641144,
-0.47098812460899353,
0.08626094460487366,
0.47970062494277954,
-0.19360685348510742,
-0.3329651355743408,
-0.3192382752895355,
0.3367854058742523,
-0.000020323313947301358,
-0.094616316... | |
I am using Ganymede (Eclipse 3.4) to do some Java EE based web development targeting a JBoss 4.2 application server.
I have always liked Eclipse very much for a Java editor. The thing is, for Java EE is not as useful as one might think. It's buggy, deployment and debugging is very slow, and you have to re-deploy your ... | [
0.20301711559295654,
0.3889598548412323,
-0.08410470187664032,
-0.18156932294368744,
-0.17424118518829346,
-0.2314959019422531,
-0.056137364357709885,
0.1589358001947403,
-0.12756197154521942,
-0.5012667775154114,
0.06375127285718918,
0.699225127696991,
-0.21724803745746613,
-0.00703558744... | |
used this when developing on JBoss using Eclipse 3.4, it works well although there are still some bugs in the plugin. Overall though it's better.
Update site for 3.4.2 is:
<http://download.jboss.org/jbosstools/updates/stable/>
**EDIT**: Also, if you're running on Redhat you can download JBoss Developer Studio which ... | [
0.5374094247817993,
-0.14238514006137848,
0.24351899325847626,
-0.024815361946821213,
-0.09334701299667358,
-0.4006935656070709,
0.352695107460022,
-0.052124299108982086,
-0.1353605091571808,
-0.6338497400283813,
-0.008349268697202206,
0.9430870413780212,
-0.048435647040605545,
-0.33763161... | |
I have a variable which contains the following string: AL,CA,TN,VA,NY
I have no control over what I get in that variable (comes from reporting services)
I need to make it look like this: 'AL','CA','TN','VA','NY'
How do I do this?
```
declare @x varchar(50) = 'AL,CA,TN,VA,NY'
select '''' + REPLACE(@x, ',', ''',''')... | [
0.6611632108688354,
0.18021340668201447,
0.6435613632202148,
-0.09892667829990387,
0.09495491534471512,
-0.0647771805524826,
0.34043940901756287,
-0.33389145135879517,
0.11302704364061356,
-0.35065701603889465,
0.11596750468015671,
0.7706964612007141,
-0.39382708072662354,
0.34353888034820... | |
In a Pylons webapp, I need to take a string such as "<3, 45, 46, 48-51, 77" and create a list of ints (which are actually IDs of objects) to search on.
Any suggestions on ways to do this? I'm new to Python, and I haven't found anything out there that helps with this kind of thing.
The list would be: [1, 2, 3, 45, 46... | [
0.13489888608455658,
0.05321504920721054,
0.3804694414138794,
0.05440998077392578,
-0.3543095588684082,
0.35105156898498535,
-0.021155716851353645,
-0.02312639355659485,
-0.31618359684944153,
-0.4927424490451813,
-0.08736371994018555,
0.10145846009254456,
-0.25931665301322937,
-0.407018929... | |
strings if there are any.
```
#! /usr/local/bin/python
import sys
import os
# return a set of selected values when a string in the form:
# 1-4,6
# would return:
# 1,2,3,4,6
# as expected...
def parseIntSet(nputstr=""):
selection = set()
invalid = set()
# tokens are comma seperated values
tokens = [x.... | [
-0.056658774614334106,
-0.2700709104537964,
0.030354132875800133,
0.08005429059267044,
-0.35440540313720703,
0.30243656039237976,
0.06593932211399078,
-0.3478829264640808,
-0.4286152124404907,
-0.2478404939174652,
-0.4563080370426178,
0.2589215338230133,
-0.44295641779899597,
0.13608369231... | |
i = "1-%s"%(i[1:])
try:
# typically tokens are plain old integers
selection.add(int(i))
except:
# if not, then it might be a range
try: | [
0.14344225823879242,
-0.1464182287454605,
-0.14158228039741516,
-0.22597818076610565,
-0.11564548313617706,
0.1746508628129959,
0.2202715426683426,
-0.46366506814956665,
-0.08827254921197891,
-0.27899089455604553,
-0.246039018034935,
0.03984443470835686,
-0.2758181691169739,
0.027122311294... | |
token = [int(k.strip()) for k in i.split('-')]
if len(token) > 1:
token.sort()
# we have items seperated by a dash
# try to build a valid | [
0.015544197522103786,
-0.4850964844226837,
0.052823640406131744,
0.06000285968184471,
-0.2890295684337616,
0.1324600875377655,
0.14276084303855896,
-0.2214779406785965,
-0.17954346537590027,
-0.6214251518249512,
-0.2046646773815155,
0.047056615352630615,
-0.07843650132417679,
0.23116812109... | |
range
first = token[0]
last = token[len(token)-1]
for x in range(first, last+1):
selection.add(x) | [
0.11779323220252991,
-0.464993953704834,
0.010919135063886642,
-0.2299400269985199,
-0.4452477693557739,
0.2916540503501892,
-0.1149769052863121,
-0.4247440695762634,
-0.12562556564807892,
-0.46384626626968384,
-0.24373747408390045,
0.27168014645576477,
-0.2068108767271042,
0.0658826082944... | |
except:
# not an int and not a range...
invalid.add(i)
# Report invalid tokens before returning valid selection
if len(invalid) > 0:
print "Invalid set: " + str(invalid)
return selection
# end parseIntSet
print 'Generate a list of selected items!'
nputstr = raw_input... | [
0.0679025873541832,
-0.24506622552871704,
0.12867270410060883,
0.07931221276521683,
-0.2797802686691284,
0.22501756250858307,
0.032625969499349594,
-0.7780234813690186,
-0.4802159368991852,
-0.2844623923301697,
-0.4595532715320587,
0.09754467755556107,
-0.28851252794265747,
0.0034392757806... | |
'
print str(selection)
```
And here's the output from the sample run:
```
$ python qq.py
Generate a list of selected items!
Enter a list of items: <3, 45, 46, 48-51, 77
Your selection is:
set([1, 2, 3, 45, 46, 77, 48, 49, 50, 51])
``` | [
0.1735566258430481,
0.08494985848665237,
0.19926515221595764,
-0.29591307044029236,
-0.07240262627601624,
0.25793391466140747,
0.04576538875699043,
-0.43622449040412903,
-0.29768410325050354,
-0.20386344194412231,
-0.36507827043533325,
0.3935264050960541,
-0.4342302680015564,
-0.0886716917... | |
In C, is there a nice way to track the number of elements in an enum? I've seen
```
enum blah {
FIRST,
SECOND,
THIRD,
LAST
};
```
But this only works if the items are sequential and start at zero.
I don't believe there is. But what would you do with such a number if they are not sequential, and you d... | [
0.02495565079152584,
0.12263785302639008,
0.0054131741635501385,
0.007204029243439436,
0.023126203566789627,
0.07398024946451187,
-0.21497614681720734,
-0.24690137803554535,
-0.4473055303096771,
-0.22355741262435913,
-0.4174329936504364,
0.1288624107837677,
-0.36715129017829895,
0.11264055... | |
SECOND,
THIRD,
END
};
const int blah_count = END - FIRST;
``` | [
0.3453983664512634,
-0.024371838197112083,
0.7001573443412781,
-0.5515599846839905,
0.03950554504990578,
-0.05709920451045036,
0.2538394033908844,
-0.564740002155304,
-0.3215557038784027,
-0.20063215494155884,
-0.45494720339775085,
0.5686711668968201,
-0.6467143297195435,
0.249195575714111... | |
I have two separate processes: a C program that outputs comma separated values followed by a newline every second, and a Perl program that accepts data (in the same format) and processes this data.
The C program outputs (via printf) values as such:
```
1, 2, 3, 4, 5, 6
7, 8, 9, 10, 11, 12
...
```
The Perl prog... | [
0.277656227350235,
-0.0025736887473613024,
0.692808210849762,
0.0105636240914464,
0.02855849638581276,
0.47648435831069946,
-0.2701317071914673,
-0.1957576870918274,
-0.17957642674446106,
-0.502197265625,
-0.031080493703484535,
0.2025192826986313,
-0.3012341260910034,
0.4235434830188751,
... | |
processes to communicate in real time. Standard bash pipes do not work (e.g. process1 | process2) because the Perl program waits for the first program to finish before processing the input.
Does anyone have any ideas, suggestions, or insightd as to a solution to this problem? Thank you in advance!
Pipes should be fin... | [
0.16708405315876007,
-0.1471509039402008,
0.3736375570297241,
0.19693782925605774,
-0.10068653523921967,
0.0952436700463295,
0.3039054870605469,
-0.16526027023792267,
-0.3377232849597931,
-0.9409926533699036,
-0.043177805840969086,
0.5603078007698059,
-0.2453273981809616,
-0.13169592618942... | |
out so the perl program can read it.
There is nothing inherent about pipes that would cause the perl program to wait for the C program to finish writing before processing its output. Your perl program is written so that it processes `STDIN` one line at a time:
```
while ($line = <STDIN>) { ... }
```
`<>` in this co... | [
0.5156726241111755,
-0.3904317021369934,
0.39555805921554565,
-0.14908772706985474,
-0.19396540522575378,
0.20150841772556305,
-0.13356533646583557,
-0.13525325059890747,
-0.16661123931407928,
-0.40795961022377014,
-0.10500596463680267,
0.28312215209007263,
-0.40312400460243225,
0.18745772... | |
of how pipes are buffered, which should help you understand how your processes communicate. Pipes **do** allow concurrency between processes, and processes reading from and writing to pipes are managed by the scheduler just like other processes. Your problem here is with the buffering. | [
0.058832261711359024,
-0.06596913188695908,
0.1794835925102234,
0.2601330578327179,
0.035279855132102966,
-0.019093850627541542,
0.009706438519060612,
0.15382328629493713,
-0.3409331142902374,
-0.4990214407444,
0.18054386973381042,
0.3266517221927643,
-0.39336690306663513,
0.11830826103687... | |
I'm using eclipse, when i close eclipse, it ask me save a file, I press yes and eclipse shuts down. When I open my computer I see that the drive only has 3 bytes left, and I get a bad feeling. I go to my file and oh my god, it's totally blank, size is 0 byte! :(
I need that file back, can a free recovery program can w... | [
0.3736027777194977,
0.20329561829566956,
0.20992814004421234,
-0.02581634558737278,
-0.1360936462879181,
0.012066248804330826,
0.28045853972435,
0.259114533662796,
-0.5536617636680603,
-0.687268078327179,
0.17027927935123444,
0.4902222454547882,
-0.09597313404083252,
0.5326883792877197,
... | |
navigator) explorer.
* Right click on your file and look for the menus to compare... (I recommend Compare though in your case it will not matter since the file is now empty)
* Choose Local History... from the sub menu
If you are lucky and had been using Eclipse to edit the file you should find a few entries there. Loo... | [
0.31124719977378845,
0.12676839530467987,
0.4416061043739319,
0.23404322564601898,
-0.0699445828795433,
-0.3779425024986267,
0.23694196343421936,
0.19225718080997467,
0.24305404722690582,
-1.367066502571106,
0.08530715852975845,
0.9820400476455688,
0.21241150796413422,
0.28906434774398804,... | |
changes to the source control system earlier.
good luck, if that does not work I fear the SO will not be of much help to you :-(
--- EDIT ---
Little something that can help make this trick a tad bit more useful.
you can change the amount of information Eclipse keeps in local history, go to your preferences and then ... | [
0.6986541748046875,
-0.34042826294898987,
0.20172734558582306,
0.4406977593898773,
-0.12841372191905975,
-0.17595456540584564,
0.11135661602020264,
0.26215752959251404,
-0.26090553402900696,
-0.6893018484115601,
0.38821256160736084,
0.7450348138809204,
0.1460684984922409,
0.156658113002777... | |
to sleep. | [
-0.046495258808135986,
0.33301785588264465,
-0.015565792098641396,
-0.02443644031882286,
-0.4219396710395813,
-0.5101773738861084,
-0.03519768640398979,
0.2533561885356903,
0.41363298892974854,
-0.45779770612716675,
-0.5834616422653198,
0.40963998436927795,
-0.07240575551986694,
0.09127676... | |
Yes, this is as stupid a situation as it sounds like. Due to some extremely annoying hosting restrictions and unresponsive tech support, I have to use a CSV file as a database.
While I can use MySQL with PHP, I can't use it with the Python backend of my program because of install issues with the host. I can't use SQL... | [
0.48296040296554565,
0.5320590138435364,
0.2628604471683502,
0.1585777997970581,
0.034503672271966934,
-0.3782474100589752,
0.45488837361335754,
0.26472434401512146,
-0.243779256939888,
-0.5595637559890747,
0.08284960687160492,
0.5424461364746094,
-0.15583740174770355,
0.258987694978714,
... | |
walk, run to get a new host immediately**. If your host won't even get you the most basic of free databases, it's time for a change. There are many fish in the sea.
At the very least I'd recommend an xml data store rather than a csv. [My blog](http://chrisballance.com) uses an xml data provider and I haven't had any i... | [
0.7271408438682556,
-0.2279607653617859,
0.11881563812494278,
0.2826195955276489,
-0.06748345494270325,
-0.1102294772863388,
0.43191835284233093,
0.41084855794906616,
-0.5634206533432007,
-0.7394014596939087,
0.4193773865699768,
0.2920256555080414,
0.14096519351005554,
0.0499059297144413,
... | |
I want to perform this date check:
The date entered by the user **should not be less than** 12 months ago from the current date, e.g.
`if date_value > '03-apr-2009'`
How do I write .NET code to do this?
EDIT:
date\_value which i'm entering is in string format
[ as i did casting already as
*( (System.DateTime)da... | [
0.3112419843673706,
0.042786117643117905,
0.6218665242195129,
-0.14164024591445923,
0.13347052037715912,
0.23348794877529144,
0.0804317370057106,
-0.12049023807048798,
-0.26332852244377136,
-0.531674861907959,
0.28931793570518494,
0.34104010462760925,
-0.0027210426051169634,
0.560269236564... | |
> DateTime.Now.AddYears(-1))
{
//enter code here
}
``` | [
0.5051200985908508,
-0.03173084557056427,
0.4898824691772461,
-0.350153386592865,
0.38621142506599426,
-0.2622126638889313,
0.22457939386367798,
0.15106666088104248,
0.14149412512779236,
-0.7096804976463318,
-0.26228877902030945,
0.4925246834754944,
-0.2512979805469513,
0.06447643786668777... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.