text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
But any decent C implementation provides 64-bit integers (and any decent C++ implementation does too), so that shouldn't be necessary.
Then to deal with the denominators, one possibility is, as KerrekSB said in his comment, to calculate the modular inverse of the denominators modulo the prime `p = 1000000007`. You can... | [
-0.0739804059267044,
0.07498886436223984,
-0.018629955127835274,
-0.19891610741615295,
-0.2663281559944153,
0.3412571847438812,
0.10997260361909866,
-0.2604126036167145,
-0.21792975068092346,
-0.38873979449272156,
-0.18585464358329773,
0.41783538460731506,
-0.1524781733751297,
-0.146541073... | |
1
n
C(n+1) = ∑ C(i)*C(n-i)
0
```
Since you only need the Catalan numbers `C(k)` for `k <= 1000`, you can precalculate them, or quickly calculate them at program startup and store them in a lookup table.
---
If contrary to expectation no 64-bit integer type is available, you can calculate the modul... | [
-0.11888746172189713,
0.24360942840576172,
0.23152512311935425,
-0.37034258246421814,
0.10618598759174347,
0.6566733121871948,
-0.03634709492325783,
-0.6113228797912598,
-0.5025176405906677,
-0.2485693395137787,
-0.06406915187835693,
0.35935479402542114,
-0.22238218784332275,
-0.0851848870... | |
// 0 <= b1, b2 < (1 << 16)
a*b = a1*b1 + (a1*b2 << 16) + (a2*b1 << 16) + (a2*b2 << 32)
```
To calculate `a*b (mod m)` with `m <= (1 << 31)`, reduce each of the four products modulo `m`,
```
p1 = (a1*b1) % m;
p2 = (a1*b2) % m;
p3 = (a2*b1) % m;
p4 = (a2*b2) % m;
```
and the simplest way to incorporate the shifts is... | [
0.006862707901746035,
-0.07894164323806763,
0.18460892140865326,
-0.588824450969696,
0.07903416454792023,
0.7213287949562073,
0.3317030668258667,
-0.751693606376648,
-0.03168046474456787,
-0.3286862373352051,
-0.3260578513145447,
0.3629516065120697,
-0.06365854293107986,
-0.156516328454017... | |
Then
```
s = p1+p2;
if (s >= m) s -= m;
s += p3;
if (s >= m) s -= m;
s += p4;
if (s >= m) s -= m;
return s;
```
That way is not very fast, but for the few multiplications needed here, it's fast enough. A small speedup should be obtained by reducing the number of shifts; first calculate `(p4 << 16) % m`,
```
for(i =... | [
-0.2251787781715393,
0.08129128068685532,
0.5209997296333313,
-0.5079995393753052,
0.11002139002084732,
0.2159072607755661,
0.25589844584465027,
-0.6288014650344849,
-0.46376946568489075,
-0.21741506457328796,
-0.4827542304992676,
0.5260288715362549,
-0.15870647132396698,
-0.23915292322635... | |
`m`,
```
p4 += p3;
if (p4 >= m) p4 -= m;
p4 += p2;
if (p4 >= m) p4 -= m;
for(i = 0; i < 16; ++i) {
p4 *= 2;
if (p4 >= m) p4 -= m;
}
s = p4+p1;
if (s >= m) s -= m;
return s;
``` | [
-0.4414612054824829,
-0.004295820835977793,
0.6718836426734924,
-0.36345168948173523,
0.32553109526634216,
0.3055081069469452,
0.6271377205848694,
-0.7545136213302612,
-0.25620773434638977,
-0.17240256071090698,
-0.9598016142845154,
0.5822674632072449,
-0.38907477259635925,
-0.046039484441... | |
I have a bunch of combos that all share the same available choices. These choices are provided in a collection exposed from my ViewModel. All fine and dandy.
I now want these choices sorted, so I decided to expose an `ICollectionView` from my ViewModel instead of my usual `ReadonlyObservableCollection<T>`, and sort th... | [
0.14848028123378754,
-0.325242817401886,
0.5771528482437134,
-0.028791189193725586,
0.12308520823717117,
0.308011919260025,
-0.11589214950799942,
-0.3792453706264496,
-0.3699588477611542,
-0.9875708818435669,
0.014559128321707249,
0.5504277944564819,
-0.2533470392227173,
0.1313579380512237... | |
public ICollectionView Choices
{
get;
private set;
}
//snip other properties
}
```
This all works fine except that now **all my combos now sync their selection**.
This is not what I want. I want the choices to be shared, but selections to be to their normal bindings. I think I understan... | [
0.32178565859794617,
-0.14851337671279907,
0.33437198400497437,
0.09867808222770691,
-0.030525073409080505,
-0.018734727054834366,
0.21437989175319672,
-0.4786148965358734,
-0.11069980263710022,
-0.7726747989654541,
0.15838837623596191,
0.7320321798324585,
-0.3021330237388611,
0.0551318824... | |
combos which successfully decouples them, but then my bound `SelectedItem` is never selected in the combo (the ViewModel's bound getter is called but the result is never selected). Selecting an item does seem to update my ViewModel's setter correctly.
I'm obviously missing something fundamental to how CollectionView i... | [
0.24076320230960846,
-0.3215225636959076,
0.5240079164505005,
0.24631282687187195,
-0.13395121693611145,
-0.14088894426822662,
0.41020357608795166,
-0.3399578034877777,
-0.20112617313861847,
-0.7721146941184998,
-0.1162966787815094,
0.6259117722511292,
-0.23205803334712982,
-0.162701070308... | |
items. Oops.
As for WHY I needed to explicitly turn IsSynchronizedWithCurrentItem off when I never normally do on standard collections, light is shed on [MSDN](http://msdn.microsoft.com/query/dev10.query?appId=Dev10IDEF1&l=EN-US&k=k%28SYSTEM.WINDOWS.CONTROLS.PRIMITIVES.SELECTOR.ISSYNCHRONIZEDWITHCURRENTITEM%29;k%28VS.... | [
0.2811261713504791,
-0.37267449498176575,
0.5143831968307495,
0.32432055473327637,
0.07040449976921082,
0.03892241418361664,
0.34271323680877686,
-0.13290269672870636,
-0.5109208226203918,
-0.5349639654159546,
-0.25904878973960876,
0.3490900993347168,
-0.3380468189716339,
0.199490413069725... | |
I am wondering how to get the Json value ?(from below JSOn I would like to get product's"Price" so that I can add into total. thank you very much.
```
{ "StatusCode": 0
, "StatusInfo": "Processed and Logged OK"
, "PageNumber": 0
, "TotalPageCount": 1
, "TotalProductCount": 1
, "PageProductCount": 1
, "Products": [
{... | [
0.20577214658260345,
0.0579032301902771,
0.7120341658592224,
0.11054874956607819,
0.06981506198644638,
0.47000887989997864,
-0.1283491849899292,
0.043180640786886215,
-0.09315961599349976,
-0.6187244057655334,
-0.08845852315425873,
0.7656398415565491,
0.3152797818183899,
0.0386806242167949... | |
, "ProductId": "258247301"
, "ProductType": "QuantityOnlyProduct"
, "UnitPrice": 0.004
, "UnitType": "100ml" } ] }
```
I'm very sorry for wasting everyone's time, but setting `IsSynchronizedWithCurrentItem="False"` does work. I had also added a filter along with the sort, and the default selected values were not... | [
0.09131191670894623,
-0.13435889780521393,
0.5116063952445984,
0.3753577470779419,
0.13000217080116272,
0.09772779792547226,
0.42042067646980286,
-0.1805150806903839,
-0.32156962156295776,
-0.5567883253097534,
-0.17686080932617188,
0.400676429271698,
-0.21271641552448273,
0.261138856410980... | |
item; **Nothing if the SelectedItem is synchronized with the current item only if the Selector uses a CollectionView. The default value is Nothing.**
So in other words, if you use a `CollectionView` explicitly rather than using the default view on a normal collection, you get selection sync. | [
0.31161853671073914,
-0.6292176246643066,
0.2648485004901886,
0.2828654944896698,
0.045870713889598846,
-0.14194749295711517,
0.19204123318195343,
-0.10017769038677216,
-0.5107522010803223,
-0.4495146870613098,
-0.4766664206981659,
0.5429983139038086,
-0.24426598846912384,
0.30993422865867... | |
I use the below xslt to transform xmls, it iterates thru the Receipt/Process
nodes and adds type attributes to the nodes. Based on the node's value it will be string/int/float.
That part works fine.
I also should rename the "Node" node to "Node" concatenated with its index and
add an attribute which should be the "Na... | [
-0.26165270805358887,
-0.16501131653785706,
0.7424102425575256,
-0.06507662683725357,
-0.1286163032054901,
0.237638920545578,
-0.2712355852127075,
-0.12805676460266113,
0.13120979070663452,
-0.9066598415374756,
-0.07073765248060226,
0.45234501361846924,
-0.17454086244106293,
0.292319148778... | |
like to change the "Input" node's value if it is "MainMedia" to "Source" but only then.
Thanks a lot.
```
Source XML:
<Receipt>
<Process>
<Node>
<Name>Cuda3DLut</Name>
<Input>MainMedia</Input>
<Lut>Identity</Lut>
<Output>RESULT1</Output>
<bypass>0</bypass>
<nodeRole>viewin... | [
0.029506094753742218,
-0.16484855115413666,
0.5354034304618835,
0.03191399946808815,
0.09268193691968918,
0.056876230984926224,
-0.27138465642929077,
0.0620393343269825,
-0.17264114320278168,
-1.0465269088745117,
0.016081487759947777,
0.45481282472610474,
-0.47774118185043335,
0.1578323990... | |
<bypass>0</bypass>
<nodeRole>viewing</nodeRole>
<nodeShortName>LUT</nodeShortName>
</Node>
</Process>
<Encode>
<Job>
...
</Job>
</Encode>
</Receipt>
xslt:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="... | [
0.02292679436504841,
-0.5938172936439514,
0.6645346283912659,
-0.1106250137090683,
-0.26994311809539795,
0.07135571539402008,
0.03922124579548836,
-0.5441207885742188,
-0.40289753675460815,
-0.43742966651916504,
-0.15391041338443756,
0.47314709424972534,
-0.23448613286018372,
-0.0539724119... | |
<xsl:when test="name() = 'Input'">
<xsl:copy>
<xsl:attribute name="type">ToolLink</xsl:attribute>
<xsl:attribute name="role">Input</xsl:attribute>
<xsl:attribute name="format">red,green,blue</xsl:attribute>
<xsl:apply-templates select="@*|no... | [
-0.09550388157367706,
-0.2708299160003662,
0.4116171896457672,
0.05337012931704521,
0.04698147252202034,
0.1755729764699936,
0.04640194773674011,
-0.5040138363838196,
-0.0032294976990669966,
-0.6834128499031067,
-0.13332411646842957,
0.4277782738208771,
-0.2327965348958969,
-0.136719018220... | |
</xsl:copy>
</xsl:when>
<xsl:when test="name() = 'Output'">
<xsl:copy>
<xsl:attribute name="type">ToolLink</xsl:attribute>
<xsl:attribute name="role">Output</xsl:attribute> | [
-0.1292220652103424,
-0.30510398745536804,
0.2191900610923767,
-0.03977946192026138,
-0.30196860432624817,
0.11525040864944458,
-0.015788359567523003,
-0.5857391357421875,
0.10083035379648209,
-0.5526763200759888,
0.03539831191301346,
0.5593715906143188,
-0.13346244394779205,
-0.1427323222... | |
<xsl:attribute name="format">red,green,blue</xsl:attribute>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:when>
<xsl:otherwise>
<!-- Add type attribute to | [
-0.12350296229124069,
-0.08385202288627625,
0.4913075864315033,
0.026685385033488274,
0.09748544543981552,
-0.09483041614294052,
-0.11891530454158783,
-0.49062392115592957,
0.08885016292333603,
-0.554483950138092,
-0.2850235402584076,
0.3927870988845825,
-0.328380286693573,
-0.071949020028... | |
the node based on its value -->
<xsl:choose>
<xsl:when test="number(.) = .">
<xsl:choose>
<xsl:when test="contains(., '.')">
<xsl:copy>
<xsl:attribute | [
-0.3954184055328369,
-0.21945960819721222,
0.23391331732273102,
0.2760973572731018,
0.1794401854276657,
0.0643022432923317,
-0.027553170919418335,
-0.18947216868400574,
0.2021711766719818,
-0.4586407542228699,
-0.1705094575881958,
0.11242855340242386,
-0.25574028491973877,
0.20174342393875... | |
name="type">float</xsl:attribute>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:when>
<xsl:otherwise>
<xsl:copy>
<xsl:attribute name="type">int</xsl:attribute> | [
-0.1704215556383133,
0.017088579013943672,
0.26615262031555176,
0.04765215516090393,
-0.09963814914226532,
-0.03306182101368904,
-0.13984878361225128,
-0.5299890041351318,
0.08084661513566971,
-0.23841236531734467,
-0.10479331016540527,
0.28320416808128357,
-0.2834325432777405,
-0.00550970... | |
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:otherwise>
</xsl:choose> | [
0.04271221160888672,
-0.12867562472820282,
0.31830137968063354,
-0.0695529654622078,
0.33195760846138,
-0.1843118518590927,
0.13188990950584412,
-0.4459244906902313,
0.03948671370744705,
-0.5659570693969727,
-0.21825116872787476,
0.30125582218170166,
-0.6024779677391052,
0.0447136200964450... | |
</xsl:when>
<xsl:otherwise>
<xsl:copy>
<xsl:attribute name="type">string</xsl:attribute>
<xsl:apply-templates select="@*|node()" />
</xsl:copy> | [
-0.0611385703086853,
0.07348759472370148,
0.2441197633743286,
0.05585423484444618,
0.0027298496570438147,
-0.30785617232322693,
-0.01311422698199749,
-0.5100513100624084,
-0.04973141476511955,
-0.4119759202003479,
-0.154253751039505,
0.4220830500125885,
-0.45699959993362427,
0.074132695794... | |
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:template>
<xsl:template match="Encode">
</xsl:template>
</xsl:stylesheet>
```
**This transformation**:
```
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.... | [
0.08049490302801132,
-0.7159914374351501,
0.34422415494918823,
-0.0955924391746521,
-0.15356621146202087,
-0.04465916007757187,
0.044104307889938354,
-0.7905809283256531,
0.12486855685710907,
-0.7535251379013062,
-0.3514229953289032,
0.48033201694488525,
-0.22419822216033936,
-0.1686007082... | |
<xsl:attribute name="type">
<xsl:value-of select="Name"/>
</xsl:attribute>
<xsl:apply-templates select="*[not(self::Name)]"/>
</xsl:element>
</xsl:template>
<xsl:template match="Node/*" priority="-1">
<xsl:copy>
<xsl:attribute name="type">string</xsl:attribute>
<xsl:value-of sel... | [
-0.24716371297836304,
-0.12404818087816238,
0.4449474513530731,
-0.2557339072227478,
0.039608728140592575,
0.02050047740340233,
-0.10083462297916412,
-0.8414596319198608,
-0.06149360537528992,
-0.6175733804702759,
-0.3515535295009613,
0.4729328155517578,
-0.16227850317955017,
-0.1586098223... | |
<Node>
<Name>Cuda3DLut</Name>
<Input>MainMedia</Input>
<Lut>Identity</Lut>
<Output>RESULT1</Output>
<bypass>0</bypass>
<nodeRole>viewing</nodeRole>
<nodeShortName>LUT</nodeShortName>
</Node> | [
-0.4893101155757904,
-0.4465658366680145,
0.4706023335456848,
-0.1717642992734909,
-0.18616388738155365,
0.2620496153831482,
-0.26601284742355347,
0.2228955179452896,
-0.18751096725463867,
-0.8143907189369202,
-0.14445464313030243,
0.3537033796310425,
-0.42518913745880127,
0.23635642230510... | |
<Node>
<Name>CudaTool</Name>
<Input>MainMedia</Input>
<Lut>Identity</Lut>
<Output>RESULT1</Output>
<bypass>0</bypass>
<nodeRole>viewing</nodeRole>
<nodeShortName>LUT</nodeShortName>
</Node> | [
-0.495591402053833,
-0.398269921541214,
0.39157524704933167,
-0.14857999980449677,
-0.04445410147309303,
0.21313710510730743,
-0.2842763364315033,
0.25438597798347473,
-0.1748989224433899,
-0.7895529270172119,
-0.1349690556526184,
0.3405321538448334,
-0.38807162642478943,
0.151634946465492... | |
</Process>
<Encode>
<Job> ... </Job>
</Encode>
</Receipt>
```
**produces the wanted, correct result:**
```
<Node1 type="Cuda3DLut">
<Input type="ToolLink" role="Input" format="red,green,blue">Source</Input>
<Lut type="string">Identity</Lut>
<Output type="ToolLink" role="Output" form... | [
-0.44353803992271423,
-0.17408967018127441,
0.5736552476882935,
-0.1208486557006836,
0.05994633585214615,
0.5459776520729065,
-0.2529973089694977,
-0.4962305426597595,
-0.10411745309829712,
-0.6879060864448547,
-0.4135458171367645,
0.37855902314186096,
0.11213119328022003,
-0.0266676172614... | |
I am developing an android app. I need to call my MainActivity without reloading it as it has huge amount of data fetch from internet.
Suppose, I am on third activity now and I want to go back to MainActivity.
If I use:
```
Intent i = new Intent(Third.this,Main.class);
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
s... | [
0.008554525673389435,
0.10749536007642746,
0.8691676259040833,
-0.3257954716682434,
0.2285746932029724,
-0.055802181363105774,
0.2890426814556122,
-0.14218130707740784,
-0.009574556723237038,
-0.7661941051483154,
-0.18633124232292175,
0.5987062454223633,
-0.23612123727798462,
-0.0753881037... | |
coming back to this activity
and try `intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);` instead of `addFlags()` method | [
0.22164301574230194,
-0.17271584272384644,
0.8331224322319031,
-0.21633151173591614,
0.13602113723754883,
-0.34341567754745483,
0.5291099548339844,
-0.2484135776758194,
-0.5227139592170715,
-0.6015679836273193,
-0.31199929118156433,
0.5234925150871277,
-0.28350406885147095,
-0.437463670969... | |
The code is in C. I have two type of objects (`structs`) that have parent-child relationship, one parent-type can have `0` or more child-types, a child can't have its own children. I need `O(1)` parent lookup (by `uID` struct member) and child lookup (also by `uID` struct member) without knowing who's its parent. Once ... | [
0.09688825905323029,
0.3287210166454315,
0.15334872901439667,
0.04379405081272125,
0.22675378620624542,
0.3427383601665497,
0.27540847659111023,
0.21992743015289307,
0.314585417509079,
-0.6944804191589355,
-0.2587052285671234,
0.19978082180023193,
-0.10537755489349365,
0.3637564778327942,
... | |
parent can be removed or inserted, and a child can change its parent. When parent is removed, its children should be also removed. And all this should be done it multi-threaded environment, so I need thread-safe reads (I will use read-only lock for key searching and read-write lock for insertion/deletion/re-parenting).... | [
-0.07828748226165771,
-0.12956690788269043,
0.2016211450099945,
-0.10441280156373978,
0.2786772549152374,
0.09812933951616287,
0.006333882454782724,
-0.11473201960325241,
0.10728107392787933,
-0.8731197714805603,
-0.20437029004096985,
0.13035088777542114,
-0.41831332445144653,
0.6608420014... | |
uint64_t uid;
time_t mtime;
struct ldata data;
struct parent *parent;
UT_hash_handle hh;
};
struct parent *parents_list = NULL;
struct child *children_list = NULL;
```
The problem is when a new child arrives it ends up being at the tail and
is not connected with its "brothers".
How about:
1. A hash ... | [
-0.13260860741138458,
-0.3276785910129547,
0.2552337050437927,
0.21673397719860077,
0.32226330041885376,
0.1751723438501358,
0.10421810299158096,
-0.14825478196144104,
-0.18119880557060242,
-0.7290271520614624,
-0.37135034799575806,
0.0476614385843277,
-0.3720703125,
0.43749862909317017,
... | |
quite O(1) lookup, but they will be close. You can probably use an existing, well-polished library for them.
In terms of thread safety, you could have mutexes for both hashes (for item insertion/deletion), and also a mutex in each parent, for when it or any of its children are being manipulated. Beware of deadlocks, o... | [
0.06919578462839127,
0.16316412389278412,
0.13310971856117249,
0.18550780415534973,
0.21512924134731293,
0.16038455069065094,
0.09716562926769257,
0.061560921370983124,
-0.5417780876159668,
-0.38962647318840027,
-0.1422276645898819,
0.06324856728315353,
-0.16732870042324066,
0.294609099626... | |
can find any that seem to fit. | [
0.7923968434333801,
0.2756192684173584,
-0.17846815288066864,
0.1942640095949173,
0.36293885111808777,
0.21266327798366547,
-0.014539359137415886,
0.4991937279701233,
0.15825572609901428,
-0.5499274134635925,
-0.42498141527175903,
0.26273036003112793,
0.28936877846717834,
-0.15044213831424... | |
I have a set of items, from which I want to select DISSIMILAR tuples (more on the definition of dissimilar touples later). The set could contain potentially several thousand items, although typically, it would contain only a few hundreds.
I am trying to write a generic algorithm that will allow me to select N items to... | [
-0.08780926465988159,
0.030085640028119087,
0.26237916946411133,
-0.07012898474931717,
-0.514754593372345,
0.6381620764732361,
0.5354827046394348,
-0.1332414448261261,
-0.0844128355383873,
-0.6783057451248169,
-0.38339653611183167,
0.03611660376191139,
-0.23703600466251373,
0.2084575593471... | |
algorithm, A 2-tuple (pair) is considered SIMILAR/IDENTICAL if it contains the same elements, i.e. (x,y) is considered the same as (y,x).
This is a (possible variation on the) classic [Urn Problem](http://en.wikipedia.org/wiki/Urn_problem). A trivial (pseudocode) implementation of this algorithm would be something alo... | [
-0.1988096386194229,
0.006093717645853758,
0.0719054564833641,
-0.2631485164165497,
-0.38998502492904663,
-0.04439229890704155,
0.3298678398132324,
-0.368190199136734,
-0.2496250867843628,
-0.6160533428192139,
-0.4241829514503479,
0.17274300754070282,
-0.63616943359375,
0.08757057785987854... | |
store selected N-tuple in a container
if end_condition_met:
break
```
I don't think this is the most efficient way of doing this - and though I am no algorithm theorist, I suspect that the time for this algorithm to run is NOT ***O(n)*** - in fact, its probably more likely to be ***O(n!)***. I am ... | [
-0.08081936091184616,
0.1109052300453186,
-0.009795982390642166,
-0.10856539011001587,
-0.08938135206699371,
-0.03367292508482933,
-0.030543752014636993,
0.07150012254714966,
-0.20569276809692383,
-0.8094419836997986,
-0.23447740077972412,
0.26519280672073364,
-0.3790441155433655,
0.229671... | |
variable `m`, which is the size of the number of elements being selected. This (i.e. `m`) will typically be between 2 and 5.
Regarding examples, here would be a typical (albeit shortened) example:
```
original_list = ['CAGG', 'CTTC', 'ACCT', 'TGCA', 'CCTG', 'CAAA', 'TGCC', 'ACTT', 'TAAT', 'CTTG', 'CGGC', 'GGCC', 'TCC... | [
-0.003574937582015991,
-0.13041983544826508,
0.26246681809425354,
0.056555841118097305,
-0.06827008724212646,
0.5727800130844116,
-0.2077704668045044,
0.21962255239486694,
-0.19839031994342804,
0.06774978339672089,
-0.36045652627944946,
0.49636679887771606,
-0.46483004093170166,
0.36875900... | |
(or set) similar to:
[('CAGG', 'CTTC', 'ACCT')
('CAGG', 'TGCA', 'CCTG')
('CAGG', 'CAAA', 'TGCC')
('CAGG', 'ACTT', 'ACCT')
('CAGG', 'CTTG', 'CGGC')
....
('CTTC', 'TGCA', 'CAAA')
]
```
**[[Edit]]**
Actually, in constructing the example output, I have realized that the earlier def... | [
0.22798196971416473,
0.0695573091506958,
-0.038074858486652374,
0.18008466064929962,
-0.28932419419288635,
-0.02014940418303013,
-0.14056801795959473,
-0.16931742429733276,
-0.3641875088214874,
-0.26051247119903564,
-0.19009529054164886,
0.27141615748405457,
-0.24619951844215393,
0.1594159... | |
work pretty swiftly:
```
def fetch_unique_tuples(original_set, tuple_size):
from itertools import combinations
good = []
used = []
for i in combinations(original_set,tuple_size):
lst = list([tuple(sorted(j)) for j in combinations(i,2)])
if not any(l in used for l in lst):
u... | [
-0.20573517680168152,
-0.045227278023958206,
0.5022726058959961,
-0.35244220495224,
-0.07377628982067108,
0.13497298955917358,
0.15513427555561066,
-0.46004000306129456,
-0.3844377398490906,
-0.6228647232055664,
-0.48756086826324463,
0.5109336376190186,
-0.3126024007797241,
-0.295206427574... | |
'CTTG', 'CGGC', 'GGCC', 'TCCT', 'ATCC', 'ACAG', 'TGAA', 'TTTG', 'ACAA', 'TGTC', 'TGGA', 'CTGC', 'GCTC', 'AGGA', 'TGCT', 'GCGC', 'GCGG', 'AAAG', 'GCTG', 'GCCG', 'ACCA', 'CTCC', 'CACG', 'CATA', 'GGGA', 'CGAG', 'CCCC', 'GGTG', 'AAGT', 'CCAC', 'AACA', 'AATA', 'CGAC', 'GGAA', 'TACC', 'AGTT', 'GTGG', 'CGCA', 'GGGG', 'GAGA', ... | [
-0.05577297881245613,
-0.11006361991167068,
0.27894341945648193,
0.2311633676290512,
-0.2659026086330414,
0.4919138252735138,
0.0012564468197524548,
0.02748621068894863,
-0.32753023505210876,
-0.29109373688697815,
-0.3039890229701996,
0.2423841655254364,
-0.4838005006313324,
0.374709129333... | |
I have a very basic Table structure to be placed in middle/center of the web page. I Have a code below, I know its incomplete to make this happen, as I am bad in structuring the HTML part, please help me
```
<div align="center" style="vertical-align:bottom">
<div align="center" style="vertical-align:bottom">
<table>
<... | [
0.12892112135887146,
0.34351846575737,
0.2878273129463196,
0.15792226791381836,
-0.2656589448451996,
-0.14107830822467804,
0.18534336984157562,
0.08171321451663971,
0.0922204926609993,
-0.934221625328064,
-0.08320780098438263,
0.4191807806491852,
0.11116865277290344,
0.05582819879055023,
... | |
structuring.. Please dont leave the comments which demoralize me to go ahead with learning like "Is it a Homework..." or "GO TO TUTION CLASSES"etc...
The shortest and easiest answer is: you shouldn't vertically center things in webpages. HTML and CSS simply are not created with that in mind. They are text formatting la... | [
0.23319947719573975,
0.1310926228761673,
0.4240703880786896,
0.05201152712106705,
-0.5217296481132507,
0.022178595885634422,
0.14862105250358582,
-0.10442929714918137,
-0.2609638571739197,
-0.572898268699646,
-0.061300214380025864,
0.26632121205329895,
-0.04715884104371071,
-0.217860385775... | |
width: 100%;
display: table;
}
#tableContainer-2 {
vertical-align: middle;
display: table-cell;
height: 100%;
}
#myTable {
margin: 0 auto;
}
</style>
<div id="tableContainer-1">
<div id="tableContainer-2">
<table id="myTable" border>
<tr><td>Name</td><td>J W BUSH</td></tr>
... | [
-0.151143416762352,
-0.16533604264259338,
0.866415798664093,
0.0010895394952967763,
-0.37848368287086487,
0.13785047829151154,
-0.06846140325069427,
-0.37031087279319763,
-0.24288628995418549,
-0.6050806641578674,
-0.05965329334139824,
0.44685232639312744,
0.08894986659288406,
0.1391700357... | |
I need to replace a string in certain documents. I have googled this code, but it unfortunately does not change anything. I am not sure about the syntax on the line bellow:
```
pulpdb = db.getSisterDB("pulp_database");
var cursor = pulpdb.repos.find();
while (cursor.hasNext()) {
var x = cursor.next();
x['source'][... | [
0.07347435504198074,
0.3586858808994293,
0.532376229763031,
0.02996273711323738,
-0.06334289163351059,
-0.20273537933826447,
0.32406723499298096,
0.16224057972431183,
-0.15660107135772705,
-0.4040187895298004,
-0.018695078790187836,
0.6397911310195923,
-0.3396030366420746,
0.13367643952369... | |
have string `http://aaa/xxx/aaa` (`yyy` equals to `aaa`) you'll end up with `http://bbb/xxx/bbb`.
But if you ok with this, code will work.
To add debug info use `print` function:
```
var cursor = db.test.find();
while (cursor.hasNext()) {
var x = cursor.next();
print("Before: "+x['source']['url']);
x['source'][... | [
0.1470513790845871,
0.09814443439245224,
0.47089675068855286,
-0.12417773902416229,
-0.12909585237503052,
0.0566212423145771,
0.33591073751449585,
-0.4980040192604065,
0.08006787300109863,
-0.6599352359771729,
-0.4091281592845917,
0.6169958710670471,
-0.4915007948875427,
0.1940063983201980... | |
I am struggling to get my head around operator overloading. In this case the + operator I have and example of what I have tried, any help would be greatly appreciated.
I am getting an error which says "invaild use of 'class Matrix' I am unsure on how to fix this how can I add these two Matrix objects together?
```
Ma... | [
-0.23713600635528564,
-0.04723986238241196,
0.6336179971694946,
-0.2832382023334503,
-0.017801927402615547,
0.2018885463476181,
0.34519365429878235,
-0.49475976824760437,
-0.1809159815311432,
-0.6770288348197937,
-0.20178119838237762,
0.6387917995452881,
-0.4145514667034149,
0.312527149915... | |
N = NN;
data = new double[M * N];
for ( int i =0; i < M; i++)
{
for | [
0.06409171968698502,
-0.34289270639419556,
0.05211532488465309,
-0.666066586971283,
0.17187809944152832,
0.22665515542030334,
0.6282286643981934,
-0.4898456633090973,
-0.17915703356266022,
-0.34468114376068115,
-0.19008231163024902,
0.31394341588020325,
-0.2228931188583374,
0.1136175319552... | |
(int j = 0; j < N; j++)
{
data[i* N+j] = (double) 1000 + i*N+j;
// cout << data[i*N+j] <<"\t"; | [
0.4492776691913605,
-0.23060959577560425,
0.2396652102470398,
-0.39320558309555054,
0.08493785560131073,
0.24330195784568787,
0.32800355553627014,
-0.1916060745716095,
0.09008576720952988,
-0.3484455943107605,
-0.38278424739837646,
0.5471829771995544,
-0.37583619356155396,
0.04249323904514... | |
}
//cout <<"\n";
}
cout << "Matrix Constructor... (code to be implemented here!!!)\n";}
```
Thanks
jpm's answer is very important to look at. Once you've fixed these things, you can look at mine.
Essentially, an operator overload is no different than any other function... | [
-0.17373952269554138,
0.04169813543558121,
0.37135422229766846,
-0.007141683250665665,
0.04246341437101364,
-0.12233532965183258,
0.0021634669974446297,
-0.013599870726466179,
-0.18796078860759735,
-0.3892780542373657,
-0.19956828653812408,
0.7536561489105225,
-0.41650861501693726,
-0.0927... | |
Matrix::operator+(const Matrix& rhs)
```
What you're really doing there is saying: add rhs to the current matrix, and return a new matrix. Your overload should not alter the current matrix. Help yourself and use a constant:
```
Matrix Matrix::operator+(const Matrix& rhs) const
```
A matrix addition like that shoul... | [
0.012676984071731567,
-0.025409430265426636,
0.5319539308547974,
-0.17700932919979095,
-0.021530698984861374,
0.17384566366672516,
0.0161129217594862,
-0.6554800868034363,
-0.356163889169693,
-0.7044685482978821,
-0.014459304511547089,
0.6558693647384644,
-0.3068777620792389,
-0.0211610700... | |
N = NN;//TODO: change to height
data = new double[M*N];
for(int i < 0; i < M; i++)
for(int j < 0; j < N; j++)
data[i * N+j] = values[i * N+j];
}
``` | [
0.26767730712890625,
-0.1520557552576065,
0.46700477600097656,
-0.4334498345851898,
-0.009963799268007278,
0.045320842415094376,
0.5994192361831665,
-0.6439622640609741,
-0.34710851311683655,
-0.319521963596344,
-0.3123292028903961,
0.6848644018173218,
-0.0221323911100626,
0.21018689870834... | |
Here are my settings:
```
STATIC_ROOT = "/home/tony/Documents/mysite/mysite/"
STATIC_URL = '/static/'
STATICFILES_DIRS = (
"/home/tony/Documents/mysite/mysite/static/",
)
```
And here I refer my stylesheet(This gives me an error):
```
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}/css/reset.css" ... | [
0.10619787126779556,
0.2856099009513855,
0.5699754953384399,
-0.22669868171215057,
-0.15807823836803436,
0.29446685314178467,
0.06076020374894142,
-0.5617138743400574,
-0.09355712682008743,
-0.4178905487060547,
0.1296963095664978,
0.781542956829071,
-0.04600432515144348,
-0.049929037690162... | |
and what do I get in the logs? this:
```
[06/Apr/2012 13:46:55] "GET /test/ HTTP/1.1" 200 964
[06/Apr/2012 13:46:55] "GET /test/static/css/style.css HTTP/1.1" 404 2229
[06/Apr/2012 13:46:55] "GET /test/static/css/reset.css HTTP/1.1" 404 2229
```
Notice the /test/? It doesn't load the css.
Any idea why?(I never ha... | [
0.4620588719844818,
0.4333345890045166,
0.11535962671041489,
0.08558527380228043,
-0.1280870884656906,
-0.15722712874412537,
0.5040166974067688,
-0.3240772485733032,
-0.24549713730812073,
-0.6098431944847107,
-0.16497986018657684,
0.31340914964675903,
-0.07938863337039948,
-0.0117870457470... | |
Hello friend I designed a drop down menu using `mouseeneter(`) and `mouseout()` in jQuery. The problem is when I `mouseout()` from the main menu, the drop down links slide up. I don't know how to set conditions on it please help.
My code is
Jquery
```
<script>
$(document).ready(function(){
//alert('hi');
$(... | [
-0.5946074724197388,
0.08262594044208527,
0.8923367857933044,
-0.404622346162796,
0.487786203622818,
0.23543797433376312,
0.513358473777771,
-0.04904413968324661,
0.11469782888889313,
-0.7576316595077515,
-0.14891327917575836,
0.8871738314628601,
-0.18267157673835754,
-0.02153085730969906,... | |
});
})
</script>
```
html
```
<div class="link-detail-wrap"><div id="hover-detail">hover me</div>
<div>
<ul id="link-detail">
<li><a href="#">link 1</a></li>
<li><a href="#">link 1</a></li>
<li><a href="#">link 1</a></li>
<li><a href="#">link 1</a></li>
<li><a href="#">link 1</a></li>
</... | [
-0.5038813352584839,
-0.15301281213760376,
1.0201165676116943,
-0.14612646400928497,
-0.22315531969070435,
0.1687093824148178,
0.06683000922203064,
-0.677366316318512,
-0.060171935707330704,
-0.5362796783447266,
-0.18132910132408142,
0.5321369767189026,
0.044270873069763184,
0.012377002276... | |
display:inline;
}
ul#link-detail li a
{
text-decoration:none;
color:#333;
padding:2px 50px 2px 10px;
background:#F0F0F0;
border-bottom:1px solid #666;
/*line-height:25px;*/
font:12px "Trebuchet MS", Arial, Helvetica, sans-serif;
text-transform:capitalize;
display:block;
}
u... | [
-0.20244964957237244,
-0.12932449579238892,
0.8887946605682373,
0.11342830955982208,
-0.3583851158618927,
0.4518551528453827,
0.23273006081581116,
-0.14370688796043396,
-0.2570526897907257,
-0.6984360218048096,
-0.31286385655403137,
0.19526250660419464,
-0.20740386843681335,
0.072185151278... | |
$('#link-detail').css('display','none');
$("#hover-detail").hover(
function () {
$('#link-detail').css({position:'absolute',top:'20px',left:'0px',zindex:'99999'});
$('#link-detail').slideDown();
},
function () {
// do nothing
}
);
$(".relation").hover(
function () {
// do... | [
-0.04685060307383537,
-0.04694998636841774,
0.8840590715408325,
-0.048383329063653946,
0.18292951583862305,
0.15612560510635376,
0.26122012734413147,
-0.2096281796693802,
-0.14031745493412018,
-0.38639503717422485,
-0.5975135564804077,
0.6064804792404175,
-0.2968215048313141,
0.15269623696... | |
I'm trying to get my head around a polymorphism/inheritance situation in C#.
What I have right now is these classes:
```
Lease (the base class containing the general data)
PrivateLease (inheriting from the Lease class)
BusinessLease (inheriting from the Lease class)
```
What I want to achieve is this:
```
Lease le... | [
0.2864225506782532,
0.24034838378429413,
0.3735927939414978,
-0.007482025772333145,
0.41352275013923645,
-0.3254566788673401,
-0.1632431596517563,
-0.14616134762763977,
0.015771443024277687,
-0.3873431980609894,
-0.1470906287431717,
0.9304524660110474,
-0.005738857202231884,
0.507806897163... | |
for one of the objects. Then when inserting/updating/deleting to the database I'm going to ask which type it is first to dertermine which tables to insert the data into.
I've got a strange feeling that the above is not the right approach to solve this problem. Does anyone have any hints on this? :-) I've searched on g... | [
0.5071532130241394,
0.07855527848005295,
-0.22370874881744385,
0.3722098171710968,
-0.021624688059091568,
-0.03523924574255943,
0.30683785676956177,
0.37567320466041565,
-0.13578732311725616,
-0.5254819989204407,
-0.005067097023129463,
0.3958108425140381,
-0.10787119716405869,
0.1359844952... | |
above mentioned classes are merely just holding data from the UI of my ASP.NET solution to perform CRUD operations against the database via a Data Access Layer. So bascially these classes only contains a bunch of properties to hold data. I.e:
```
public class Lease
{
public int Id { get; set; }
public bool IsA... | [
0.6058415770530701,
-0.34695130586624146,
0.3621155619621277,
0.11137806624174118,
0.29238855838775635,
-0.5156272649765015,
0.2309521585702896,
-0.10560283809900284,
0.1560480147600174,
-0.40259823203086853,
-0.14079242944717407,
0.7126381993293762,
0.04376250132918358,
0.3829042315483093... | |
}
public class PrivateLease : Lease
{
public string Floor { get; set; }
public string Side { get; set; }
public int FloorSize { get; set; }
public int NumberOfRooms { get; set; }
}
```
etc..
The `PrivateLease` and `BusinessLease` classes are different because of the different leaseing-variables that... | [
0.6106213927268982,
-0.09942854940891266,
0.3178345561027527,
0.11269016563892365,
0.4412355124950409,
-0.19524815678596497,
0.10710599273443222,
-0.23104968667030334,
-0.09373029321432114,
-0.4675675928592682,
-0.2694017291069031,
0.6342169642448425,
0.0038685647305101156,
0.4769731760025... | |
I'm going to go through a major casting hell both on the ASP.NET frontend and on the DAL? :-/
Don't decide (choose a logic) on the layer of consumer, but let to decide by the classes themselves:
```
// or you ILease interface if a parent class will not contain any shared logic
abstract class Lease
{
public abstrac... | [
0.5927333831787109,
-0.2552855610847473,
0.3842574954032898,
-0.25833848118782043,
0.5005335807800293,
0.24812161922454834,
-0.0908365324139595,
-0.06682273745536804,
0.3037296235561371,
-0.6822420358657837,
-0.05315253883600235,
0.7637139558792114,
-0.15751811861991882,
0.3001720011234283... | |
void Do() { // business logic here }
}
```
Usage:
```
Lease l = ...
l.Do(); // execute the logic
```
---
You may want to create a factory for objects creation:
```
static class LeaseFactory<T> where T : Lease, new() // constraint to require default constructor existence
{
public static Leas Create()
{
... | [
0.5141080617904663,
0.024745332077145576,
0.1486085057258606,
-0.10368046164512634,
0.53412926197052,
0.3086433708667755,
0.10240110754966736,
-0.08108800649642944,
0.06388995796442032,
-0.4785529673099518,
-0.31667545437812805,
0.8030604720115662,
-0.3464756906032562,
0.153782457113266,
... | |
I have a webpage with some standard [open graph](https://developers.facebook.com/docs/opengraph/) meta tags for Facebook. My problem is that if I place a link to the page in a facebook status message it shows only 2 of 5 images. The 2. and the 3. but not the others.
My first thought was: I did something wrong so I che... | [
0.49325981736183167,
0.21243642270565033,
0.27392610907554626,
-0.001853320631198585,
-0.2567470669746399,
-0.02310769632458687,
0.5887344479560852,
0.020832980051636696,
-0.508539080619812,
-0.653516411781311,
0.3900935649871826,
0.2445254772901535,
-0.3583599627017975,
0.2170552462339401... | |
dimensions of images you provide. The images that omitted from appearance in feed are those having ratio of sides more than 3:1.
The page you provided have 5 images (those with ratio more than 3 will not be used by Like Button):
```
250 × 67 -> ratio 3.73
250 × 186 -> ratio 1.34 (this image will work)
250 × 166 -> ra... | [
0.3316362202167511,
0.03546688333153725,
0.593031108379364,
0.08811550587415695,
-0.29342764616012573,
0.4568535089492798,
0.012007092125713825,
-0.6176636219024658,
-0.1390465945005417,
-0.9203164577484131,
0.2352045327425003,
0.8368152976036072,
-0.04761556535959244,
0.16583441197872162,... | |
How to test the foreign key association in rspec,
Here is the code
```
has_one :store, :foreign_key => "seller_id", :class_name => "Store"
```
How to write rspec for this code
Please tell me some suggestion
Model.new.build\_store.class.should eql Store | [
0.21550551056861877,
0.23321165144443512,
0.1827104687690735,
-0.175214946269989,
0.13435915112495422,
-0.162785142660141,
-0.08040857315063477,
-0.3173575699329376,
0.19123362004756927,
-0.4323391616344452,
-0.005811391863971949,
0.46797236800193787,
-0.40174153447151184,
0.03603422269225... | |
Which is the better way to start the SIP client for android using any external libraries.Since the native inbuilt SIP libraries work only with versions greater than 2.3.1.Looking for the better and easier solution to build the SIP Client for lower versions of android.Could any one help with this...
Take a look at an en... | [
-0.18643216788768768,
-0.28009742498397827,
0.6042787432670593,
0.11339422315359116,
-0.17601190507411957,
-0.03588375449180603,
0.21469241380691528,
-0.24084308743476868,
-0.02497067302465439,
-0.7746762633323669,
-0.16106843948364258,
0.518010139465332,
-0.21108929812908173,
-0.026031795... | |
and other events effectively "pass
> through" them. This attribute is disabled by default. | [
0.022460639476776123,
-0.05741017311811447,
0.1289757490158081,
0.14493297040462494,
0.1762399524450302,
-0.13951918482780457,
0.6194825768470764,
0.1366661638021469,
-0.174550399184227,
-0.5512058138847351,
-0.33921825885772705,
0.17704926431179047,
-0.2729695737361908,
0.4233921766281128... | |
I am using following code for loading images from server using following code.When i scroll UITableView application crashes.
AsynchrohousImageView class .m file
```
- (void)dealloc {
[connection cancel]; //in case the URL is still downloading
[connection release];
[data release];
[_imageView release];
[_activityIndi... | [
0.29170116782188416,
-0.04162471741437912,
0.8683387041091919,
-0.3235599100589752,
-0.32343173027038574,
-0.12659326195716858,
0.6578050851821899,
-0.4066641628742218,
-0.16364747285842896,
-0.850686252117157,
-0.27954530715942383,
0.8436211943626404,
-0.3315686583518982,
0.19275464117527... | |
else {
self.imageView = [[[UIImageView alloc] init] autorelease];
}
[self addSubview:_imageView];
_imageView.frame = self.bounds;
[_imageView setNeedsLayout];
[self setNeedsLayout];
if (activityIndicatorIsShown) {
self.activityIndicator = [[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:ac... | [
-0.06782615929841995,
-0.27373573184013367,
0.8316231966018677,
-0.15732157230377197,
-0.010451451875269413,
-0.03997892513871193,
0.4068896174430847,
-0.5281710028648376,
-0.31953027844429016,
-0.6262180209159851,
-0.5140737891197205,
0.7544711828231812,
-0.1353667974472046,
-0.0279696509... | |
_imageView.image = [UIImage imageWithData:data];
if (_activityIndicator) {
[_activityIndicator stopAnimating];
}
[data release]; data=nil;
}
- (UIImage*) image {
UIImageView* iv = [[self subviews] objectAtIndex:0];
return [iv image];
}
```
In ViewController Class Which loads image
```
- (UITableViewCell *... | [
0.0669514611363411,
-0.20838281512260437,
1.107970118522644,
-0.17237193882465363,
-0.3022381067276001,
0.14309225976467133,
0.4040955901145935,
-0.4436781704425812,
-0.23575438559055328,
-0.7752082943916321,
-0.3106921315193176,
0.6585464477539062,
-0.3159145712852478,
0.2796260714530945,... | |
loadImageFromURL:url
defaultImageName:@"DefaultImage.png"
showDefaultImage:NO
showActivityIndicator:YES
activityIndicatorRect:CGRectMake(5, 10,30,30)
activityIndicatorStyle:UIActivityIndicatorViewStyleGray]; // load our image with URL a... | [
0.37693044543266296,
-0.13983789086341858,
0.8086864352226257,
0.11155229061841965,
-0.2187999039888382,
-0.21416445076465607,
0.20265240967273712,
-0.04424404725432396,
0.038615692406892776,
-0.3974028527736664,
-0.2307131439447403,
0.6448622941970825,
-0.15795274078845978,
-0.11080823838... | |
// cell.imgLocationView.image = [UIImage imageNamed:[dicResult valueForKey:@"Image"]];
[asyncImageView release];
}
if([arrResults count]==1)
{
UITableViewCell *cell1=[tableView dequeueReusableCellWithIdentifier:reuseIdentifier];
if(cell1==nil)
cell1=[[[UITableViewCell alloc]initWithStyle:UITableV... | [
-0.10942848026752472,
0.09261314570903778,
0.9003644585609436,
-0.06986425817012787,
0.27564433217048645,
0.329702764749527,
0.22830376029014587,
-0.7217915654182434,
-0.05533173307776451,
-0.5178399682044983,
-0.5448161363601685,
0.5399965047836304,
-0.07268435508012772,
0.369414895772933... | |
length]>0) {
cell.lblPrice.text = [NSString stringWithFormat:@"£%@",price];
}else{
cell.lblPrice.text = @"";
}
if ([distance length]>0) {
cell.lblmiles.text = [NSString stringWithFormat:@"%.2f miles",[distance floatValue]];
}else{
cell.lblmiles.text = @"";
}
}
return cell;
}
```
How can i resolve thi... | [
-0.032465703785419464,
0.08201553672552109,
0.5217350125312805,
-0.1311374306678772,
0.16414782404899597,
0.17849430441856384,
0.28124749660491943,
-0.6143153309822083,
-0.3898104429244995,
-0.6772909760475159,
-0.03430864214897156,
0.4497329592704773,
-0.16866077482700348,
0.1162998452782... | |
the right use of a UITableView.
the "magic" of UITableView is that it reuse cells, and it just creates and allocates just the minor number of cells needed...
e.g. consider you have a vertical spaces of 480 pixels for your tables, and your cells are 100 pixel height, then you just need 5 cells for time, no need to crea... | [
-0.027657585218548775,
-0.14410030841827393,
0.6380179524421692,
0.42604920268058777,
-0.04906404763460159,
0.13293270766735077,
-0.004131442401558161,
-0.24132564663887024,
-0.32308104634284973,
-0.9906790256500244,
-0.061355989426374435,
0.26415446400642395,
-0.08339925110340118,
0.00680... | |
for the new call that user is going to see down... | [
0.1983756721019745,
0.12429377436637878,
0.676344096660614,
0.08391076326370239,
0.27247345447540283,
-0.008543729782104492,
0.24646052718162537,
0.15689490735530853,
-0.3387404978275299,
-0.5129417777061462,
-0.16884924471378326,
0.48812177777290344,
-0.12091917544603348,
0.15738523006439... | |
I am building a games library and I want the user to be able to delete games.
I am trying to use the .erase() function but i am making a mistake somewhere.
I am studying my code for days and i can't find a anwser.
Why? Beceause I am just 15 and don't have that programming mind every other programmer has. That's why i d... | [
0.15101231634616852,
0.4268155097961426,
0.3201634883880615,
-0.09157055616378784,
-0.0011086841113865376,
0.09975779056549072,
0.39064309000968933,
0.15490677952766418,
-0.14756953716278076,
-0.7875452041625977,
0.18179135024547577,
0.400650292634964,
0.07993105798959732,
0.27733042836189... | |
vector<string> games;
games.push_back("Crysis2");
games.push_back("GodOfWar3");
games.push_back("FIFA12");
cout <<"Welcome to your | [
0.033385299146175385,
-0.15671023726463318,
0.4975419342517853,
-0.13790655136108398,
-0.2555631697177887,
0.26337072253227234,
0.018993914127349854,
0.15992321074008942,
-0.32557564973831177,
-0.7629229426383972,
-0.2299468219280243,
0.4857618808746338,
-0.645642876625061,
0.1207072734832... | |
Games Library.\n";
cout <<"\nWarning!!! Don't type spaces, put ecerything together!!!\n";
cout <<"\nThese are your games:\n";
for (iter = games.begin(); iter != games.end(); ++iter)
{
cout <<*iter <<endl;
}
//the loop!
string action;
string newGame;
cout <<"\n-Type 'exit' if... | [
-0.1932925432920456,
-0.2505601942539215,
0.12748728692531586,
-0.15450827777385712,
0.43605878949165344,
-0.11719393730163574,
-0.08264072239398956,
-0.26903235912323,
-0.6295262575149536,
-0.5132259130477905,
-0.404236376285553,
0.5059351325035095,
-0.6521273255348206,
0.0913488268852233... | |
'game' if you don't know what game to play. ";
while (action != "exit")
{
cout <<"\n\nWhat do you want to do: ";
cin >> action;
if (action == "add")
{
cout <<"\nType the name of the game you want to add: ";
cin | [
0.14765632152557373,
-0.46896037459373474,
0.15352487564086914,
-0.11179078370332718,
0.27281373739242554,
-0.09736553579568863,
0.022333063185214996,
-0.03299769386649132,
-0.31704357266426086,
-0.437488317489624,
-0.4672137498855591,
0.37443089485168457,
-0.4799685478210449,
-0.020822154... | |
>> newGame;
games.push_back(newGame);
for (iter = games.begin(); iter != games.end(); ++iter)
{
cout <<*iter <<endl;
}
continue;
} | [
-0.20196348428726196,
-0.4352484345436096,
0.48368480801582336,
-0.48779287934303284,
0.42686542868614197,
0.15371577441692352,
-0.016720766201615334,
-0.15124216675758362,
-0.36055079102516174,
-0.786404550075531,
-0.6282843351364136,
0.4502282738685608,
-0.2234828770160675,
0.36520141363... | |
else if (action == "delete")
{
cout <<"Type the name of the game you want to delete: ";
cin >> newGame;
iter = find(games.begin(), games.end(), newGame);
if(iter != games.end())
{ | [
-0.3350122570991516,
-0.3972027897834778,
0.11161493510007858,
-0.2531379163265228,
0.5330678224563599,
-0.11694914847612381,
-0.06052103266119957,
-0.27576908469200134,
-0.22352881729602814,
-0.3903631269931793,
-0.6355723142623901,
0.6027848720550537,
-0.25190627574920654,
-0.04683254286... | |
games.erase(newGame);
}
else
{
cout<<"\nGame not found.";
}
continue;
} | [
-0.09644921869039536,
-0.1437993198633194,
-0.00954635813832283,
-0.16990815103054047,
0.4655422270298004,
-0.19554053246974945,
0.14698584377765656,
0.2964736521244049,
-0.43144339323043823,
-0.860025942325592,
-0.40668824315071106,
0.5038609504699707,
-0.47019973397254944,
0.410639286041... | |
else if (action == "find")
{
cout <<"Which game you want to look for in your library: ";
cin >> newGame;
iter = find(games.begin(), games.end(), newGame);
if (iter != games.end())
{ | [
-0.3032236397266388,
-0.4724535644054413,
0.04841696098446846,
-0.18764761090278625,
0.6556061506271362,
-0.11262203007936478,
-0.1554647833108902,
-0.3840354382991791,
-0.2775866389274597,
-0.5271393656730652,
-0.5155146718025208,
0.6005760431289673,
-0.27823546528816223,
-0.2147817611694... | |
cout << "Game found.\n";
}
else
{
cout << "Game not found.\n";
}
continue; | [
-0.2752128839492798,
-0.19508357346057892,
-0.006923532113432884,
-0.4588398039340973,
0.6961560249328613,
-0.13784246146678925,
0.1347644329071045,
0.26249009370803833,
-0.07390652596950531,
-0.5365174412727356,
-0.7871366739273071,
0.6188329458236694,
-0.36038506031036377,
0.153881579637... | |
}
else if (action == "game")
{
srand(static_cast<unsigned int>(time(0)));
random_shuffle(games.begin(), games.end());
cout << "\nWhy don't you play " <<games[0];
continue;
}
else if (action == "quit") | [
0.22463108599185944,
-0.6294940710067749,
0.1741538792848587,
-0.1878887116909027,
0.553928017616272,
-0.18590660393238068,
0.0036701245699077845,
-0.2501330077648163,
-0.7247642874717712,
-0.2715214490890503,
-0.2587234377861023,
0.6643833518028259,
-0.40572550892829895,
0.237179562449455... | |
{
cout <<"\nRemember to have fun while gaming!!\n";
break;
}
else
{
cout <<"\nCommand not found";
}
}
return 0;
}
```
`erase()` takes an iterator (in this case, | [
-0.03736322373151779,
0.04575099050998688,
0.18751369416713715,
-0.1760845184326172,
0.5010161399841309,
-0.3721407651901245,
0.23929400742053986,
-0.08669731765985489,
-0.21517860889434814,
-0.22785213589668274,
-0.38361480832099915,
0.7539947628974915,
-0.2670472264289856,
-0.01818913407... | |
the result of `find`, which is `iter`), not a string (like `newGame`). | [
-0.5760446786880493,
-0.15148553252220154,
-0.06734693050384521,
-0.10416261851787567,
0.08834494650363922,
-0.354899138212204,
-0.03461060672998428,
-0.16849568486213684,
0.23416990041732788,
-0.48983415961265564,
-0.6294358968734741,
0.3990729749202728,
-0.21293768286705017,
0.1943965107... | |
```
<style>
body{
margin:0;
padding:0;
}
#module_footerLink li{
float:left;
list-style:none;
margin:0 5px;
}
.clear{
clear:both;
}
.wrap{
border:1px solid #ccc;
width:900px; | [
0.06999415159225464,
-0.03288469463586807,
0.9465222954750061,
-0.10362156480550766,
0.12920890748500824,
-0.20826806128025055,
0.04323948919773102,
-0.3349231481552124,
-0.2604597806930542,
-0.4419805109500885,
-0.4018006920814514,
0.27771836519241333,
0.02894948236644268,
0.0232014879584... | |
text-align:center;
}
</style>
<body>
<div class="wrap">
<ul id="module_footerLink">
<li><a id="id_home" href="home"><span>Home</span></a></li>
<li><a id="id_the_resort" href="article-AboutUs"><span>The Resort</span></a> </li>
<li><a id="id_facilities" href="article-facilities"><span>Facili... | [
-0.4167894423007965,
0.10526341944932938,
1.2029613256454468,
-0.12509143352508545,
0.04287857934832573,
-0.054751358926296234,
-0.12962782382965088,
-0.5583763122558594,
-0.27352485060691833,
-0.48910748958587646,
-0.3698115050792694,
0.4870088994503021,
-0.14100471138954163,
-0.107287466... | |
class="clear"></div>
</div>
</body>
```
Here I want li's in middle of div whose class is wrap. Do any one know how can i do that? I have tried center align but it does not work...............
see the updated css :-
```
<style>
body {
margin: 0;
padding: 0;
}
#module_footerLink {
margin:auto;
width:450px;
}
#m... | [
-0.09720873087644577,
-0.23713403940200806,
0.7760897874832153,
-0.09923196583986282,
-0.053858596831560135,
0.012244719080626965,
-0.13507546484470367,
-0.31315678358078003,
-0.2490743100643158,
-0.7969531416893005,
-0.12455063313245773,
0.32412290573120117,
-0.30366531014442444,
0.067350... | |
the navigation in proper way
see the updated link:
<http://jsfiddle.net/eHyuZ/7/> | [
0.014076556079089642,
-0.06698337197303772,
0.9792425632476807,
-0.01545741781592369,
0.12099342793226242,
-0.1828613132238388,
0.35733315348625183,
0.2808312773704529,
-0.40021729469299316,
-0.7763752937316895,
-0.28776004910469055,
0.4813899099826813,
0.017355812713503838,
-0.17524190247... | |
Not entirely sure my question title describes what I want to do, but couldn't think how better to word it!! I'm using C, and perhaps the pseudocode below will describe what I'm trying to do:
```
typedef struct obj
{
char *str1;
char *str2;
char *str3;
} object;
/* global variable */
object *glob;
void bl... | [
-0.027091575786471367,
0.11970212310552597,
0.41904938220977783,
-0.17604663968086243,
0.20616771280765533,
0.35775092244148254,
0.30581557750701904,
-0.12872274219989777,
-0.23454347252845764,
-0.6242650747299194,
-0.3912924826145172,
0.474858820438385,
-0.34964466094970703,
-0.0938854813... | |
can see what I'm trying to do. I have a "black-box" function that will do something with a particular member, and I need to be able to tell the black-box function which member to use.
I don't want to just pass the member directly to the function, like in this code, as that won't fit into the rest of my code easily.
`... | [
0.39655375480651855,
-0.04631388559937477,
0.24893802404403687,
-0.29281771183013916,
0.26816126704216003,
-0.04512368515133858,
0.16707929968833923,
-0.3550076186656952,
-0.22912177443504333,
-0.67744380235672,
-0.1798182725906372,
0.5934296250343323,
-0.6527028679847717,
-0.0260196439921... | |
/* do stuff */
}
```
However, you must know in advance the type of your members. Keep in mind that C is not a dynamically typed language, so you have no runtime introspection at all.
**EDIT:** You can implement `offsetof()` functionality without resorting to GCC extensions, like this:
```
#define offsetof(type, fie... | [
0.6412925124168396,
0.12008393555879593,
0.14829720556735992,
-0.10810799151659012,
0.2343485802412033,
-0.5333520174026489,
-0.04059980809688568,
-0.26726335287094116,
-0.3144359886646271,
-0.09571504592895508,
-0.3520567715167999,
0.8144422173500061,
-0.4644663333892822,
-0.2483552545309... | |
In my jsp page(say sample.jsp), it has some links like Google.com.if i click Google.com link, it should connect to another web server via http proxy.How to implement this.
You could do the following magic (with GCC extensions):
```
#define black_box(local, member) black_box_function((local), __builtin_offsetof(object... | [
0.4223264157772064,
0.023216554895043373,
0.3364484906196594,
-0.2782905399799347,
-0.0022110026329755783,
-0.1408332884311676,
0.05368107557296753,
-0.0815906673669815,
-0.3653695285320282,
-0.6168616414070129,
-0.11799347400665283,
0.4940505921840668,
-0.44650954008102417,
-0.16417770087... | |
at all.
**EDIT:** You can implement `offsetof()` functionality without resorting to GCC extensions, like this:
```
#define offsetof(type, field) ((int) (unsigned long) &((type *) 0)->field)
``` | [
0.39237067103385925,
-0.1080191507935524,
0.34505197405815125,
-0.0008825934492051601,
0.10336948186159134,
-0.33538979291915894,
-0.23494219779968262,
-0.2708963453769684,
-0.12156578153371811,
-0.3917553126811981,
-0.1820896565914154,
0.8010334372520447,
-0.3262690007686615,
-0.233719453... | |
I have the following javascript class which I am trying to pass to an ASP.NET MVC Controller
```
var postParams = {
attributes : [
{
name : '', | [
0.11672168970108032,
-0.1649620682001114,
0.34425538778305054,
-0.09742394834756851,
0.1516852229833603,
0.07283641397953033,
0.26036566495895386,
0.02186635509133339,
-0.026873856782913208,
-0.6950616836547852,
-0.13116486370563507,
0.16790762543678284,
-0.2842308580875397,
0.396002471446... | |
description: '',
attributeType : '',
value : ''
} | [
-0.2562166154384613,
0.10103102773427963,
0.01731123961508274,
0.14176760613918304,
0.16700619459152222,
0.20417003333568573,
0.1615476757287979,
0.06335631757974625,
0.14732810854911804,
-0.5933895707130432,
-0.21346774697303772,
0.4104999899864197,
-0.3169020414352417,
0.2178410738706588... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.