text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
[`WM_SIZE`](http://msdn.microsoft.com/en-us/library/ms632646%28VS.85%29.aspx) message. This is the message that is sent to a window when the size operation is complete (as opposed to [`WM_SIZING`](http://msdn.microsoft.com/en-us/library/ms632647%28VS.85%29.aspx), which is sent during the process).
You can also handle ... | [
0.0320093110203743,
-0.20468130707740784,
0.6495376825332642,
-0.0956142470240593,
-0.058466117829084396,
-0.04416628181934357,
0.17694930732250214,
-0.29054129123687744,
-0.5555297136306763,
-0.5916557312011719,
-0.320022314786911,
0.3788352310657501,
-0.13519446551799774,
0.2378398180007... | |
constants, which you can find here:
<http://www.pinvoke.net/default.aspx/Enums/WindowsMessages.html>
Note that you don't need everything from the link above, just the declarations for those two values:
```
/// <summary>
/// The WM_SIZING message is sent to a window that
/// the user is resizing. By processing this ... | [
0.22640010714530945,
-0.25306829810142517,
0.695044755935669,
-0.038368307054042816,
-0.04581228271126747,
0.321933388710022,
-0.34171262383461,
-0.3794691562652588,
-0.6265270113945007,
-0.5542806386947632,
0.13126075267791748,
0.4686482548713684,
-0.39833715558052063,
0.38396504521369934... | |
I wrote an answer yesterday to this:
[What's the coolest hack you've seen or done?](https://stackoverflow.com/questions/192479/whats-the-coolest-hack-youve-seen-or-done)
and I was trying really hard to remember my 6502 assembly, and I couldn't for the life of me remember how to branch if less than...
```
:1
lda $C... | [
0.20437687635421753,
-0.0970967635512352,
0.2252769023180008,
0.1262519359588623,
0.011723238043487072,
-0.282614529132843,
0.006984195671975613,
0.0734647810459137,
-0.5008805394172668,
-0.07879840582609177,
-0.3748994767665863,
0.2535925805568695,
-0.439377099275589,
-0.24013638496398926... | |
the carry, but I'm not sure if it works in that case.
**BCC is branch if less than**; BCS is branch if greater than or equal. There's a nice tutorial [here](http://www.6502.org/tutorials/compare_beyond.html).
However stu's code can be written more concisely without CMP:
```
BIT $C010 ;clear the keyboard strobe
:1... | [
0.627840518951416,
-0.011436757631599903,
0.5048558115959167,
-0.10258322954177856,
-0.03387776389718056,
0.013571260496973991,
0.017433475703001022,
-0.3133782744407654,
-0.2741824984550476,
0.05000798776745796,
-0.22538089752197266,
0.3701964318752289,
-0.35884538292884827,
-0.0618399865... | |
I'm consuming a webservice from my application in C# .net (2.0) that return values (as string) like this:
```
%23k.%0d%16%c4%8a%18%efG%28%b9c%12%b7%f1%e2%e7j%93
```
I know that the real value for that is:
```
236B2E0D16C48A18EF4728B96312B7F1E2E76A93
```
But I don't know how to convert from the returned value to t... | [
0.14113754034042358,
0.5898022055625916,
0.39737534523010254,
-0.06896055489778519,
0.05753253400325775,
0.33275729417800903,
0.23116439580917358,
0.16671861708164215,
-0.1672680824995041,
-0.7196471691131592,
-0.09485884010791779,
0.570827841758728,
-0.05769099295139313,
0.028857421129941... | |
= ascii.ToString("X2");
``` | [
0.163041353225708,
0.23478348553180695,
-0.040263012051582336,
-0.3079480230808258,
0.10640183091163635,
-0.13490156829357147,
0.10508089512586594,
-0.11312537640333176,
-0.15575197339057922,
-0.24851985275745392,
-0.2997458279132843,
0.3896286189556122,
-0.5404651761054993,
0.202268540859... | |
Yesterday I was playing with jQGrid plugin and ASP.NET. Everything turned out well, my grid is working now, but I have two methods, that make my code smell.
Smelly methods:
```
private IOrderedEnumerable<Employee> GetOrderedEmployees(Column sortColumn, bool ascending)
{
switch (sortColumn)
{
... | [
0.3119422197341919,
0.05559959635138512,
0.30294710397720337,
-0.32887303829193115,
0.09861324727535248,
-0.1708286851644516,
0.03344426676630974,
-0.015175417996942997,
0.01664471998810768,
-0.8331311345100403,
0.050935156643390656,
0.44397228956222534,
-0.323595255613327,
0.1392738223075... | |
return GetOrderedEmployees(e => e.Name, ascending);
}
case Column.Salary:
{
return GetOrderedEmployees(e => e.Salary, ascending);
} | [
-0.397237628698349,
-0.06724344193935394,
0.3962046205997467,
0.010995443910360336,
0.32140111923217773,
0.3541710376739502,
0.057629551738500595,
-0.19350513815879822,
0.004834007006138563,
-0.4402235746383667,
-0.6092247366905212,
0.702484130859375,
-0.11688705533742905,
0.17635197937488... | |
default:
{
return GetOrderedEmployees(e => e.ID, ascending);
}
}
}
private IOrderedEnumerable<Employee> GetOrderedEmployees<TSortKey>(Func<Employee, TSortKey> func, bool ascending)
{
return ascending ? Context.Employees.OrderBy(func) : | [
-0.44296902418136597,
-0.043644413352012634,
0.3696431517601013,
-0.028797738254070282,
0.19420196115970612,
0.1632450371980667,
0.10835494101047516,
0.0407135970890522,
-0.16119301319122314,
-0.48051127791404724,
-0.5687918066978455,
0.5595760345458984,
-0.18912799656391144,
0.15593735873... | |
Context.Employees.OrderByDescending(func);
}
```
I can't find out, how to refactor them properly. It's seems the best solution is to return only lambdas (f.e `return e=>e.Name`) in the switch statement, but how can it be done?
In the switch statement `ascending` argument is passed 3 times. Isn't it a duplication... | [
-0.16539770364761353,
0.02108253911137581,
0.24316060543060303,
-0.14725732803344727,
-0.051194604486227036,
0.08693066239356995,
0.29026907682418823,
-0.23103216290473938,
-0.2482689768075943,
-0.4977042078971863,
0.04261498153209686,
0.6158488392829895,
-0.44085249304771423,
0.1998898833... | |
are necessary and often require this kind of code.)
I don't think that you are at the point in which you need to refactor anything. If that switch statement becomes a maintenance headache, than go right ahead, but not all switch statements constitute "code smell".
To address your code duplication concern, you can use... | [
0.6269687414169312,
-0.01186418253928423,
0.24192816019058228,
-0.038691241294145584,
0.06055422127246857,
-0.4220750629901886,
0.338962584733963,
-0.38405221700668335,
0.17131328582763672,
-0.6035445928573608,
-0.04907780885696411,
0.8366746306419373,
-0.1307610273361206,
0.04486012458801... | |
I have about 10million values that I need to put in some type of look up table, so I was wondering which would be more efficient a *list* or *dict*?
I know you can do something like this for both:
```
if something in dict_of_stuff:
pass
```
and
```
if something in list_of_stuff:
pass
```
My thought is th... | [
0.05270780250430107,
0.34923169016838074,
0.20352019369602203,
0.04819576069712639,
-0.2098599076271057,
-0.1436671018600464,
0.13806560635566711,
-0.01474777702242136,
-0.3181682825088501,
-0.8068010807037354,
-0.025585949420928955,
0.47304531931877136,
-0.3253372311592102,
-0.28940939903... | |
Efficiency for look up.
**EDIT 3**
There are no values assosiated with the value...so would a *set* be better?
Speed
=====
Lookups in lists are O(n), lookups in dictionaries are amortized O(1), with regard to the number of items in the data structure. If you don't need to associate values, use sets.
Memory
=====... | [
-0.05796544626355171,
0.004780012182891369,
0.08314717561006546,
0.09655299782752991,
-0.04739675670862198,
0.18537171185016632,
0.12912550568580627,
-0.5685034394264221,
-0.07160622626543045,
-1.0912529230117798,
-0.005614872556179762,
0.7410473227500916,
-0.5337945222854614,
-0.385055094... | |
fly (which you do, based on your updated question), it might be worthwhile to sort the list and use binary search. This is O(log n), and is likely to be slower for strings, impossible for objects which do not have a natural ordering. | [
0.40654414892196655,
-0.16285575926303864,
0.01286391168832779,
0.20466867089271545,
0.14472971856594086,
-0.08646056801080704,
0.04307893291115761,
-0.3461942970752716,
-0.1796904355287552,
-0.5595434904098511,
-0.12404914945363998,
0.44704243540763855,
-0.513390302658081,
-0.474825710058... | |
I am trying to put all the pieces together for my MVVM Silverlight application and I see some blogs touch on Service Locators.
What is a service locator and when should it be used?
I've used ServiceLocator in combination with MVVM to enable declarative binding from the View to the ViewModel.
The ServiceLocator is pu... | [
0.23170119524002075,
0.08581392467021942,
0.2781796157360077,
-0.13239875435829163,
-0.35450485348701477,
0.007673509418964386,
0.10539702326059341,
-0.020616739988327026,
0.03730875998735428,
-0.8595091700553894,
-0.06439615041017532,
0.3518657386302948,
-0.33535996079444885,
0.2736752033... | |
_repository = ServiceLocator.Instance.DataRepository;
}
```
So in this case the ViewModel is pulling an instance of the IDataRepository interface from the ServiceLocator.
The ServiceLocator might be backed by a IoC container (but not necessary).
The benefit of doing this is that you can add the ServiceLocator as a ... | [
-0.03550582006573677,
0.1806885153055191,
0.5749961733818054,
-0.0011182415764778852,
-0.15031610429286957,
0.1817217469215393,
0.1628590226173401,
-0.08376948535442352,
-0.09700103849172592,
-0.7671921253204346,
-0.3708929121494293,
0.4157766103744507,
-0.23657988011837006,
0.164516597986... | |
a ServiceLocator.
I have a [blog post about Dependency Injection, IoC and ServiceLocators in a Silverlihgt/MVVM context](http://jonas.follesoe.no/2008/07/24/youcard-re-visited-implementing-dependency-injection-in-silverlight/) over at my blog. | [
0.38558557629585266,
-0.01312714722007513,
0.25937315821647644,
0.007484588772058487,
-0.08986057341098785,
-0.3050104081630707,
0.34269747138023376,
-0.06252597272396088,
-0.305508553981781,
-0.5893926024436951,
-0.22097456455230713,
0.385861337184906,
-0.30845382809638977,
-0.00242177164... | |
Lets say you want to create a listing of widgets
The Widget Manufacturers all create widgets with different number and types of attributes. And the Widget sellers all have different preferences on what type and number of attributes they want to store in the database and display.
The problem here now is that each time... | [
0.8095986247062683,
0.3343866169452667,
0.3626343011856079,
0.2972751557826996,
0.029508231207728386,
-0.18822304904460907,
-0.007908083498477936,
-0.1402183324098587,
-0.38456815481185913,
-0.5056626200675964,
0.4626704454421997,
0.6822072863578796,
-0.15796446800231934,
0.204996228218078... | |
this change.
How do you go about creating a database which takes into account that attributes on a widget are fluid and can change from widget to widget.
Ideally the widget attributes should be something the user can define according to his/her preference and needs
I would have a table for widgets and one for widget... | [
0.3278474509716034,
0.040129903703927994,
0.5221136808395386,
0.14427436888217926,
-0.17894460260868073,
-0.11969009786844254,
-0.25144800543785095,
-0.4519253373146057,
-0.1391827017068863,
-0.8461342453956604,
0.40840813517570496,
0.7278542518615723,
-0.04944750666618347,
0.1212636828422... | |
Id column in the Widget table)
- WidgetAttributeId
(a value from the Id column in the WidgetAttribute table)
```
This way, you can add attributes to widgets by modifying rows in the WidgetAttributeMap table, not by modifying the structure of your widget table. | [
0.1963598132133484,
0.18190395832061768,
0.4116809666156769,
0.3059936761856079,
-0.4112764298915863,
-0.21827717125415802,
-0.0009547265362925828,
-0.38394075632095337,
0.16598019003868103,
-0.6034518480300903,
0.03575536981225014,
0.5290300846099854,
0.0010560584487393498,
0.127637013792... | |
I've read the [article on Wikipedia on the Duff's device](http://en.wikipedia.org/wiki/Duff%27s_device), and I don't get it. I am really interested, but I've read the explanation there a couple of times and I still don't get it how the Duff's device works.
What would a more detailed explanation be?
There are some good... | [
0.5000415444374084,
0.2921960651874542,
0.3242762088775635,
0.10511989891529083,
-0.07222007215023041,
0.2159273475408554,
0.04653489962220192,
-0.17040440440177917,
-0.3036297857761383,
-0.6378710865974426,
0.29347705841064453,
0.41616585850715637,
-0.2646661400794983,
0.06038415059447288... | |
// Set to 20
{
int n = (count + 7) / 8; // n is now 3. (The "while" is going
// to be run three times.)
switch (count | [
0.1060943603515625,
-0.4015513062477112,
0.5226790904998779,
-0.5363556146621704,
0.19956907629966736,
0.016877315938472748,
0.2791152596473694,
-0.4962964653968811,
-0.5915707945823669,
-0.23134081065654755,
-0.1639145463705063,
0.6483064293861389,
-0.14275018870830536,
0.0168956629931926... | |
% 8) { // The remainder is 4 (20 modulo 8) so
// jump to the case 4
case 0: // [skipped] | [
-0.22302082180976868,
0.010409928858280182,
0.18545956909656525,
-0.15158435702323914,
0.34708118438720703,
0.13630922138690948,
0.2507244944572449,
-0.32636508345603943,
-0.4372905194759369,
0.0333155021071434,
-0.29585933685302734,
0.40459081530570984,
-0.41288653016090393,
-0.2641615569... | |
do { // [skipped]
*to = *from++; // [skipped]
case 7: *to = *from++; // [skipped]
case 6: *to = *from++; // [skipped]
case 5: *to = *from++; // [skipped]
case 4: | [
0.07118436694145203,
-0.037314724177122116,
-0.11161532998085022,
0.022844446823000908,
0.27493542432785034,
0.1660211831331253,
0.09262870252132416,
-0.34083110094070435,
-0.33530887961387634,
-0.03178618475794792,
-0.26897627115249634,
0.13594572246074677,
-0.18098925054073334,
-0.470295... | |
*to = *from++; // Start here. Copy 1 byte (total 1)
case 3: *to = *from++; // Copy 1 byte (total 2)
case 2: *to = *from++; // Copy 1 byte (total 3)
case 1: *to = *from++; // Copy 1 byte (total 4)
} while (--n > 0); | [
0.11233209073543549,
0.08933450281620026,
0.27168869972229004,
-0.29871121048927307,
0.17222362756729126,
0.20820364356040955,
0.06959237903356552,
-0.6658242344856262,
-0.03515072911977768,
-0.31225481629371643,
-0.3465472459793091,
0.5374439358711243,
-0.31854331493377686,
0.045085422694... | |
// N = 3 Reduce N by 1, then jump up
// to the "do" if it's still
} // greater | [
0.1130741536617279,
-0.18114548921585083,
0.37366414070129395,
-0.3917784094810486,
-0.10539005696773529,
0.06674674898386002,
0.30869364738464355,
-0.8971337080001831,
-0.3867199122905731,
-0.22483550012111664,
-0.086810402572155,
0.3940954804420471,
-0.17899982631206512,
-0.1288733482360... | |
than 0 (and it is)
}
```
Now, start the second pass, we run just the indicated code:
```
int count; //
{
int n = (count + 7) / 8; //
//
switch (count % 8) { | [
-0.04231281951069832,
-0.32733866572380066,
0.8343960642814636,
-0.28630203008651733,
0.23928454518318176,
-0.2396698147058487,
0.3160274624824524,
-0.4343493580818176,
0.06799452751874924,
-0.44859522581100464,
-0.15360987186431885,
0.620148241519928,
-0.21926304697990417,
0.2580833137035... | |
//
//
case 0: //
do { | [
-0.2719617784023285,
0.1239168792963028,
-0.18345704674720764,
-0.22738634049892426,
0.36061009764671326,
0.03817182034254074,
0.11184339225292206,
-0.02668001875281334,
0.08857951313257217,
-0.23594921827316284,
-0.4703209698200226,
0.612235963344574,
-0.12974603474140167,
-0.187492296099... | |
// The while jumps to here.
*to = *from++; // Copy 1 byte (total 5)
case 7: *to = *from++; // Copy 1 byte (total 6)
case 6: *to = *from++; // Copy 1 byte (total 7)
case 5: *to = *from++; // Copy 1 byte (total 8) | [
-0.0008248973754234612,
-0.08248328417539597,
0.3400271534919739,
-0.11851520091295242,
0.23285970091819763,
0.5272412896156311,
0.1899552047252655,
-0.2522830069065094,
-0.39665383100509644,
0.03284977376461029,
-0.2512569725513458,
0.6012553572654724,
-0.1726972907781601,
-0.009384293109... | |
case 4: *to = *from++; // Copy 1 byte (total 9)
case 3: *to = *from++; // Copy 1 byte (total 10)
case 2: *to = *from++; // Copy 1 byte (total 11)
case 1: *to = *from++; // Copy 1 byte (total 12)
} while (--n > 0); | [
0.04897690936923027,
0.012390272691845894,
0.19057288765907288,
-0.12692241370677948,
0.2559991478919983,
0.30380961298942566,
-0.05284160003066063,
-0.6753296256065369,
-0.047634270042181015,
-0.20282743871212006,
-0.3714745044708252,
0.6419788002967834,
-0.3700787127017975,
-0.1596784889... | |
// N = 2 Reduce N by 1, then jump up
// to the "do" if it's still
} // greater than 0 (and | [
0.03262246027588844,
-0.24512001872062683,
0.38431963324546814,
-0.4190530776977539,
0.19236965477466583,
-0.04765159636735916,
0.19577790796756744,
-0.6199301481246948,
-0.29217758774757385,
-0.06388359516859055,
-0.2627955973148346,
0.2399919480085373,
-0.19528698921203613,
-0.2327229678... | |
it is)
}
```
Now, start the third pass:
```
int count; //
{
int n = (count + 7) / 8; //
//
switch (count % 8) { // | [
-0.025158775970339775,
-0.15863348543643951,
0.7635911107063293,
-0.5671172738075256,
0.01764679327607155,
-0.13813629746437073,
0.3292791545391083,
-0.567681610584259,
-0.0661151111125946,
-0.4655008018016815,
-0.31880900263786316,
0.5371993184089661,
-0.41697731614112854,
-0.031606510281... | |
//
case 0: //
do { // The while jumps to here. | [
-0.24437426030635834,
-0.06583283096551895,
0.015762029215693474,
-0.23599831759929657,
0.3642429709434509,
0.06404875218868256,
0.03918035328388214,
0.16356156766414642,
0.029958121478557587,
-0.2133873850107193,
-0.358285516500473,
0.5407626032829285,
-0.09132615476846695,
-0.06458900123... | |
*to = *from++; // Copy 1 byte (total 13)
case 7: *to = *from++; // Copy 1 byte (total 14)
case 6: *to = *from++; // Copy 1 byte (total 15)
case 5: *to = *from++; // Copy 1 byte (total 16)
case 4: *to = | [
0.0713438168168068,
0.15581271052360535,
0.2493414580821991,
0.03337641805410385,
0.263833224773407,
0.5278639793395996,
0.05081254243850708,
-0.7433416247367859,
-0.32116764783859253,
-0.18145985901355743,
-0.4501864016056061,
0.5193662643432617,
-0.1435299813747406,
-0.05399763956665993,... | |
*from++; // Copy 1 byte (total 17)
case 3: *to = *from++; // Copy 1 byte (total 18)
case 2: *to = *from++; // Copy 1 byte (total 19)
case 1: *to = *from++; // Copy 1 byte (total 20)
} while (--n > 0); // N = 1 Reduce N by 1, | [
-0.000013407573533186223,
-0.08689118176698685,
0.402075856924057,
-0.23950819671154022,
0.06925654411315918,
0.541978120803833,
-0.041145071387290955,
-0.8510401844978333,
-0.4457869827747345,
-0.2666432857513428,
-0.21499355137348175,
0.4546888470649719,
-0.2689969539642334,
0.0544365867... | |
then jump up
// to the "do" if it's still
} // greater than 0 (and it's not, so bail)
} | [
0.30743229389190674,
-0.4199981987476349,
0.1546650379896164,
0.07793605327606201,
0.39495110511779785,
-0.3951506018638611,
0.03669923171401024,
-0.4652458131313324,
-0.25612446665763855,
-0.05518893525004387,
-0.3033132255077362,
0.4537254571914673,
-0.3631279170513153,
-0.35353597998619... | |
// continue here...
```
20 bytes are now copied.
Note: The original Duff's Device (shown above) copied to an I/O device at the `to` address. Thus, it wasn't necessary to increment the pointer `*to`. When copying between two memory buffers you'd need to use `*to++`. | [
0.16883164644241333,
0.1839534044265747,
0.39856353402137756,
0.025075264275074005,
0.4020298719406128,
0.0658053308725357,
0.17454589903354645,
-0.012856903485953808,
-0.2655702531337738,
-0.6196669936180115,
0.10011973232030869,
0.27080684900283813,
-0.125104159116745,
0.3345595002174377... | |
I want to up the time my users will stay logged into my site without getting automatically logged out after a period of inactivity. I'm tracking the logged in status using PHP sessions.
How can I set this, I'm trying to control this from my .htaccess file.
You can't do that from the htaccess file but You can change th... | [
0.6681433320045471,
0.018544234335422516,
0.5911562442779541,
-0.01590031199157238,
0.12894229590892792,
-0.23458221554756165,
0.26563623547554016,
0.05007888376712799,
-0.3159213662147522,
-0.6922507882118225,
0.34939542412757874,
0.6434251666069031,
-0.19984623789787292,
-0.0087203020229... | |
I am running
```
ruby script/generate scaffold
```
or
```
ruby script/generate model
```
and I know the basic syntax, like
```
ruby script/generate scaffold Dude name:string face:boolean
```
but I do not know things like:
* should names of variables have underscores or be camelCased?
* what kind of variable ... | [
0.2568979263305664,
-0.02396291308104992,
0.29222309589385986,
0.1212150976061821,
-0.06685557961463928,
-0.07056982070207596,
0.23852477967739105,
0.07521605491638184,
0.04776632413268089,
-0.5675951838493347,
-0.07596275955438614,
0.644541323184967,
-0.1270691603422165,
0.141745492815971... | |
I am developing a framework, and some of the objects have reaaally long names. I don't really like this, but I don't like acronyms either. I am trying to come up with a shorter name for "EventModelSocket", basically a wrapper around the .Net socket class that implements various events, and methods to send files, object... | [
0.24038942158222198,
-0.1810421347618103,
0.11727886646986008,
-0.05413210391998291,
-0.11944164335727692,
-0.2889869511127472,
0.1336582452058792,
0.36714062094688416,
-0.14605996012687683,
-0.768013060092926,
0.03975744917988777,
0.20714840292930603,
-0.022388242185115814,
0.183928743004... | |
some of it into the namespace.
For example:
```
EventModelSocketObjectReceivedEventArgs
```
becomes
```
EventModel.Sockets.ReceivedEventArgs
``` | [
-0.1884152740240097,
-0.14611582458019257,
0.16945384442806244,
-0.1980547159910202,
-0.06985065340995789,
-0.0939471498131752,
-0.0859963595867157,
0.2139301598072052,
-0.28039446473121643,
-0.5277503728866577,
-0.40482228994369507,
0.26863712072372437,
-0.10452684015035629,
0.23344202339... | |
I have a set of strings with numbers embedded in them. They look something like /cal/long/3/4/145:999 or /pa/metrics/CosmicRay/24:4:bgp:EnergyKurtosis. I'd like to have an expression parser that is
* Easy to use. Given a few examples someone should be able to form a new expression. I want end users to be able to form ... | [
0.5834178924560547,
0.09018174558877945,
0.29365724325180054,
0.11591598391532898,
-0.10609549283981323,
0.2286347597837448,
0.35009923577308655,
-0.20989587903022766,
0.06830813735723495,
-0.6621236205101013,
-0.13457298278808594,
0.46092766523361206,
-0.10857760161161423,
-0.182566270232... | |
'|' and *. So the expression '/cal/(long|short)/3/4/*' would match '/cal/long/3/4/1:2' as well as '/cal/short/3/4/1:2'.
* Has a Java implementation available or would be easy to implement in Java.
Interesting alternative ideas would be useful. I'm also entertaining the idea of just implementing the subset of regular e... | [
0.35180479288101196,
0.2255079746246338,
0.107754185795784,
-0.17848758399486542,
0.00421714736148715,
0.4356103241443634,
0.4354564845561981,
0.043433189392089844,
0.06684241443872452,
-0.527474045753479,
-0.03216782584786415,
0.9044926762580872,
-0.2989497780799866,
-0.3937966227531433,
... | |
answer and follow the other suggestions here. :)
You might want to consider a parser generator - things like the classic lex and yacc. I'm not really familiar with the Java choices, but here's a list:
<http://java-source.net/open-source/parser-generators>
If you're not familiar, the standard approach would be to fir... | [
0.07954997569322586,
-0.06750861555337906,
-0.11029882729053497,
0.2970188558101654,
-0.30175113677978516,
0.3027516007423401,
-0.2107856571674347,
-0.2536538541316986,
-0.035449475049972534,
-0.5137795805931091,
-0.04599480330944061,
0.5466803312301636,
-0.2092105746269226,
-0.23343613743... | |
give you the regular expression `\/cal/long/3/4/143:(\d+)\` and a constraint to apply to the first grouping (the `\d+` portion) that requires that the number lie between 100 and 1100. You'd then apply the RE to your strings for candidates, and apply the constraint to those candidates to find your matches.
It's a prett... | [
0.6058579683303833,
0.059964586049318314,
0.38505789637565613,
-0.14084844291210175,
0.23995159566402435,
0.3668006956577301,
-0.04373596981167793,
-0.4698851704597473,
0.21965934336185455,
-0.30726897716522217,
-0.10866216570138931,
0.5346276164054871,
-0.2895057201385498,
-0.085941843688... | |
What's the "Bad magic number" ImportError in python, and how do I fix it?
The only thing I can find online suggests this is caused by compiling a .py -> .pyc file and then trying to use it with the wrong version of python. In my case, however, the file seems to import fine some times but not others, and I'm not sure w... | [
0.482575923204422,
0.3271072804927826,
0.13508304953575134,
-0.034682050347328186,
0.05346456170082092,
-0.238869309425354,
0.4166891872882843,
0.20073837041854858,
-0.5482938289642334,
-0.3369119167327881,
-0.026323022320866585,
0.6336897611618042,
-0.4694078266620636,
0.11349431425333023... | |
from Normalization import Normalizer
```
The magic number comes from UNIX-type systems where the first few bytes of a file held a marker indicating the file type.
Python puts a similar marker into its `pyc` files when it creates them.
Then the python interpreter makes sure this number is correct when loading it.
An... | [
-0.20688050985336304,
-0.14577616751194,
0.3339991569519043,
0.07605151832103729,
-0.2485325187444687,
-0.032953888177871704,
-0.06385025382041931,
0.036714307963848114,
-0.0967288389801979,
-0.2797471880912781,
-0.36538463830947876,
0.6494619846343994,
-0.5481917262077332,
-0.148894697427... | |
type systems, that could be something as simple as:
```
rm *.pyc
```
or:
```
find . -name '*.pyc' -delete
```
If they are not yours, you'll have to either get the `py` files for re-compilation, or an interpreter that can run the `pyc` files with that particular magic value.
One thing that might be causing the in... | [
0.2614540457725525,
0.3217068910598755,
0.297553151845932,
0.05743475630879402,
0.027552856132388115,
0.05120519921183586,
0.29970425367355347,
-0.008723176084458828,
-0.5188437104225159,
-0.5678625106811523,
0.02344365604221821,
0.42369765043258667,
-0.5379665493965149,
0.2195143103599548... | |
of all magic numbers can be found in `Python/import.c`, reproduced here for completeness (current as at the time the answer was posted, it may have changed since then):
```
1.5: 20121
1.5.1: 20121
1.5.2: 20121
1.6: 50428
2.0: 50823
2.0.1: 50823
2.1: 60202
2.1.1: 60202
2.1.2: 60202
2.2: 60717
2.3a0: 62011
2.3... | [
-0.15373659133911133,
0.3672434389591217,
0.24438464641571045,
-0.08864756673574448,
-0.3625928461551666,
0.23166169226169586,
0.8935337662696838,
-0.28928735852241516,
-0.3815142810344696,
0.03177109733223915,
-0.07797796279191971,
0.002734777517616749,
-0.501218318939209,
0.2337774187326... | |
I'd like to know how to limit an input value to signed decimals using `std::cin`.
```
double i;
//Reading the value
cin >> i;
//Numeric input validation
if(!cin.eof())
{
peeked = cin.peek();
if(peeked == 10 && cin.good())
{
//Good!
count << "i is a decimal";
}
els... | [
0.254718154668808,
-0.20484355092048645,
0.3574608862400055,
-0.0007770221563987434,
0.08790019899606705,
0.12970799207687378,
0.028058890253305435,
-0.1385343372821808,
-0.03902750834822655,
-0.24273882806301117,
0.0617532879114151,
0.38413625955581665,
-0.052579399198293686,
0.1018786057... | |
count << "i is not a decimal";
cin.clear();
cin >> discard;
}
}
```
This also gives an error message with the input -1a2.0 avoiding the assignation of just -1 to i. | [
0.14690645039081573,
-0.023987699300050735,
0.20300467312335968,
-0.12825286388397217,
-0.004566974006593227,
-0.04319165274500847,
-0.04183459281921387,
-0.2828904092311859,
-0.1007385104894638,
0.06122235581278801,
-0.18291591107845306,
0.33040446043014526,
-0.3073521852493286,
0.1900642... | |
I've noticed the returnurl URL parameter on the Stackoverflow login/logout links are not escaped but when I try to add path as a parameter to a route it gets escaped.
So /login?returnurl=/questions/ask shows /login?returnurl=%2fquestions%2fask and it's kind of ugly. How do I get it to not escape the returnurl value?
... | [
0.08973517268896103,
-0.0846857875585556,
0.614271342754364,
-0.16238060593605042,
-0.029046544805169106,
-0.15354114770889282,
0.33284035325050354,
-0.2776384651660919,
-0.4044758081436157,
-0.8939650654792786,
0.17435334622859955,
0.5530179738998413,
-0.5305143594741821,
0.03921004384756... | |
string linkText, string actionName, string controllerName, object values, object htmlAttributes)
{
RouteValueDictionary routeValues = new RouteValueDictionary(values);
RouteValueDictionary htmlValues = new RouteValueDictionary(htmlAttributes);
UrlHelper urlHelper = new UrlHelper(html.ViewCo... | [
-0.24084608256816864,
-0.3854222297668457,
1.0021111965179443,
-0.037569865584373474,
-0.22495685517787933,
0.20301978290081024,
0.38078805804252625,
-0.4987236559391022,
-0.5066686272621155,
-0.5334860682487488,
-0.6036827564239502,
0.39176422357559204,
-0.35294657945632935,
0.27452623844... | |
{
object value = pair.Value ?? "";
paramList.Add(String.Concat(pair.Key, "=", Convert.ToString(value, CultureInfo.InvariantCulture)));
}
url += String.Join("&", paramList.ToArray());
TagBuilder builder = new TagBuilder("a");
builder.InnerHtml = string.IsNullOrEmp... | [
-0.13381940126419067,
-0.25803640484809875,
0.846790075302124,
-0.2317447066307068,
-0.14565002918243408,
0.3684719502925873,
0.6269257664680481,
-0.7524158358573914,
-0.25313642621040344,
-0.6024552583694458,
-0.41489890217781067,
0.460505872964859,
-0.5037874579429626,
0.2169031947851181... | |
url);
return builder.ToString(TagRenderMode.Normal);
}
``` | [
-0.06339705735445023,
-0.12050176411867142,
0.4888105094432831,
-0.2802409827709198,
0.15844319760799408,
-0.13865287601947784,
0.5441655516624451,
-0.30944129824638367,
0.28181472420692444,
-0.31305474042892456,
-0.4740448594093323,
0.8192834854125977,
-0.22731724381446838,
0.513227462768... | |
I was asked about the possibility of creating an ANT script that could be use to copy property files (associated to target environment), create an EAR file (perhaps using JDeveloper deploy file), and deploy that EAR file to target OC4J container.
I am asking if anyone ever successfully invoking JDeveloper automaticall... | [
0.45025572180747986,
0.22624647617340088,
-0.3366122245788574,
0.04714541509747505,
-0.18344037234783173,
-0.09774983674287796,
0.055499713867902756,
0.1453666090965271,
0.031555503606796265,
-0.8108463883399963,
0.07176894694566727,
0.692935585975647,
-0.10046714544296265,
-0.227333888411... | |
file because I strongly believe that a build process must be autosufficient (i.e. as few external dependencies as possible).
Using Ant, you can simply use the [Ear task](http://ant.apache.org/manual/Tasks/ear.html) (remember that the Ear task is a subtask of the [Zip task](http://ant.apache.org/manual/Tasks/zip.html),... | [
0.5388067960739136,
0.223423033952713,
0.24387289583683014,
-0.16029466688632965,
0.13992440700531006,
-0.1476677656173706,
0.22962403297424316,
-0.07593725621700287,
0.006802697200328112,
-0.8558079600334167,
-0.255112886428833,
0.8614800572395325,
-0.2645959258079529,
-0.1808016300201416... | |
In ASP.NET MVC, how does the controller pass information between the model and the view?
Let's say I have a list of baseball players in my database. After I query those players using LINQ in the controller, how do I then pass this information on to view (my list of baseball players and their stats)?
And after I pass ... | [
0.22562098503112793,
-0.381182998418808,
0.4100322127342224,
0.28187912702560425,
-0.30582353472709656,
-0.07724449038505554,
-0.3116801679134369,
-0.20093053579330444,
-0.48433607816696167,
-0.6619341373443604,
0.19194546341896057,
0.551964521408081,
-0.23662857711315155,
-0.0409888289868... | |
you can access the same ViewData on the View:
```
<? foreach(var player in ViewData["players"] as List) {} ?>
```
You can also make a strong typed view, changing the view base class from ViewPage to ViewPage < T >, where T is your user-defined class. At the controller you return the class on the return method View()... | [
-0.18630951642990112,
-0.5490149259567261,
0.5059100389480591,
0.017850473523139954,
-0.15209604799747467,
0.03362490236759186,
-0.06333312392234802,
-0.13082052767276764,
-0.14673146605491638,
-0.6727994084358215,
-0.07395118474960327,
0.7081806659698486,
-0.34786349534988403,
0.343043595... | |
I'm fairly new to Java (been writing other stuff for many years) and unless I'm missing something (and I'm happy to be wrong here) the following is a fatal flaw...
```
String foo = new String();
thisDoesntWork(foo);
System.out.println(foo);//this prints nothing
public static void thisDoesntWork(String foo){
foo = ... | [
0.3118581175804138,
0.3669458329677582,
0.3071712255477905,
-0.3565559983253479,
0.10301435738801956,
-0.4704973101615906,
0.7112066745758057,
-0.2265644073486328,
-0.20734775066375732,
-0.5539020299911499,
0.009367328137159348,
0.49657338857650757,
-0.30407050251960754,
0.2156422138214111... | |
method (and not be stuck with the value set by the overloaded =).
Can someone explain to me what the reasoning behind this design choice was? As I said, I'm not looking to be right here, and perhaps I'm missing something obvious?
[This rant](http://javadude.com/articles/passbyvalue.htm) explains it better than I could... | [
0.00983155332505703,
-0.0085219107568264,
-0.0420248880982399,
0.04202013090252876,
-0.23527447879314423,
-0.19016288220882416,
0.47218891978263855,
-0.44379958510398865,
-0.11478248238563538,
-0.34097588062286377,
0.08163993805646896,
0.21728473901748657,
-0.5696589946746826,
0.1750378757... | |
This is the situation:
I have a Trigger.dll and a Trigger.XmlSerializer.dll.
I use CREATE ASSEMBLY to register them in MSSQL.
Now, I have compiled new versions of both.
I want to use ALTER ASSEMBLY to update them, however you can only update one at a time. If you try to update one that has a dependency, it complai... | [
0.31614863872528076,
0.14179837703704834,
0.4486427307128906,
-0.12426333129405975,
0.013117740862071514,
-0.11855897307395935,
0.44407352805137634,
-0.3716154992580414,
-0.13742664456367493,
-0.6254575252532959,
0.1658589094877243,
0.6015657186508179,
-0.544874370098114,
0.112261325120925... | |
the scenario that was described in the "How to upgrade or downgrade an assembly" section.
* This example assumes that the versions of the two assemblies are both 1.0.0.0 and the assemblies are both written in C#. When you follow these steps, you try to upgrade assembly A and assembly B to version 2.0.0.0.
To upgrade o... | [
-0.018680118024349213,
0.038177020847797394,
0.45725059509277344,
-0.1542687565088272,
0.24634985625743866,
-0.015008254908025265,
0.3069755434989929,
-0.21996672451496124,
0.04620785638689995,
-0.8458346128463745,
0.042608167976140976,
0.7321292757987976,
-0.3970026671886444,
0.0858801752... | |
version 2.0.0.0. When you do this, reference version 1.0.0.0 of assembly B from the backup that you made in step 1. To do this, use the Csc.exe compiler tool together with the /reference switch. For example, use the following command:
csc /target:library /out:AssemblyA.dll AssemblyA.cs AssemblyInfo.cs /reference:"Back... | [
0.09894447028636932,
-0.16698604822158813,
0.6230078339576721,
-0.1010662168264389,
-0.11801932007074356,
-0.3033002018928528,
0.19746990501880646,
-0.2935490608215332,
-0.07498922944068909,
-0.9018747806549072,
0.01909969374537468,
0.5886467695236206,
-0.354172945022583,
0.007134771905839... | |
I have a small project I am doing in Python using web.py. It's a name generator, using 4 "parts" of a name (`firstname, middlename, anothername, surname`). Each part of the name is a collection of entites in a MySQL databse (`name_part (id, part, type_id)`, and `name_part_type (id, description)`). Basic stuff, I guess.... | [
0.08085581660270691,
0.2478213757276535,
0.24904394149780273,
-0.042040154337882996,
-0.12349118292331696,
0.3344685137271881,
0.10156764090061188,
-0.04689216613769531,
0.012492969632148743,
-0.5849802494049072,
0.0951811820268631,
0.06862906366586685,
-0.1622353196144104,
0.1868426650762... | |
figured this was better than one fat query returning potentially hundreds of rows; if you have a suggestion for how to pull this off in one query w/o a sproc I'll listen).
Obviously I want to make this more random. Actually, I want to give it better coverage, not necessarily randomness. I want to make sure it's using ... | [
0.37297967076301575,
0.06932218372821808,
0.10170723497867584,
-0.07081084698438644,
-0.16284412145614624,
0.18561233580112457,
-0.001395951840095222,
-0.012338251806795597,
-0.3118742108345032,
-0.7477406859397888,
0.10293460637331009,
0.38546299934387207,
-0.27281883358955383,
0.35991638... | |
time I use it. I would need some logic to then say like: "get a name\_part that is less than the highest "counter" for this "name\_part\_type", unless there are none then pick a random one". I am not very good at SQL, is this kind of logic even possible? The only way I can think to do this would require up to 3 or 4 qu... | [
0.17760473489761353,
0.26617416739463806,
0.31643959879875183,
-0.08203747123479843,
0.14843040704727173,
-0.13955026865005493,
0.4485396444797516,
-0.20016008615493774,
-0.31362563371658325,
-0.7605190873146057,
0.2504982054233551,
0.656195878982544,
-0.07589033246040344,
0.14127090573310... | |
but can you guys at least help me solve how to do it without a sproc? (I don't know if I can even use a sproc with the built-in database stuff of web.py).
I hope this isn't terribly dumb but thanks ahead of time.
edit: Aside from my specific problem I am still curious if there are any alternate strategies I can use ... | [
0.14769884943962097,
0.2272733449935913,
0.11797665059566498,
0.19380012154579163,
0.03619682043790817,
-0.2190910428762436,
0.1828804463148117,
-0.05305841192603111,
-0.18245689570903778,
-0.6313468217849731,
0.016364794224500656,
0.5842837691307068,
0.03821625933051109,
-0.15390181541442... | |
top of the list and, if there's multiples with the same (lowest) used\_count, they'll sort randomly. | [
0.19280314445495605,
0.06312194466590881,
0.26203453540802,
0.0592644102871418,
0.3476872742176056,
0.05015307664871216,
-0.14593452215194702,
-0.08726833760738373,
-0.40429702401161194,
-0.5133369565010071,
-0.21988992393016815,
0.4388446807861328,
-0.31314754486083984,
0.0687552466988563... | |
Looking through my server logs, I see that a lot of pages on my site are requesting `favicon.ico`, `favicon.jpg`, `favicon.png`, etc in a variety of different directories.
Instead of wading through each page to try to figure out where each incorrect request is coming from, I'm writing some apache redirect rules to cha... | [
0.02635234035551548,
-0.3467738926410675,
0.5375794172286987,
-0.03713489696383476,
-0.051159948110580444,
0.20724628865718842,
0.5094997882843018,
-0.24154703319072723,
-0.10939892381429672,
-0.37583187222480774,
0.14510928094387054,
0.3497421443462372,
-0.5355254411697388,
0.148032084107... | |
Request | Response |
|------------------------|--------------|
| favicon.png | /favicon.ico |
| directory/favicon.png | /favicon.ico |
| directory/favicon.ico | /favicon.ico |
| favicon.ico | <no match> |
```
Try this
```
RewriteCond %{REQUEST_URI} !^/favicon\.ico [NC] # i... | [
-0.38457730412483215,
-0.18528792262077332,
1.1322015523910522,
0.21636278927326202,
0.07992497086524963,
0.29813674092292786,
0.222514808177948,
-0.26951953768730164,
-0.14041124284267426,
-0.7006887197494507,
-0.2823401987552643,
-0.054820913821458817,
-0.18114539980888367,
0.28054884076... | |
I've implemented my own copy of the model view presenter pattern (in vein of web client software factory) so I can leverage my own DI framework instead of being tied to WCSF's ObjectBuilder which I had numerous problems with. I've come up with a few ways to do it but none of them particularly make me happy. I wanted to... | [
0.009605216793715954,
-0.09364037960767746,
0.539126455783844,
-0.09619300067424774,
-0.26431748270988464,
0.180991068482399,
0.4238598346710205,
-0.20411719381809235,
-0.1005842462182045,
-0.840010404586792,
-0.136525496840477,
0.49763789772987366,
-0.5168797373771667,
0.292580246925354,
... | |
set
{
_presenter = value;
_presenter.View = this;
}
}
}
```
Solution #1b
------------
Call buildup in page load instead of using a HttpModule
```
public partial class _Default : Page, IEmployeeView
{
private EmployeePresenter _presenter;
private EmployeePresenter... | [
0.18185211718082428,
-0.05998339131474495,
0.7728867530822754,
-0.05940363183617592,
-0.046097371727228165,
0.2535761892795563,
0.15669772028923035,
-0.12189110368490219,
-0.24666093289852142,
-0.7430999279022217,
-0.7072710990905762,
0.5571914315223694,
-0.4685450792312622,
0.073108449578... | |
{
_presenter = value;
_presenter.View = this;
}
}
protected void Page_Load(object sender, EventArgs e)
{
ObjectFactory.BuildUp(this);
}
}
```
Solution #1c
------------
Access presenter through Property allow Getter to BuildUp if needed.
```
public partial cla... | [
-0.19261281192302704,
0.1343175619840622,
0.8343200087547302,
-0.1958577036857605,
-0.21234439313411713,
0.298198938369751,
0.3545524477958679,
-0.05849122628569603,
-0.4247974753379822,
-0.8142009377479553,
-0.6054567098617554,
0.49762794375419617,
-0.4087551236152649,
0.3693249523639679,... | |
get
{
if (_presenter == null)
{
ObjectFactory.BuildUp(this);
}
return _presenter;
}
set | [
0.05187816545367241,
-0.09392513334751129,
0.5331308841705322,
-0.1933358758687973,
-0.04725378379225731,
0.26052677631378174,
0.6408519744873047,
-0.21366937458515167,
-0.20661970973014832,
-0.7271052598953247,
-0.626934289932251,
0.5187422037124634,
-0.417881041765213,
0.1836154013872146... | |
{
_presenter = value;
_presenter.View = this;
}
}
}
```
Solution #2
-----------
```
public partial class _Default : Page, IEmployeeView
{
private EmployeePresenter _presenter;
private EmployeePresenter Presenter
{
get
{
if (_presenter | [
-0.1853446513414383,
0.07655096054077148,
0.7844856381416321,
-0.04465112090110779,
0.029928866773843765,
0.31899502873420715,
0.31939879059791565,
0.1156124398112297,
-0.2124396562576294,
-0.7207677364349365,
-0.6521320343017578,
0.5965072512626648,
-0.2538548707962036,
0.2673128247261047... | |
== null)
{
_presenter = ObjectFactory.GetInstance<EmployeePresenter>();
_presenter.View = this;
}
return _presenter;
}
}
}
```
Solution #2b
------------
```
public partial class _Default : Page, IEmployeeView
{
private EmployeePrese... | [
-0.24325355887413025,
0.05456430837512016,
0.783978283405304,
-0.2325987070798874,
-0.046355608850717545,
0.34295541048049927,
0.4041013717651367,
0.07595743238925934,
-0.14623227715492249,
-0.8445150256156921,
-0.7661802768707275,
0.44664251804351807,
-0.4841102659702301,
0.34344801306724... | |
private EmployeePresenter Presenter
{
get
{
if (_presenter == null)
{
Presenter = ObjectFactory.GetInstance<EmployeePresenter>();
}
return _presenter; | [
-0.022422831505537033,
-0.22498992085456848,
0.4137938320636749,
-0.05661160126328468,
-0.19898974895477295,
0.26489773392677307,
0.5609487295150757,
0.25829923152923584,
-0.14201194047927856,
-0.6490613222122192,
-0.5842462778091431,
0.5101995468139648,
-0.4408946633338928,
0.195947274565... | |
}
set
{
_presenter = value;
_presenter.View = this;
}
}
}
```
**Edit**: Added solution 1c, 2b
I'd Use solution #1b, and create a [layer supertype](http://martinfowler.com/eaaCatalog/layerSupertype.html) for all the pages, in order to DRY the presenter initialization... | [
0.18063418567180634,
0.034512151032686234,
0.9028140306472778,
-0.11801888048648834,
-0.07884906977415085,
0.0018305887933820486,
0.20457340776920319,
-0.0484161339700222,
-0.30440548062324524,
-0.8295427560806274,
-0.22186407446861267,
0.17094016075134277,
-0.2617361843585968,
0.142969295... | |
presenter;
private EmployeePresenter Presenter
{
set
{
presenter = value;
presenter.View = this;
}
}
protected override void Do_Load(object sender, EventArgs args)
{
//do "on load" stuff
}
}
```
Abstract Page code:
```
public abstract | [
0.03745892643928528,
0.06534082442522049,
0.5234991312026978,
-0.2595107853412628,
-0.3203204870223999,
0.08108403533697128,
0.13659201562404633,
-0.007864576764404774,
-0.3928263485431671,
-0.3861313760280609,
-0.24895523488521576,
0.4570617973804474,
-0.3164523243904114,
0.25137394666671... | |
class AbstractPage : Page
{
protected void Page_Load(object sender, EventArgs e)
{
ObjectFactory.BuildUp(this);
this.Do_Load(sender,e);
//template method, to enable subclasses to mimic "Page_load" event
}
//Default Implementation (do nothing)
protected virtual void Do_Load(... | [
-0.09209069609642029,
-0.007400680333375931,
0.7728452682495117,
-0.34016767144203186,
-0.37195611000061035,
0.006082053761929274,
0.25917086005210876,
-0.06387463212013245,
-0.3862476944923401,
-0.8723718523979187,
-0.0627564936876297,
0.4670770764350891,
-0.46791189908981323,
0.134714663... | |
*abstract* or *virtual* ?**
[Template Method](http://en.wikipedia.org/wiki/Template_method) originally states that the method should be Abstract, in order to force subclasses to implement it, adhering to the superclass contract. (see wikipedia example of "Monopoly" < "Game").
On the other hand in this particular case... | [
0.29678770899772644,
-0.29567211866378784,
-0.07063062489032745,
0.10761493444442749,
-0.17720197141170502,
-0.4163579046726227,
0.16670650243759155,
0.1522693634033203,
-0.17886899411678314,
-0.28447121381759644,
0.13805370032787323,
0.22680050134658813,
-0.5585058927536011,
0.45537549257... | |
I was reading an article on TheServerSide on [ployglot programming on the Java platform](http://www.theserverside.com/news/thread.tss?thread_id=47184#240893). Some comments in the article refer to metaprogramming as the ability to generate code (perhaps on the fly).
Is metaprogramming the ability to generate code on ... | [
0.5335002541542053,
0.09112155437469482,
-0.18729789555072784,
0.15394702553749084,
-0.15502454340457916,
0.012995714321732521,
0.3056699335575104,
-0.21138542890548706,
-0.21221722662448883,
-0.2667950391769409,
0.12172000855207443,
0.5714833736419678,
-0.40206679701805115,
-0.00570598756... | |
itself. For example returning a list of all the properties of an object.
In languages like ActionScript, you can evaluate functions at runtime to create new programs such as eval("x" + i). DoSomething() would affect an object called x1 when i is 1 and x2 when i is 2.
Finally, another common form of metaprogramming is... | [
0.10704647749662399,
-0.09198732674121857,
0.11501023173332214,
-0.14340142905712128,
-0.2903202474117279,
0.02538379468023777,
0.3621152639389038,
-0.36069098114967346,
-0.14164841175079346,
-0.6740514636039734,
-0.10746078193187714,
0.615949273109436,
-0.7704470753669739,
-0.023014357313... | |
of the program based on its state. This allows a level of flexibility to make decisions at runtime that is very difficult in most popular languages today.
It is also worth noting that back in the good ol' days of programming in straight assembly, programs that altered themselves at runtime were necessary and very comm... | [
0.16669295728206635,
-0.08231696486473083,
-0.07361821830272675,
-0.028588762506842613,
-0.019620107486844063,
0.04409100115299225,
0.12592272460460663,
-0.24302707612514496,
-0.2970786690711975,
-0.4591059386730194,
-0.0789818987250328,
0.4549020230770111,
-0.9651318192481995,
-0.13229803... | |
in the language just to be
> different. To the Blub programmer,
> Lisp code looks weird. But those
> parentheses are there for a reason.
> They are the outward evidence of a
> fundamental difference between Lisp
> and other languages.
>
>
> Lisp code is made out of Lisp data
> objects. And not in the trivial s... | [
0.029741862788796425,
0.29069140553474426,
-0.11601553112268448,
0.04176661744713783,
-0.4318576753139496,
-0.1098509281873703,
0.1902320683002472,
-0.0016484041698276997,
-0.12997868657112122,
-0.6925225257873535,
-0.4106178283691406,
0.11785946786403656,
-0.5848963260650635,
-0.455075979... | |
can traverse.
>
>
> If you understand how compilers work,
> what's really going on is not so much
> that Lisp has a strange syntax as that
> Lisp has no syntax. You write programs
> in the parse trees that get generated
> within the compiler when other
> languages are parsed. But these parse
> trees are fully ... | [
-0.25995737314224243,
0.2832675874233246,
0.3013785481452942,
0.21803607046604156,
0.08525548875331879,
-0.04830066114664078,
0.29772597551345825,
0.05698366090655327,
-0.4735277593135834,
-1.0230791568756104,
-0.12494136393070221,
0.35548433661460876,
-0.6500255465507507,
-0.3386847078800... | |
want to do that? Not
> very often, if you think in Cobol. All
> the time, if you think in Lisp. It
> would be convenient here if I could
> give an example of a powerful macro,
> and say there! how about that? But if
> I did, it would just look like
> gibberish to someone who didn't know
> Lisp; there isn't room... | [
-0.13244666159152985,
-0.010220690630376339,
0.21821412444114685,
-0.17102289199829102,
-0.16177785396575928,
-0.20517301559448242,
0.16509728133678436,
0.04862319678068161,
-0.43575143814086914,
-0.4890804886817932,
0.14414644241333008,
0.45896366238594055,
-0.5043728351593018,
-0.3801296... | |
and even so
> I didn't get to macros until page 160.
>
>
> But I think I can give a kind of
> argument that might be convincing. The
> source code of the Viaweb editor was
> probably about 20-25% macros. Macros
> are harder to write than ordinary Lisp
> functions, and it's considered to be
> bad style to use t... | [
0.028352001681923866,
0.05932195857167244,
0.34940144419670105,
-0.003702374640852213,
-0.027359269559383392,
0.0009619465563446283,
0.26267769932746887,
0.21051865816116333,
-0.18398965895175934,
-0.8577905297279358,
0.27236828207969666,
0.6841831803321838,
-0.32021141052246094,
-0.308605... | |
is doing
> things that you can't easily do in any
> other language. However skeptical the
> Blub programmer might be about my
> claims for the mysterious powers of
> Lisp, this ought to make him curious.
> We weren't writing this code for our
> own amusement. We were a tiny startup,
> programming as hard as we ... | [
0.2472759336233139,
0.04022214561700821,
0.1365252435207367,
0.11423569172620773,
0.03468751907348633,
-0.16215002536773682,
0.31067660450935364,
0.001493874122388661,
0.06256037950515747,
-0.42649737000465393,
0.024522479623556137,
0.25792187452316284,
-0.25795117020606995,
-0.47255709767... | |
doing things that are very hard to do
> in other languages. The resulting
> software did things our competitors'
> software couldn't do. Maybe there was
> some kind of connection. I encourage
> you to follow that thread. There may
> be more to that old man hobbling along
> on his crutches than meets the eye. | [
0.15905101597309113,
0.056847162544727325,
-0.3258153200149536,
0.07953722774982452,
0.05704018473625183,
-0.08415462076663971,
0.4372539222240448,
0.29597896337509155,
-0.06877119839191437,
-0.3102826774120331,
0.049008678644895554,
0.19782541692256927,
-0.27418166399002075,
0.02002129144... | |
I am starting to redesign and develop a site that contains a lot of text and I am thinking of ways to organize the information on the site so that it looks cleaner. On some parts of the site I would like to implement a jquery toggle effect where some content is placed in a hidden div and that content will show or hide ... | [
0.5795487761497498,
0.05241486430168152,
0.28414207696914673,
0.19694747030735016,
-0.18202421069145203,
-0.4033777713775635,
0.367668479681015,
0.03559311106801033,
-0.29839423298835754,
-0.35084736347198486,
0.09157560020685196,
0.23638799786567688,
-0.2863672077655792,
0.317669540643692... | |
together?
//Update - found some answers.
I guess to clarify, as a response to some answers below, the purpose of the hidden divs would be to toggle between showing/hiding the content for organizational purpose where any hidden text would eventually be shown to the user.
However, after much digging around, [Matt Cutt... | [
0.6029262542724609,
0.08877581357955933,
0.07551503926515579,
0.14421971142292023,
-0.2346109300851822,
-0.37999826669692993,
0.6941413283348083,
-0.05698468163609505,
-0.0601368211209774,
-0.3631874620914459,
0.12651950120925903,
0.3356914520263672,
-0.3219250440597534,
-0.226813703775405... | |
upon by Google if you are hiding/showing content for SEO reasons. In other words, what Google sees should be what the user sees when clicking the link. | [
0.7477834224700928,
0.10566063970327377,
0.3802642822265625,
0.07982547581195831,
-0.09023746103048325,
-0.5140994787216187,
0.4565029442310333,
-0.02455209009349346,
-0.03680133819580078,
-0.6711745858192444,
-0.270840048789978,
0.7234983444213867,
-0.07648292928934097,
0.3159591257572174... | |
Is the SO tag ordering a good representation of programming language popularity?
My first guess would be that it's not and that it's largely populated by fans of Jeff (who would probably be .Net biased) and fans of Joel (who may be more C/C++ biased among others).
**Is there a way to get unbiased programming language... | [
0.5449272394180298,
-0.0668274387717247,
0.20342861115932465,
0.3474491238594055,
-0.25495803356170654,
-0.03246050700545311,
0.025564705953001976,
0.4517521262168884,
-0.2840956449508667,
-0.3250986635684967,
0.03424746170639992,
0.3519132733345032,
0.07827584445476532,
-0.030850052833557... | |
biases and advantages, too.
In terms of SO tags, besides C#, they look fairly accurate, but there's a huge C# bias, so for the time being I don't think I will include SO in the LangPop results. I am keeping an eye on it, though. Another example of something I'm keeping my eye on, but that is still way too biased is Gi... | [
0.6455257534980774,
0.13277952373027802,
-0.08162419497966766,
0.15748484432697296,
-0.4680783152580261,
-0.41244471073150635,
0.08997398614883423,
0.503416121006012,
-0.23234175145626068,
-0.3414435088634491,
0.15607841312885284,
0.3162449300289154,
0.1690606027841568,
0.3238520920276642,... | |
I have a web application that I am trying to build and publish. The odd thing is that when I do clean, build or rebuild everything seems fine. When I do a publish though I get the message that the publish failed, but get no further information:
```
========== Publish: 0 succeeded, 1 failed, 0 skipped ==========
```
... | [
0.6514800190925598,
0.4866710603237152,
0.16367514431476593,
-0.060319699347019196,
-0.07083454728126526,
-0.15481232106685638,
0.8608624339103699,
-0.08289175480604172,
-0.27484211325645447,
-0.6227191686630249,
0.08540558069944382,
0.7463118433952332,
-0.23992039263248444,
0.236388295888... | |
subversion and if I copy (export) the project and open it outside of source control it does appear to publish correctly. Is there some known interaction with subversion that doesn't let this occur correctly? Is there a work around to get the "Only files needed to run this application" with subversion?
Thanks for any a... | [
0.49765515327453613,
0.0394398495554924,
0.17169851064682007,
0.13183628022670746,
-0.39492642879486084,
-0.197703018784523,
0.48944932222366333,
0.023773644119501114,
-0.22959676384925842,
-0.48041966557502747,
0.019253823906183243,
0.47925010323524475,
-0.4526998996734619,
0.139673694968... | |
work... | [
0.6446890830993652,
0.419329971075058,
-0.2151155024766922,
0.04501134902238846,
0.12039811164140701,
0.33111438155174255,
0.13484814763069153,
-0.24346080422401428,
-0.3872047960758209,
-0.8130030035972595,
-0.25374341011047363,
0.4227796792984009,
0.28697851300239563,
-0.1253956109285354... | |
When a user have changed something in a form, then clicks on any link that will direct him to another page, I'd like to trigger a popup with a "Would you like to Save before leaving?" option.
How can I do this?
Example:
```
<script type="text/javascript">
var shouldConfirm = false;
window.onbeforeunload =... | [
0.25780636072158813,
-0.22725848853588104,
0.3492977023124695,
-0.1729201078414917,
0.5534577369689941,
-0.0015376054216176271,
0.2944239675998688,
0.011764951050281525,
-0.14021530747413635,
-0.737190842628479,
-0.06762642413377762,
0.33130085468292236,
-0.28933069109916687,
0.24995650351... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.