text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
app, you want to know whether you've fetched the data already, you could usually just check `BasicDealList.length`. If you want to avoid making repeated requests for collections that are actually empty on the server, you'll probably need to work out a custom solution, e.g. setting a flag on `.fetch()`:
```
BasicDealLi... | [
0.04834514856338501,
-0.03647562488913536,
0.4833694100379944,
0.012765577994287014,
0.013753167353570461,
0.255147248506546,
0.22170886397361755,
-0.3718351721763611,
-0.5663072466850281,
-0.520946741104126,
-0.4082682728767395,
0.5326571464538574,
-0.4237249791622162,
-0.0761288702487945... | |
`.reset()`, and `.add()` checks whether the `models` argument is an array; if it's not, it wraps it in one:
```
models = _.isArray(models) ? models.slice() : [models];
```
So passing `{}` will result in `models` set to `[{}]`, which is not what you want. If you can't control the server, you could do the check for `{... | [
0.019799930974841118,
-0.39077454805374146,
0.34408533573150635,
0.10667376965284348,
0.2942899465560913,
-0.04729985445737839,
0.023649271577596664,
-0.22013363242149353,
-0.33654531836509705,
-0.5392305850982666,
-0.2285822629928589,
0.7031670212745667,
-0.5176787376403809,
0.13311302661... | |
i'm struggling to get UIScrollView working.
I have a UIScrollView with a UIImageView and UITextView as it's subviews.
The UIScrollView, UIImageView and UITextView are hooked up to my controller.
When I use this line of code in viewDidLoad:
```
self.scrollView.contentSize = CGSizeMake(320, 1000);
```
the scrollin... | [
0.073465995490551,
-0.11468135565519333,
1.0584856271743774,
-0.0009093799162656069,
-0.12227004766464233,
0.08307898044586182,
0.10644873231649399,
-0.29091906547546387,
-0.15720196068286896,
-0.8482211232185364,
-0.08115724474191666,
0.6337940692901611,
-0.27555590867996216,
0.1213651821... | |
more.

A few questions:
* how do i properly can adjust the UITextView so that all the text is displayed when scrolling.
* is there a way to set the scrollview contentSize to the sum of all it's subviews (instead of having to hard code it like I have now)
You do n... | [
0.37682124972343445,
-0.2336537390947342,
0.9934582114219666,
0.0488089919090271,
-0.16200706362724304,
-0.07903362065553665,
0.2266545593738556,
-0.3510604202747345,
-0.571662187576294,
-0.9212915897369385,
0.1056385487318039,
0.7211446166038513,
0.07984725385904312,
0.057358406484127045,... | |
CGSizeMake(self.contentSize.width, height)
``` | [
0.1983611285686493,
0.25480449199676514,
0.4912460744380951,
0.20031678676605225,
0.11116159707307816,
-0.27761316299438477,
0.08423259109258652,
0.051013506948947906,
-0.3501891493797302,
-0.5330836176872253,
-0.24476873874664307,
0.23806564509868622,
0.02332485280930996,
0.30065053701400... | |
Ok I want to create domain using libvirt-php.Here is the code.
< ?php
```
$credentials = array(VIR_CRED_AUTHNAME=>'root',VIR_CRED_PASSPHRASE=>'root');
$conn = libvirt_connect("xen:///", FALSE, $credentials);
$name="oneiric";
$arch="i386";
$memMB=1024;
$maxmemMB=1536;
$vcpus=2;
$iso_image="/root/onericGUI.iso";
$dis... | [
-0.009111923165619373,
0.24571022391319275,
0.6821156144142151,
-0.1079125925898552,
-0.07525940239429474,
-0.016807565465569496,
0.20312660932540894,
-0.27506598830223083,
-0.24356988072395325,
-0.566079318523407,
-0.02428029477596283,
0.2997884452342987,
-0.3970456123352051,
0.4929639995... | |
"size" => "10G",
"flags" => VIR_DOMAIN_DISK_FILE | VIR_DOMAIN_DISK_ACCESS_ALL ); $disks = array( $disk1 );
$network1 = array(
'mac' => '00:11:22:33:44:55', | [
-0.07919316738843918,
0.04185021296143532,
0.6531804203987122,
0.04894227162003517,
0.31718671321868896,
0.010867854580283165,
0.1446986347436905,
0.03640642762184143,
-0.4269516170024872,
-0.7210692167282104,
-0.16368113458156586,
0.7317172288894653,
-0.42648014426231384,
0.40370130538940... | |
'network' => 'default',
'model' => 'e1000'
);
$networks = array( $network1 ); $flags=DOMAIN_FLAG_FEATURE_ACPI;
$newdom=libvirt_domain_new($conn, $name, $arch, $memMB, $maxmemMB, $vcpus, $iso_image, $disks, $networks, $flags);
print_r($newdom); | [
-0.007243076339364052,
-0.3184361457824707,
0.6218082308769226,
-0.06893114745616913,
0.3315447270870209,
-0.2365225851535797,
0.22040873765945435,
-0.14952175319194794,
-0.47408488392829895,
-0.7449882626533508,
-0.3994903862476349,
0.4410914182662964,
-0.4394770860671997,
0.5205845236778... | |
?>
```
Every thing all right but the problem is only at **$flags** .
I have passed
> > 1. DOMAIN\_FLAG\_FEATURE\_ACPI
> > 2. DOMAIN\_FLAG\_FEATURE\_APIC
> > 3. DOMAIN\_FLAG\_FEATURE\_PAE
> > 4. DOMAIN\_FLAG\_CLOCK
> > 5. DOMAIN\_FLAG\_SOUND\_AC97,
> > all options Indevedually but when I execute it it shows me fo... | [
-0.0691496804356575,
0.07364838570356369,
0.5594804286956787,
0.06463485956192017,
0.21351110935211182,
-0.05200205743312836,
0.7094907164573669,
-0.3967006504535675,
-0.27100691199302673,
-0.41981270909309387,
-0.39914795756340027,
0.6110059022903442,
-0.46104514598846436,
-0.089883171021... | |
34
Found out where confusion was. I was putting `Friendly Name` of certificate in the web.config. The certificate common name is actually property called `Issued To`.
There is a part about certificate common name in this article.
<http://www.sslshopper.com/article-how-to-create-a-self-signed-certificate-in-iis-7.html... | [
0.07818392664194107,
0.0820188969373703,
0.31228718161582947,
-0.010482799261808395,
-0.3092110753059387,
-0.507233738899231,
0.3641396164894104,
-0.16286322474479675,
0.07109247893095016,
-0.40595054626464844,
0.22625914216041565,
0.14648035168647766,
-0.006494214758276939,
0.049335233867... | |
Today I faced with one problem. My teammate created branch from master. He developed one feature in this branch and after that developed two subfeatures in subfeature's branches. At last he did two refactoring commit of the entire thing. So...
```
C--D E--F | subfeatures
/ \ / \
B----... | [
0.18179580569267273,
0.0010490819113329053,
0.4104624390602112,
-0.20205990970134735,
0.09755665063858032,
0.28862905502319336,
0.2156858891248703,
-0.26826027035713196,
-0.19754841923713684,
-0.5401363372802734,
-0.18372191488742828,
0.5666631460189819,
-0.11402846872806549,
0.28922912478... | |
branches before no-fast-forward merge it into master. But of course this rebase fails. Rebased feature branch became looking like:
```
B'--C'--D'--E'--F'--G'--H'
/
A--K
```
Of course pointers of C & D became wrong so I also get two subfeature branches growing 'from air'. I understand how to fix it if subfea... | [
-0.0116847213357687,
-0.2231789380311966,
0.32818177342414856,
0.19706489145755768,
0.016827821731567383,
0.03117254003882408,
0.4703684449195862,
-0.2746458351612091,
-0.16105765104293823,
-0.8063255548477173,
-0.30280226469039917,
0.5502715706825256,
-0.25825393199920654,
0.1760555654764... | |
--onto` didn't work before ("[`git rebase --preserve-merges --onto` doesn't preserve merges](https://stackoverflow.com/questions/9521422/git-rebase-preserve-merges-onto-doesnt-preserve-merges)")
* a `rebase --preserve-merges` had issue in some instance:
+ see [this thread](http://git.661346.n2.nabble.com/git-rebase-pr... | [
0.07065672427415848,
0.12470953166484833,
0.2727105915546417,
0.10781461000442505,
0.12069892138242722,
0.002838971558958292,
0.22162823379039764,
-0.2558782696723938,
-0.3187674880027771,
-0.3857627809047699,
-0.1896492838859558,
0.1356685310602188,
-0.4646354019641876,
0.2079871147871017... | |
>
> And you will end up resolving the conflicts again ... at least this is the case with git version 1.7.5.4
(That would call for [`git rerere`](https://git-scm.com/docs/git-rerere)) | [
-0.15295758843421936,
-0.06423775851726532,
0.8872643113136292,
0.03772157058119774,
-0.1148284375667572,
-0.049625054001808167,
0.5397083163261414,
-0.25986504554748535,
-0.28009435534477234,
-0.6093579530715942,
-0.4945375323295593,
0.7968662977218628,
-0.2466963678598404,
-0.04928107187... | |
I used to use an add-on for firefox called measureit. Now its not working because of firefox keeps updating all the time and the developer hasn't come out with a version of measure it that is supported by newer versions of firefox. Does anyone know a good pixel ruler add-on for FF?
You could download the [web developer... | [
0.6957994699478149,
-0.10301433503627777,
0.5705854892730713,
0.0006450145156122744,
-0.4124230444431305,
0.3338397443294525,
0.06615607440471649,
-0.2043612152338028,
-0.0970078855752945,
-0.9804918766021729,
0.9953286051750183,
0.22099871933460236,
-0.03131399303674698,
-0.01836836524307... | |
I'd like to say that I solved the problem but I wanted post this here as a reference if anyone else is having the same problem.
I've been following this tutorial: <http://wiki.phonegap.com/w/page/41524872/JQuery%20Mobile%20Tutorial%20(iOS>)
to incorporate jquery mobile into my application. I am using the latest jquer... | [
0.11313261091709137,
0.010364954359829426,
0.7071983218193054,
-0.1855156570672989,
-0.0055387276224792,
0.17295174300670624,
0.4103170335292816,
-0.0913408175110817,
-0.21289920806884766,
-0.8103006482124329,
-0.06455329805612564,
0.7525018453598022,
-0.09074173122644424,
-0.0405028797686... | |
probably should've followed the tutorial step by step but honestly, I thought newer versions of jquery are supposed to be better and backwards compatible. | [
0.08190416544675827,
-0.06325320154428482,
0.21611928939819336,
0.4375931918621063,
-0.27578452229499817,
-0.18562370538711548,
0.0862312987446785,
0.4765951931476593,
-0.03985249251127243,
-0.23201899230480194,
-0.003107321448624134,
0.46700921654701233,
0.24171987175941467,
-0.1325798332... | |
I have read a huge pile of problems and solutions, and I just can't figure out what I'm doing wrong.
```
BounceDate = DateValue(txtBounceDate.Value)
bncSql = "DELETE _BounceMaster.* FROM _BounceMaster" & _
" WHERE _BounceMaster.DateCheck >= #" & BounceDate & "#;"
DoCmd.RunSQL bncSql
```
\_BounceMaster.DateCheck ... | [
0.28328582644462585,
0.15340973436832428,
0.5010679960250854,
-0.23515526950359344,
0.10287582129240036,
-0.44703567028045654,
0.34900569915771484,
-0.2312171310186386,
-0.33877697587013245,
-0.4955280125141144,
0.06507966667413712,
0.3382965922355652,
-0.40513041615486145,
0.0195346772670... | |
I am getting syntax errors. What am I doing wrong?
It should be
```
DELETE FROM _BounceMaster
```
not
```
DELETE _BounceMaster.* FROM _BounceMaster
```
You should be using parameterized queries, as your code is subject to SQL injection attack. | [
0.353201299905777,
0.4292813837528229,
0.09837234765291214,
-0.04415149241685867,
-0.17470213770866394,
-0.43712499737739563,
0.5213314890861511,
0.13111355900764465,
-0.1673903465270996,
-0.5237295627593994,
0.09736292064189911,
0.4840674102306366,
-0.4809481203556061,
0.09122888743877411... | |
i have 2 List that i want to put into my Listbox
the first List contain names and the second contain numbers
my problem is that some of the names long so the numbers cannot a display in the same line
how can i put in in appropriate way ?
```
listBox.Items.Add("Name" + "\t\t\t" + "Number");
for (int i = 0; i < lists.Co... | [
0.10719911009073257,
-0.11967151612043381,
0.656213641166687,
-0.16847054660320282,
-0.08600692451000214,
0.03112376481294632,
0.2730761468410492,
-0.5602240562438965,
-0.26811933517456055,
-0.9020353555679321,
0.02316250093281269,
0.6464956402778625,
-0.43940457701683044,
0.12939120829105... | |
@Yuck mentioned in the comments it will give you the effect you need.

It is a bit akward to populate from 2 separate lists but it is doable with the code below:
```
listView1.View=View.Details;
listView1.Columns.Add("Name");
listView1.Columns.Add("Number");
s... | [
0.35138219594955444,
-0.08422517031431198,
0.6189203858375549,
-0.16301044821739197,
-0.2945338487625122,
-0.03703131526708603,
0.5291076898574829,
-0.09615905582904816,
-0.10802239924669266,
-0.5657627582550049,
0.09600509703159332,
0.4941479563713074,
-0.30744096636772156,
0.154355794191... | |
like this:
```
public struct Record
{
public string name;
public int number;
public string[] ToStringArray()
{
return new string[] {
name,
number.ToString() };
}
}
```
and used like this:
```
listView1.View=View.Details;
listView1.Columns.Add("Name");
... | [
0.339728981256485,
-0.04948187619447708,
0.36412760615348816,
-0.2824816107749939,
0.07526841014623642,
0.1913202702999115,
0.35734832286834717,
-0.20315584540367126,
-0.4552556276321411,
-0.7273868918418884,
-0.30541732907295227,
0.5122168064117432,
-0.3663112223148346,
0.4445971846580505... | |
},
new Record() { name="Buster", number=1027400 },
new Record() { name="Charlie", number=1028405 }
};
for(int i=0; i<list.Length; i++)
{
listView1.Items.Add(
new ListViewItem(list[i].ToStringArray()));
}
``` | [
0.3004453182220459,
-0.29031068086624146,
0.46438291668891907,
-0.23913854360580444,
0.21136589348316193,
0.09941039234399796,
0.36733278632164,
-0.2613934874534607,
-0.6177648901939392,
-0.309132844209671,
-0.3002412021160126,
0.5070428848266602,
-0.511786937713623,
0.2659507393836975,
... | |
If I want to append the contents of a src file into the end of a dest file in Ruby, is it better to use:
```
while line = src.gets do
```
or
```
while buffer = src.read( 1024 )
```
I have seen both used and was wondering when should I use each method and why?
One is for reading "lines", one is for reading *n* b... | [
0.06969356536865234,
-0.059091463685035706,
0.2299949675798416,
-0.005271517671644688,
-0.19133608043193817,
0.10037088394165039,
-0.13390007615089417,
-0.1803227663040161,
-0.3854091167449951,
-0.6859549880027771,
-0.0007978227804414928,
0.15045425295829773,
-0.48230835795402527,
0.015729... | |
chunks of data around?
That said, a performance test in your specific environment may be helpful when deciding. | [
0.36903947591781616,
-0.0885726809501648,
-0.3056601285934448,
0.6597550511360168,
-0.10338407754898071,
-0.17824320495128632,
-0.004788001999258995,
0.14224614202976227,
-0.4048518240451813,
-0.24017062783241272,
-0.06125506013631821,
0.10688001662492752,
0.22554881870746613,
-0.091952666... | |
> **Possible Duplicate:**
>
> [Interface vs Abstract Class (general OO)](https://stackoverflow.com/questions/761194/interface-vs-abstract-class-general-oo)
I can see their advantage in coordination of a developing team, or code that might be further developed by others.
But if not, is there a reason to use them at... | [
0.13638685643672943,
0.12245755642652512,
0.06192804127931595,
0.16940681636333466,
-0.11329895257949829,
0.17302599549293518,
0.2051544338464737,
0.11498898267745972,
-0.36857736110687256,
-0.8880921602249146,
0.17956958711147308,
0.5550164580345154,
-0.26172593235969543,
-0.0927687063813... | |
others, it does two things
1. helps keep your from doing weird things to your own code. Imagine
your write a class, and use it in multiple projects. You may evolve
it in one project so that it is unrecognizable from it's cousin in
another project. Having an abstract class or interface makes you
think twice about chan... | [
0.5821975469589233,
-0.44787272810935974,
-0.2087995409965515,
0.4736466705799103,
-0.2335033416748047,
-0.18101812899112701,
-0.037520088255405426,
0.005814209580421448,
-0.32259440422058105,
-0.5241121649742126,
0.29087576270103455,
0.4999474585056305,
-0.05173052102327347,
0.10560644418... | |
I have tag in my content. I need to replace all those tags by span tags: for eg:
my contenti is wrapped like :
`<blockquote><p>my content</p></blockquote>` .
I need to replace this with :
```
<span class="highlight">content</span>
```
How can i achieve this in PHP. I tried some preg\_replace but nothing worked. ... | [
0.32414382696151733,
-0.058996208012104034,
0.6574543118476868,
0.0637255609035492,
-0.3698321580886841,
-0.2468089908361435,
0.41639551520347595,
-0.15960870683193207,
-0.10339192301034927,
-0.8516164422035217,
-0.04483066499233246,
0.42483246326446533,
-0.1820419728755951,
-0.08884843438... | |
I have a script that does a backup of my system every day. In the end I get 3 zip files each day and they get stored to S3. What I'd like to do is always keep a week or 10 days worth of these backups. After the 10th day, delete the oldest 3 zip files from S3. Any ideas on how I could tackle this. I don't see a way I co... | [
0.34265732765197754,
0.03096085973083973,
0.5927332639694214,
-0.11759493499994278,
0.0743102878332138,
-0.031547728925943375,
0.6851072907447815,
-0.2301137000322342,
-0.42647993564605713,
-0.7987667322158813,
-0.24592694640159607,
0.4808180630207062,
-0.2583419382572174,
-0.0407585091888... | |
AmazonS3();
$s3->create_object('mybucket', 'backups/'.$backup1, array(
'fileUpload' => BACKUPDIR.$backup1,
'acl' => $s3::ACL_PRIVATE
));
$s3->create_object('mybucket', 'backups/'.$backup2, array(
'fileUpload' => BACKUPDIR.$backup2,
'acl' => $s3::ACL_PRIVATE
));
$s3->create_object('mybucket', 'backups/'.$backup3, arra... | [
-0.09057077020406723,
-0.2343071550130844,
0.503713071346283,
0.03481464833021164,
-0.17152343690395355,
0.25797805190086365,
0.6664348244667053,
-0.5760781168937683,
-0.41472697257995605,
-0.5535554885864258,
-0.4548879861831665,
0.5746991038322449,
-0.4312324523925781,
-0.052949223667383... | |
I have a JPanel which contains some fields. The height of the JPanel is limited so I have to put a JScrollPane around it so people can scroll down.
As you can see below, it displays perfectly. But you can't scroll down (or up).
```
DetailPanel detail = new DetailPanel();
JScrollPane jsp = new JScrollPane(detail);
jsp... | [
0.25966718792915344,
-0.11192183941602707,
0.8865005970001221,
-0.030580898746848106,
0.0149244898930192,
0.2319943606853485,
0.3229354918003082,
-0.44204118847846985,
-0.18857967853546143,
-0.4673463702201843,
-0.24397704005241394,
0.4240933656692505,
-0.20243564248085022,
-0.220521003007... | |
for(int i = 0; i < lbls.length; i++) {
JLabel lbl = new JLabel(lbls[i]);
lbl.setBounds(x, y, 200, 25);
add(lbl);
fields[i] = new JTextField(); | [
0.014718095771968365,
-0.3267240524291992,
0.5402494668960571,
-0.5431298017501831,
0.06022269278764725,
0.3339332342147827,
0.257267028093338,
-0.6035000681877136,
-0.017240021377801895,
-0.4952949285507202,
-0.4712546765804291,
0.5582867860794067,
-0.40085268020629883,
-0.004124774597585... | |
fields[i].setBounds(x, y+26, 200, 25);
add(fields[i]);
y+=50;
}
}
```

Your DetailPanel has no layout manager associated with it, which means it doesn't expand when you add children to it, which mea... | [
0.43046510219573975,
-0.27929753065109253,
0.6830894947052002,
-0.03932804614305496,
0.36439692974090576,
0.07952014356851578,
0.018195535987615585,
-0.1965358555316925,
-0.22562581300735474,
-0.746207594871521,
-0.1500394493341446,
0.3732258677482605,
-0.13937939703464508,
-0.197919160127... | |
your DetailPanel or override `getPreferredSize()` to add up the heights of its children and return a meaningful value. | [
0.6892098784446716,
-0.2984614670276642,
0.3029544949531555,
0.7203277945518494,
-0.00714515894651413,
-0.08436665683984756,
0.27117612957954407,
-0.23717297613620758,
0.13377873599529266,
-0.6484255194664001,
-0.11586744338274002,
0.7221858501434326,
0.39984479546546936,
-0.09486465901136... | |
I am sure that my in my hashtable, there is no duplicated value and key.
Here is my code:
```
private void checkclientleave(string content)
{
if (content == "I am leaving the room")
{
foreach (DictionaryEntry dict in clientsInroom)
{
if (dict.Value == | [
0.2520075738430023,
0.24908022582530975,
0.6632320284843445,
-0.3215385973453522,
0.5351788997650146,
-0.2223181128501892,
0.33390650153160095,
0.021700456738471985,
0.2118830382823944,
-0.5517725348472595,
-0.2101268172264099,
0.334255576133728,
-0.20350953936576843,
0.3911110758781433,
... | |
clientSocket)
clientsList.Remove(dict.Key);
}
}
}
```
The value of my hashtable is the socket for each client.
The key of my hashtable is the name of each client.
I got some unknown error: collection was modified enumeration operation may not execute
Anyone has any idea??
> I got... | [
0.18700473010540009,
0.12028893083333969,
0.32351139187812805,
-0.08684732019901276,
-0.1893291026353836,
0.10520411282777786,
0.20030847191810608,
0.16754931211471558,
-0.5632479786872864,
-0.5479676127433777,
0.07948542386293411,
0.5240214467048645,
-0.4181244671344757,
0.508837878704071... | |
An enumerator remains valid as long as the collection remains unchanged. If changes are made to the collection, such as adding, modifying, or deleting elements, the enumerator is irrecoverably invalidated and its behavior is undefined.
And for [`MoveNext`](http://msdn.microsoft.com/en-us/library/ab0k6d6s.aspx):
> `In... | [
-0.10456237196922302,
0.03941800817847252,
0.3145824670791626,
-0.020964592695236206,
0.1628045290708542,
-0.054128628224134445,
0.24583813548088074,
-0.3695850670337677,
-0.29419389367103577,
-0.36261168122291565,
-0.4498794972896576,
0.3375140130519867,
-0.31514158844947815,
0.2690515816... | |
clientsList.Remove(dict.Key);
return;
}
```
Another alternative would be to use LINQ:
```
var key = clientsInRoom.Where(pair => pair.Value == clientSocket)
.Select(pair => pair.Key)
.FirstOrDefault();
if (key != null)
{
clientsInRoom.Remove(key);
}
``` | [
-0.03788437321782112,
-0.23175209760665894,
0.46093305945396423,
-0.45553454756736755,
0.01665242202579975,
-0.01359440665692091,
0.26839935779571533,
-0.2949722111225128,
-0.5410727858543396,
-0.5728616714477539,
-0.22616998851299286,
0.7013741135597229,
-0.6281849145889282,
0.28762272000... | |
I have a label that gets updated with values calculated from information received by the server. Depending on how much traffic there is the updates can come in rapidly or at random intervals. What I would like to do is compare the new calculated value with the old value and if it has increased then change the text to b... | [
0.5667353868484497,
0.05150080844759941,
0.5226678848266602,
0.004951258655637503,
-0.033470265567302704,
0.06789465993642807,
0.04768714681267738,
0.3439551293849945,
-0.46231016516685486,
-0.6198060512542725,
0.4692046046257019,
0.5326794385910034,
-0.40453386306762695,
0.035279557108879... | |
a half a second or so I would like to change the background and text to be their default colors. I'm doing this as part of user feedback for when the values change.
Any information would be greatly appreciated.
A label is a subclass of UIView. Assuming you have some method that notifies you of when the change occurs..... | [
0.0992073342204094,
-0.41050007939338684,
0.6632226705551147,
0.05936414748430252,
0.11289909482002258,
0.09672154486179352,
0.2601364850997925,
-0.07882703095674515,
-0.32357946038246155,
-0.7766172885894775,
-0.2074350267648697,
0.5426262617111206,
0.05755263566970825,
0.1297432631254196... | |
if (finished) {
[UIView animateWithDuration:0.5 delay:5.0 options:nil animations:^{
label.backgroundColor = [UIColor clearColor];
} completion:nil];
}];
}
```
This just changes the background to be green, but illustrates the point none-the-less. This take 0.5 seconds to a... | [
-0.013727698475122452,
-0.3505721092224121,
0.7621918320655823,
0.12374936044216156,
0.206406831741333,
0.15900184214115143,
0.21337153017520905,
-0.11935247480869293,
-0.27336496114730835,
-0.7186959385871887,
-0.23757237195968628,
0.21835991740226746,
0.1931947022676468,
-0.0397859588265... | |
clear. | [
0.32040688395500183,
0.5064741969108582,
0.4508957862854004,
-0.3030078709125519,
0.01842668652534485,
-0.5631683468818665,
0.31625381112098694,
0.4248480796813965,
-0.12447010725736618,
-0.7264088988304138,
-0.3215632736682892,
0.21474629640579224,
-0.2812533676624298,
0.01369309984147548... | |
I have the following query that performs a "AND" on-demand:
```
var products = // Selecting a list of products in anywhere based in a filter...
foreach (var product in products)
{
query = query.Where(p => p.Code == product.Code); // with this way, this query make no sense because this happens in any scenario, nev... | [
0.32183733582496643,
0.06802916526794434,
0.2936100959777832,
-0.31958910822868347,
-0.000994627014733851,
-0.026289669796824455,
-0.338163822889328,
-0.5135937929153442,
-0.1914709359407425,
-0.6941794157028198,
-0.23089879751205444,
0.3881876766681671,
-0.3605893552303314,
0.142049893736... | |
*
FROM products
WHERE code IN (<list_of_codes>)
``` | [
0.47589749097824097,
0.30862241983413696,
-0.08834195137023926,
-0.17176181077957153,
-0.010741377249360085,
0.14618802070617676,
0.04485826566815376,
0.012723254971206188,
-0.019565103575587273,
-0.451401025056839,
-0.44845059514045715,
0.2845786511898041,
-0.08480136841535568,
0.41910335... | |
I have an iframe on a page that I need to initially have a blank src for, as I eventually set the src with javascript.
I had been using a however have encountered an issue in Safari and Chrome where this loads a duplicate copy of my page within the iframe.
I read about "about:blank" in another question, however I've ... | [
0.4690256714820862,
0.33058443665504456,
0.24462199211120605,
-0.15109758079051971,
-0.3337213695049286,
-0.30929499864578247,
0.2648831307888031,
0.1701594889163971,
-0.30431121587753296,
-0.7470732927322388,
0.18638725578784943,
0.26119327545166016,
-0.20714779198169708,
0.18059119582176... | |
iframe?
[`about:blank` is the way to do it.](https://stackoverflow.com/questions/5946607/is-an-empty-iframe-src-valid) Alternately, you could just [insert the whole `<iframe>` element with JavaScript later](https://stackoverflow.com/a/4284632/139010), and don't worry about a valid "empty" `src`. | [
-0.14565826952457428,
0.20355559885501862,
0.31772947311401367,
-0.16856378316879272,
0.09554853290319443,
-0.24872048199176788,
0.01538271177560091,
0.16415822505950928,
-0.31604495644569397,
-0.49234870076179504,
-0.1569034606218338,
0.3866114020347595,
-0.16065466403961182,
-0.283303797... | |
I'm setting a `TextView` with the id `@android:id/empty` to display a message when there are no items in the `ListView`. However, this `TextView` gets displayed even if there are items in the `ListView`, right before the items show up.
How can I make it such that it only gets displayed when there are no elements in th... | [
0.1161784753203392,
-0.10751067101955414,
0.7446548938751221,
-0.3249599039554596,
-0.08876484632492065,
0.22079214453697205,
0.06538040935993195,
-0.4048954248428345,
-0.10329624265432358,
-0.625141978263855,
-0.1536484658718109,
0.3057204484939575,
-0.22909796237945557,
0.057275231927633... | |
android:layout_height="wrap_content"
android:text="@string/empty_list" />
</LinearLayout>
```
PS: I'm using a `Loader` and a `SimpleCursorAdapter` with a `ListFragment`.
I'm guessing you are using a regular `Fragment` or `Activity` with a `ListView` inside of it. If you are, you must add the empty layout to the ... | [
0.10149478167295456,
-0.09260842949151993,
0.8020978569984436,
-0.5853026509284973,
-0.08812949061393738,
0.06231335923075676,
0.07872972637414932,
-0.2963193356990814,
-0.24092809855937958,
-0.9395891427993774,
-0.4012889564037323,
0.7530072927474976,
-0.5472896099090576,
-0.2499685287475... | |
I am using and EditText to display my app's EULA. The EditText is marked singleLine=false and enabled = false.
When I ev.setText='....', the text appears slightly shifted 1 and 1/2 characters to the left plus down 1 and 1/2 lines. That is, the text is not registered/displayed properly to the top left corner. Any idea... | [
0.1834728866815567,
0.09287302196025848,
0.7976993918418884,
-0.07181670516729355,
0.31042736768722534,
0.2570090889930725,
0.3676588833332062,
-0.016567185521125793,
-0.06945375353097916,
-0.6489921808242798,
-0.2462611347436905,
0.45029088854789734,
-0.45705658197402954,
0.01202921103686... | |
of the file is alphabetical, you will either print an undesired `EOF` byte to the output file, or, since you cast `ch` to an `unsigned char` when passing it to `isalpha()`, which usually results in 255 [for `EOF = -1` and 8 bit `unsigned char`], it will in some locales (en\_US.iso885915, for example) be considered an a... | [
-0.06391575932502747,
0.2106298804283142,
0.1773184835910797,
-0.09370622783899307,
0.1986878365278244,
0.014953834004700184,
0.32508665323257446,
0.014287411235272884,
-0.055786892771720886,
-0.32845064997673035,
-0.3830879330635071,
0.2874181866645813,
-0.418425589799881,
0.0528062470257... | |
with a newline if the need arises, since that's simple.
Then it remains to print out the non-alphabetic characters which don't immediately follow alphabetic characters:
```
do{
ch = fgetc(pInFile); /*read char fom file*/
if(isalpha(ch)){ /*if char is alphabetical char*/
... | [
0.028617873787879944,
-0.01148623414337635,
0.4710923731327057,
-0.2661977708339691,
0.17844665050506592,
0.3221510946750641,
0.06593982875347137,
-0.2826191782951355,
0.004344078712165356,
-0.31972041726112366,
-0.47745099663734436,
0.3612048029899597,
-0.30596986413002014,
0.043501675128... | |
/*put char into input array*/
temp[numChar] = tolower(ch); /*put char in temp in lowercase for dictionary check*/
numChar++; /*increment char array element counter*/
}
else{
if(numChar != 0){
input[numChar] | [
0.09281343221664429,
0.16483598947525024,
0.08866400271654129,
-0.3404178321361542,
-0.3915556073188782,
0.4879723787307739,
0.3727179765701294,
-0.4692859351634979,
0.1746462881565094,
-0.16422291100025177,
-0.054783839732408524,
0.5680234432220459,
-0.12789778411388397,
-0.04303975403308... | |
= '\0'; /*add end of string char*/
temp[numChar] = '\0';
dictElement = binarySearch(dict,0,count-1,temp); /*check if word is in dictionary*/
if(dictElement == -1){ /*word not in dictionary*/
fprintf(pOutFile,"**%s**%c", input, (ch == EOF) ? '\n' : ch);
... | [
-0.2257535457611084,
-0.09786996245384216,
0.21176695823669434,
-0.2659994065761566,
0.23475602269172668,
0.4762105941772461,
0.3776698112487793,
-0.07010335475206375,
0.21181432902812958,
-0.36320802569389343,
-0.5125405788421631,
0.4782814085483551,
-0.08785150200128555,
-0.1104694828391... | |
else{ /*word is in dictionary*/
fprintf(pOutFile, "%s%c", input, (ch == EOF) ? '\n' : ch);
}
numChar = 0; /*reset numChar for next word*/
}
else | [
-0.15347982943058014,
-0.022017046809196472,
0.1499614119529724,
-0.29486799240112305,
0.24563932418823242,
0.3000340759754181,
0.5566017031669617,
0.05075101554393768,
0.17991241812705994,
-0.5689727663993835,
-0.3955254554748535,
0.7292541265487671,
0.10171400010585785,
-0.17586944997310... | |
{
if (ch != EOF) {
fprintf(pOutFile, "%c",ch);
}
}
}
}while(ch != EOF);
``` | [
0.04578212648630142,
0.024874942377209663,
0.34567883610725403,
-0.28522035479545593,
0.49244141578674316,
-0.018124252557754517,
0.09088002890348434,
-0.10318966954946518,
0.27443352341651917,
-0.34774890542030334,
-0.6086388230323792,
0.8157516121864319,
-0.1444476693868637,
0.0101540312... | |
I'm trying to write a `let` function that allows me to do things like:
```
let(a=2, b=3, a+b)
>>> 5
```
Currently I'm stuck with
```
let <- function(..., expr) {
with(list(...), quote(expr))
}
```
which doesn't work at all. Any help appreciated.
Here's one way:
```
let <- function(..., expr) {
expr <- subs... | [
0.2501883804798126,
0.1958230435848236,
0.4846749007701874,
-0.19818688929080963,
0.0649786964058876,
-0.042514532804489136,
0.42697766423225403,
-0.2698591649532318,
-0.009933816269040108,
-0.42561474442481995,
-0.23059239983558655,
0.5084124803543091,
-0.34736159443855286,
0.076070144772... | |
something like this.
```
let <- function(...) {
args <- as.list(sys.call())[-1]
n <- length(args)
eval(args[[n]], args[-n])
}
let(a = 2, b = 3, a + b)
# [1] 5
``` | [
0.05034288391470909,
-0.10124427825212479,
0.3991129398345947,
-0.42970454692840576,
0.06437224894762039,
0.058382462710142136,
0.3450721502304077,
-0.6650981307029724,
-0.3753581643104553,
-0.1282779425382614,
-0.3697082996368408,
0.49824604392051697,
-0.47879570722579956,
0.0695394873619... | |
Does someone know how to write a program in C with the verbose option (the option to choose if messages are printed or not) in a nice way.
I mean, not writing an if(verbose) for each printf in the code.
Is there a more elegant solution?
Just use a (variadic) macro / vararg function that tests a flag before calling ... | [
0.379910409450531,
0.04374462366104126,
0.5318282246589661,
-0.16283591091632843,
0.031861644238233566,
0.0924886167049408,
0.3404521346092224,
-0.21988531947135925,
-0.4666747748851776,
-0.4422600269317627,
-0.21427688002586365,
0.6844016909599304,
-0.46245452761650085,
-0.004870079923421... | |
EDIT As requested
How about a slightly modified [gnu example](http://gcc.gnu.org/onlinedocs/cpp/Variadic-Macros.html):
```
#define eprintf(format, ...) do { \
if (ok_to_print) \
fprintf(stderr, format, ##__VA_ARGS__); \
} while(0)
``` | [
0.27814173698425293,
0.025485122576355934,
0.6802043318748474,
-0.02272990345954895,
0.04396147280931473,
-0.08741073310375214,
0.16329026222229004,
-0.383486270904541,
-0.26281026005744934,
-0.7014962434768677,
-0.45500707626342773,
0.6628618240356445,
-0.4800540804862976,
-0.001443715183... | |
I have a simple winforms app with one form, a few controls and a business object defined like this:
```
public class BusinessObject : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged(PropertyChangedEventArgs e)
{
if (PropertyChanged ... | [
-0.0888579711318016,
-0.21061824262142181,
0.6273338794708252,
0.03224043920636177,
0.48595109581947327,
0.05739104375243187,
0.14791429042816162,
-0.2627885937690735,
0.37929609417915344,
-0.557489812374115,
-0.17020654678344727,
0.9357615113258362,
-0.14981168508529663,
0.187132969498634... | |
{
get { return _phoneNumber; }
set
{
if (_phoneNumber == value)
{
return;
}
_phoneNumber = value; | [
-0.11351469904184341,
-0.2785576581954956,
0.643402099609375,
-0.2783299684524536,
0.43121522665023804,
0.09545443207025528,
0.390095591545105,
-0.30312156677246094,
0.3481573462486267,
-0.6194277405738831,
-0.6376501321792603,
0.9600045680999756,
-0.18852673470973969,
-0.24972952902317047... | |
OnPropertyChanged(new PropertyChangedEventArgs("PhoneNumber"));
}
}
```
On my form, I have a textbox that is bound to the PhoneNumber property via a binding source and the data source update mode is set to OnPropertyChanged. This all works as expected. I need to do some validation on the text before it ge... | [
0.14263644814491272,
0.13387314975261688,
1.0625793933868408,
-0.23342037200927734,
0.1901940554380417,
0.06594550609588623,
0.20953074097633362,
-0.2783297598361969,
-0.07965125888586044,
-0.3646043837070465,
-0.1113787591457367,
0.8921688199043274,
-0.32400810718536377,
-0.02091577649116... | |
error provider and set e.Cancel = true. Unfortunately, this doesn't prevent the invalid input from being bound to the PhoneNumber property. Is there an easy way to do this?
As suggested by mrlucmorin, I've changed my update data source mode from "OnPropertyChanged" to "OnValidation" so that the binding only occurs when... | [
0.1437249779701233,
0.07228202372789383,
0.46806320548057556,
-0.13069255650043488,
0.0002398378128418699,
-0.02874504216015339,
0.47322309017181396,
-0.20696240663528442,
0.05670055374503136,
-0.46567514538764954,
-0.0027251415885984898,
1.0482639074325562,
-0.38298943638801575,
0.0227098... | |
I was able to work around that by calling ValidateChildren() when a toolbar button is clicked. Thanks again to mrlucmorin and ImGreg for the suggestions that ultimately solved my problem! | [
0.2646605968475342,
0.23049280047416687,
0.4148108959197998,
0.27712762355804443,
-0.1845819056034088,
-0.06011323630809784,
0.46724146604537964,
0.24923691153526306,
-0.14751982688903809,
-0.446132630109787,
-0.05150115117430687,
0.3728399872779846,
0.531302809715271,
0.30129554867744446,... | |
Consider the following C++11 code where class `B` is instantiated and used by multiple threads. Because `B` modifies a shared vector, I have to lock access to it in the ctor and member function foo of `B`. To initialize the member variable `id` I use a counter that is an atomic variable because I access it from multipl... | [
0.09737866371870041,
-0.17430754005908966,
0.14329899847507477,
-0.2594108581542969,
0.02199937403202057,
0.10933700948953629,
0.07419045269489288,
-0.5551503896713257,
-0.31581979990005493,
-0.5187297463417053,
-0.15072472393512726,
0.3411179780960083,
-0.6765705943107605,
0.1589529812335... | |
: id(++counter) {
std::lock_guard<std::mutex> lock(barrier);
sharedResource.push_back(As{});
sharedResource[id].push_back(A("B()", id));
}
void foo() {
std::lock_guard<std::mutex> lock(barrier);
sharedResource[id].push_back(A("foo()", id));
}
private:
const size_t id;
}... | [
0.20298653841018677,
-0.005791184958070517,
0.1772170215845108,
-0.4603215456008911,
0.038359612226486206,
0.12485289573669434,
0.27190321683883667,
-0.8360596895217896,
-0.06563252955675125,
-0.5886300206184387,
-0.17048336565494537,
0.5543535351753235,
-0.4710071086883545,
0.342902868986... | |
mutex, it works:
```
struct B {
B() {
std::lock_guard<std::mutex> lock(barrier);
id = ++counter; // counter does not have to be an atomic variable and id cannot be const anymore
sharedResource.push_back(As{});
sharedResource[id].push_back(A("B()", id));
}
};
```
Can you please help me understandi... | [
0.31195780634880066,
0.16707760095596313,
0.37346747517585754,
-0.19594857096672058,
-0.04406176507472992,
0.0967910885810852,
0.2148175686597824,
-0.7408174872398376,
-0.07536955177783966,
-0.44449326395988464,
-0.023894309997558594,
0.6426429748535156,
-0.332364946603775,
0.1839446872472... | |
initialization of `id` takes place in the initializer list.
First, there's still a fundamental logic problem in the posted code.
You use `++ counter` as `id`. Consider the very first creation of `B`,
in a single thread. `B` will have `id == 1`; after the `push_back` of
`sharedResource`, you will have `sharedResource.si... | [
0.20547057688236237,
0.13108134269714355,
0.24491974711418152,
-0.205214262008667,
-0.1338367760181427,
-0.10659309476613998,
0.03313825652003288,
-0.44111356139183044,
0.008657743223011494,
-0.7412742376327515,
0.13561129570007324,
0.3210126459598541,
-0.32651007175445557,
0.4136643707752... | |
== 1
sharedResource.size() == 0
```
It is then interrupted by thread 2 (before it acquires the mutex), which
also increments `counter` (to 2), and uses its previous value (1) as
`id`. After the `push_back` in thread 2, however, we have only
`sharedResource.size() == 1`, and the only legal index is 0.
In practice, I ... | [
0.2971513271331787,
-0.14025910198688507,
0.5656092762947083,
-0.30011966824531555,
-0.10239319503307343,
-0.43936687707901,
0.1572161316871643,
-0.45627495646476746,
-0.32453256845474243,
-0.5383151769638062,
-0.23187753558158875,
0.813155472278595,
-0.18784761428833008,
0.514563500881195... | |
like:
```
B::B()
{
std::lock_guard<std::mutex> lock( barrier );
id = sharedResource.size();
sharedResource.push_back( As() );
// ...
}
```
Or if you want to make `id` const:
```
struct B
{
static int getNewId()
{
std::lock_guard<std::mutex> lock( barrier );
int results = sha... | [
0.32844799757003784,
-0.14474402368068695,
0.363350510597229,
-0.3523958623409271,
0.0683499127626419,
0.026998169720172882,
0.3561955392360687,
-0.7347325682640076,
-0.23783250153064728,
-0.7252321243286133,
-0.42069002985954285,
0.6651620268821716,
-0.39609694480895996,
0.239728376269340... | |
{
std::lock_guard<std::mutex> lock( barrier );
// ...
}
};
```
(Note that this requires acquiring the mutex twice. Alternatively, you
could pass the additional information necessary to complete updating
`sharedResource` to `getNewId()`, and have it do the whole job.) | [
0.13393589854240417,
-0.10316062718629837,
0.0734400600194931,
-0.14836078882217407,
0.1867956817150116,
-0.23135925829410553,
0.5409868955612183,
-0.17146483063697815,
-0.13461849093437195,
-0.727448046207428,
-0.4536285400390625,
0.6100706458091736,
-0.18326450884342194,
0.35105997323989... | |
I have an issue with saving passwords in Eclipse. None of my passwords are "remembered" and I've found Eclipse tries to save them in a folder my Windows account doesn't have access to.
It tries to save to
```
D:\Users\Administrator\.eclipse\org.eclipse.equinox.security\secure_storage
```
a directory that does not ... | [
0.1745932251214981,
0.30499520897865295,
0.010711411014199257,
-0.2363079935312271,
-0.06153067946434021,
-0.004522064700722694,
0.3103313446044922,
-0.09246499091386795,
-0.16617445647716522,
-1.043475866317749,
0.13978266716003418,
0.6730610132217407,
-0.09005927294492722,
0.188580483198... | |
elsewhere?
**edit**: so I found a solution here [What are the best JVM settings for Eclipse?](https://stackoverflow.com/questions/142357/what-are-the-best-jvm-settings-for-eclipse)
I added this to my eclipse.ini:
-eclipse.keyring
C:\some\path\file.txt
Which changed my target password storage file.
```
-Duser.hom... | [
0.2631250023841858,
-0.03347283974289894,
0.18569225072860718,
0.1471417248249054,
0.21084293723106384,
-0.03077108971774578,
0.073870450258255,
0.07702372968196869,
-0.24345406889915466,
-0.4740266799926758,
0.07473765313625336,
0.4696882367134094,
-0.09166210144758224,
-0.191112741827964... | |
Coming from the basic Java world I know there's a way to spawn a thread by creating a new Runnable and passing it to a new Thread and calling start on it. Something like:
```
Runnable r = new Runnable() {
@Override
public void run(){
}
}
new Thread( r ).start()
```
Now joining the Android world it seems th... | [
0.45951709151268005,
-0.02117270790040493,
0.17050369083881378,
-0.16682274639606476,
-0.02998138591647148,
-0.19865262508392334,
0.24218407273292542,
0.31587255001068115,
-0.4002571105957031,
-0.7467919588088989,
0.07191268354654312,
0.5402334332466125,
-0.4762443006038666,
0.240299314260... | |
spawning a new thread. I do see a lot cases such as:
```
Handler handler = new Handler()
handler.post( r )
```
Is there a good reason to use Handler to spawn a thread as opposed to creating a new Thread old way?
Thanks.
Yev
Check out the [AysncTask framework](http://developer.android.com/reference/android/os/AsyncT... | [
0.4983142614364624,
-0.23777316510677338,
0.011289799585938454,
0.11611146479845047,
-0.20692341029644012,
-0.13670727610588074,
0.35731402039527893,
0.2196948379278183,
-0.3209366202354431,
-0.7120020985603333,
0.24428044259548187,
0.34911012649536133,
-0.4735618829727173,
0.2332740873098... | |
I'm playing around with associative arrays right now and I can't
seem to figure out how to add additional objects to the array. I
tried insert but it doesn't recognize both arguments.
Also, if I do this it produces an error:
```
Node[bool] test;
Node node;
Node[bool] temp = [ false:node ];
test ~= temp;
//Error 1... | [
-0.05125417187809944,
0.26755571365356445,
0.03394821658730507,
-0.19536207616329193,
-0.1695086807012558,
0.15183091163635254,
0.4592225253582001,
-0.4617624580860138,
-0.11621470749378204,
-0.4717922508716583,
-0.25320595502853394,
0.42339032888412476,
-0.48691606521606445,
0.02332816086... | |
to another assoc array, loop over it, and reassign the elements.
```
foreach(k, v; temp) test[k] = v;
```
The why: Associative arrays are not lists; as the name suggests, they are, well, associative arrays. The append operator would make sense for consecutive list of elements. D's AAs are hash tables. | [
0.16267813742160797,
0.025669202208518982,
-0.1034160852432251,
-0.3465578258037567,
-0.24301449954509735,
0.15684810280799866,
0.27300751209259033,
-0.48138970136642456,
0.14092448353767395,
-0.2580842971801758,
-0.395751953125,
0.5316309332847595,
-0.6253193616867065,
-0.1232777610421180... | |
I'm new with RoR and I have a controller (`UsersController`) where I wish to verify the existence of a certain session before anything. Since the session verification code is the same for several methods and I don't want to repeat myself, I decided to make a new method in my controller to check the sessions:
```
class... | [
0.19045720994472504,
0.06204288825392723,
0.531889021396637,
-0.01827263832092285,
-0.014052916318178177,
-0.3362494707107544,
0.48099806904792786,
-0.16106416285037994,
-0.345501184463501,
-0.6597307324409485,
0.07654498517513275,
0.595207691192627,
-0.013794943690299988,
0.18554797768592... | |
# Does something
else
# Does something else
end
end
def edit
end
def create
end
def update
end
def destroy
end
def self.has_register_session?
# true or false
end
end
```
And when I run the page | [
0.3943071663379669,
0.2553771436214447,
0.71377032995224,
-0.15933208167552948,
-0.09536394476890564,
-0.29488804936408997,
0.9244125485420227,
-0.37848585844039917,
-0.06872677803039551,
-0.5775155425071716,
-0.04632672294974327,
0.6325446963310242,
-0.1569640338420868,
0.1690351068973541... | |
`/users/new`, I got this error:
```
undefined method `has_register_session?' for #<UsersController:0x1036d9b48>
```
Any idea?
`self` when you define the method refers to the `UsersController` class object, but within the instance method `new`, `self` refers to the *instance* of `UsersController`.
1. You can either ... | [
-0.0643751323223114,
0.13504387438297272,
0.1939886063337326,
-0.038869064301252365,
0.0849059596657753,
-0.23845356702804565,
0.18074440956115723,
-0.10024787485599518,
-0.34245234727859497,
-0.8297373056411743,
-0.008564422838389874,
0.6260309219360352,
-0.29425492882728577,
0.3150388002... | |
I'm sure the first response will be 'wtf, don't use arraylists!', but I'm really just trying to get this working in any way that I can.
It's basically the 'match looker' for a match 3 game. I'm having trouble getting access to the match data within the match list. See below..
```
public void FindAndRemoveMatches... | [
0.29699409008026123,
0.10291429609060287,
0.41148385405540466,
-0.19982893764972687,
0.1975465565919876,
-0.34553301334381104,
0.10671490430831909,
-0.2570021152496338,
-0.01848178543150425,
-0.8193493485450745,
0.05617520213127136,
0.7709218263626099,
-0.30013585090637207,
0.1540635675191... | |
// Debug.Log(el.ToString());
}
}
ArrayList LookForMatches(){
//List<int> matchList = new List<int>();
ArrayList matchList = new ArrayList();
// search for horizontal matches
// note that we're subtracting two rows here.
// We don't need to check the last two rows because we're matching 3.
... | [
-0.06335029751062393,
-0.24405182898044586,
0.5279353260993958,
-0.28460630774497986,
0.1307905912399292,
0.12601055204868317,
0.12836334109306335,
-0.7247413992881775,
-0.34100279211997986,
-0.6540533304214478,
-0.15954741835594177,
0.5698452591896057,
-0.2587788999080658,
-0.161998733878... | |
ArrayList match = GetMatchHoriz(i,j);
if (match.Count > 2) {
matchList.Add(match);
i += match.Count-1;
}
}
}
// search for vertical matches
for (int i = 0; i < BOARD_WIDTH; | [
-0.11452386528253555,
-0.4277588725090027,
0.7076358795166016,
-0.29870176315307617,
0.009746412746608257,
-0.11833211779594421,
0.02197633497416973,
-0.5987530946731567,
-0.25318390130996704,
-0.4721797704696655,
-0.21279200911521912,
0.451962947845459,
-0.3689698874950409,
-0.04502302780... | |
i++){
for (int j = 0; j < BOARD_HEIGHT-2; j++){
ArrayList match = GetMatchVert(i,j);
if (match.Count > 2) {
matchList.Add(match);
j += match.Count-1;
} | [
-0.07374308258295059,
-0.38840365409851074,
0.8873021006584167,
-0.3883637487888336,
-0.05371140316128731,
-0.2234593778848648,
0.09961433708667755,
-0.8110978603363037,
-0.20574742555618286,
-0.43016332387924194,
-0.3963907063007355,
0.356290340423584,
-0.40404945611953735,
-0.12897036969... | |
}
}
return matchList;
}
// look for horizontal matches starting at this point
ArrayList GetMatchHoriz(int col,int row){
ArrayList match = new ArrayList();
match.Add(mBoard[col,row]);
for(int i = 1; (col+i)<8; i++) {
if (mBoard[col,row] == mBoard[col+i,row]) {
if(mBoard[col+i,r... | [
-0.37182319164276123,
-0.31806644797325134,
0.9314648509025574,
-0.31714051961898804,
0.2169063836336136,
0.23452813923358917,
0.11048270761966705,
-0.5749819874763489,
-0.2118252068758011,
-0.6324573755264282,
-0.32884830236434937,
0.6391891837120056,
-0.6424611806869507,
-0.0595441646873... | |
}
}
return match;
}
// look for horizontal matches starting at this point
ArrayList GetMatchVert(int col,int row){
ArrayList match = new ArrayList();
match.Add(mBoard[col,row]);
for(int i = 1; (row+i)<8; i++) {
if (mBoard[col,row] == mBoard[col,row+i]) {
if(mBoard[col,row+i]... | [
-0.3540652096271515,
-0.31243446469306946,
0.898148775100708,
-0.34166282415390015,
0.18894760310649872,
0.26338309049606323,
0.10331644862890244,
-0.5849722623825073,
-0.1892894208431244,
-0.6472024917602539,
-0.2972696125507355,
0.6143275499343872,
-0.6167300343513489,
-0.038544870913028... | |
}
}
return match;
}
```
Good news is, I know that it's finding the matches correctly. The number of matches it's finding using the debug log correlates with what's happening on the screen. Yay! But, I need to get access to that data so I can compare it to the board (mBoard[col,row]) and remove those object... | [
0.11343314498662949,
0.27200886607170105,
0.2446018010377884,
0.01705108769237995,
0.20364826917648315,
-0.09178198873996735,
0.17214125394821167,
0.07313590496778488,
-0.13102039694786072,
-0.808904767036438,
0.19747239351272583,
0.7837346196174622,
-0.146981343626976,
0.13998255133628845... | |
select statement. That should be a lot faster so:
```
var result = from person in DB.Entities.Persons
.Include("District")
.Include("District.City")
.Include("District.City.State")
.Include("Nationality")
select new PersonViewModel()
{
Name = person.Name,
City = person.Distric... | [
0.04002310335636139,
-0.2167595624923706,
0.6433088183403015,
0.04748103395104408,
-0.0408545546233654,
0.17718984186649323,
-0.09706998616456985,
-0.2795959711074829,
-0.23958255350589752,
-0.6278042793273926,
-0.4017505347728729,
0.42652231454849243,
-0.11564627289772034,
0.0906268805265... | |
data for the PersonViewModel.
You might be able to further speed up things by creating a database view and letting Entity Framework select directly from there.
If you rally want the front-end to populate a grid with 500.000 records, then I'd remove the webservice layer altogether and use a DataReader to speed up th... | [
0.2107522040605545,
-0.3346261978149414,
0.5739290714263916,
0.45114845037460327,
-0.09965597838163376,
-0.022596074268221855,
-0.0778772234916687,
-0.28314387798309326,
-0.042035721242427826,
-0.6882989406585693,
0.23820650577545166,
0.6581199765205383,
-0.0904400646686554,
0.097681902348... | |
-> TDS -> UI
Then use EntityFramwork to handle the changes to the entities in your business logic. This is in line with the Command and Query Separation pattern. Use a technology suitable for high performance querying of data and link that directly to your app. Then use a command strategy to implement your business lo... | [
0.2523740828037262,
-0.23510290682315826,
0.5596168041229248,
0.28209319710731506,
-0.21260295808315277,
-0.08252425491809845,
0.066555455327034,
-0.24264706671237946,
-0.01941295526921749,
-0.9258816838264465,
-0.2590258717536926,
0.4896782636642456,
-0.2709258496761322,
0.008282474242150... | |
or direct access to the SQL database, consider materializing the objects yourself. Select the data directly from either a view or a query and use a `IDataReader` to directly populate your ViewModel. That will probably give you the highest performance.
There are a lot of alternatives to Entity Framework created especia... | [
0.21236646175384521,
-0.197102889418602,
0.2700410485267639,
0.2894969880580902,
-0.17268307507038116,
0.20245569944381714,
-0.06706957519054413,
-0.08946041762828827,
-0.07065176963806152,
-0.5797604918479919,
-0.08458536863327026,
0.6133438348770142,
-0.11952933669090271,
0.0072031016461... | |
Does such a thing exist anywhere? Basically I see java has LinkedHashSet but no type of navigatable hash set?
By its very nature, a hash-based data structure is not ordered. You can write wrappers which supplement it with an additional data structure (this is more or less what `LinkedHashMap` does). But while it makes ... | [
0.19339963793754578,
0.08233072608709335,
-0.20074978470802307,
0.2900230586528778,
-0.1611492931842804,
-0.43096864223480225,
0.16222552955150604,
0.1368630826473236,
-0.5006843209266663,
-0.42523467540740967,
-0.07195540517568588,
0.04958967864513397,
-0.6586305499076843,
0.2486421912908... | |
the case of set plus list, which differ more than two different set implemnentations). So the best solution is to just use `TreeSet` or another `SortedSet` if you need order. | [
-0.3003898561000824,
-0.5673536658287048,
0.01108781062066555,
0.03505966067314148,
-0.3793185353279114,
-0.220919668674469,
0.023314889520406723,
-0.38371196389198303,
-0.4734886884689331,
-0.5917821526527405,
-0.43249690532684326,
0.3697068691253662,
-0.7580245733261108,
-0.2010265588760... | |
My intention is to create a list of news, and there will be attached a thumbnail (news\_teaserimage) to some of the news. The problem is that if I only pick medias in some of the nodes, I get an xslt-error, and no code will be generated. If i pick medias in all nodes, then it works.. The intention is that the code will... | [
0.23357588052749634,
-0.09454429894685745,
0.4944053590297699,
0.19801293313503265,
0.05957949161529541,
0.035626668483018875,
0.14055955410003662,
-0.055266667157411575,
-0.17724153399467468,
-0.811609148979187,
-0.0934109017252922,
0.6365643739700317,
-0.4116817116737366,
0.3551126420497... | |
<xsl:variable name="media" select="umbraco.library:GetMedia(news_teaserimage, 0)"/>
>
> <li>
> <h2><xsl:value-of select="@nodeName"/></h2>
> <h5><xsl:value-of select="@createDate"/></h5>
>
> <xsl:if test="news_teaserimage">
> <img src="{$media/umbracoFile}" width="70" height="70" style="float: left; padding... | [
-0.003365001641213894,
-0.16697590053081512,
0.469113826751709,
0.18432706594467163,
-0.0031258745584636927,
-0.09250694513320923,
0.06619245558977127,
-0.2299482226371765,
-0.023685013875365257,
-0.5454902052879333,
-0.07108046859502792,
0.3555060029029846,
-0.26754748821258545,
0.0333555... | |
just found an explanation on the internet: <http://activemq.2283324.n4.nabble.com/Consumer-is-not-able-to-pick-messages-from-queue-td2531722.html>
Apparently there is a page size that can get filled when you have a selector and all the messages are in the same queue. This was happening for us - I hadn't started the co... | [
0.09164538234472275,
-0.43322768807411194,
0.28083667159080505,
-0.006941583473235369,
-0.1349957287311554,
0.2448652684688568,
-0.05501190200448036,
0.2643939256668091,
-0.6652544140815735,
-0.3032611012458801,
0.3854369819164276,
0.08746593445539474,
-0.1513470858335495,
0.36389732360839... | |
Consider this class:
```
class test
{
public function __set($n, $v)
{
echo "__set() called\n";
$this->other_set($n, $v, true);
}
public function other_set($name, $value)
{
echo "other_set() called\n";
$this->$name = $value;
}
public function t()
{
... | [
0.46473151445388794,
-0.04660918563604355,
-0.3956747055053711,
-0.39723044633865356,
0.09303709864616394,
-0.06282247602939606,
0.4199986755847931,
-0.5433761477470398,
0.26608991622924805,
-0.23069819808006287,
-0.19269824028015137,
0.5340837240219116,
-0.5582794547080994,
0.121578633785... | |
}
}
```
I am overloading PHP's magic [`__set()`](http://www.php.net/manual/en/language.oop5.overloading.php#object.set) method. Whenever I set a property in an object of the `test` class, it will call `__set()`, which in turn calls `other_set()`.
```
$obj = new test;
$test->prop = 10;
/* prints the following */
__... | [
0.38380375504493713,
0.18644963204860687,
0.2092309445142746,
-0.2107449620962143,
0.05156109854578972,
-0.3014194667339325,
0.5345718264579773,
-0.385652631521225,
-0.12046539783477783,
-0.3521544337272644,
-0.014368318021297455,
0.5863543748855591,
-0.39756810665130615,
0.257597297430038... | |
name.](https://github.com/php/php-src/blob/PHP-5.5.16/Zend/zend_object_handlers.c#L58) If it (or anything it calls) attempts to set the same property, PHP won't call `__set` again -- it'll just set the property on the object. | [
0.3808104693889618,
0.06370852142572403,
0.18232941627502441,
-0.04031797870993614,
0.045824602246284485,
-0.30463290214538574,
0.06785093247890472,
-0.27288952469825745,
-0.48668110370635986,
-0.22984440624713898,
-0.21315231919288635,
0.395064115524292,
-0.4114547073841095,
0.51750546693... | |
<http://oeis.org/A005773>
I looked into that page but most of the abbreviations didn't make any sense.
> G.f.: 2x/(3x-1+sqrt(1-2x-3x^2)) - Len Smiley
> (smiley(AT)math.uaa.alaska.edu).
Does G.f implies generating function?. Substituting any values for x almost yields a square root of a negative number(imaginary). H... | [
0.1190851554274559,
0.13097111880779266,
0.3833923041820526,
0.06719810515642166,
-0.4386196732521057,
0.17354479432106018,
0.17034222185611725,
-0.03862932696938515,
-0.2386227250099182,
-0.3672538995742798,
0.13242271542549133,
0.1548708975315094,
-0.5219424366950989,
0.1613651067018509,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.