text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
is implemented. Your code should be fine, as commented.
**after you added some context**
Your `test` function is not in the `Files` namespace. If you want it to be in the global context, you should treat it as "`::test`" within the namespace, otherwise the compiler might expect the "`Files::test`" to be the friend fu... | [
-0.047410331666469574,
0.08149450272321701,
0.03632599860429764,
-0.09951597452163696,
0.1638803482055664,
-0.35497304797172546,
0.5792325139045715,
0.08574452251195908,
-0.039633046835660934,
-0.6911163926124573,
-0.09716133028268814,
0.5299058556556702,
-0.29994648694992065,
-0.222128599... | |
Apologies if this has already been addressed at <https://groups.google.com/forum/embed/?place=forum/google-documents-list-api#!forum/google-documents-list-api>, but I'm not seeing the search facility there, perhaps because the forum's been closed.
I'm probably missing something, but based on <https://developers.google... | [
0.17297737300395966,
0.41376930475234985,
0.4423622786998749,
0.1977568119764328,
-0.31752246618270874,
-0.4247836768627167,
0.4009535610675812,
-0.3183496594429016,
-0.41916677355766296,
-0.4516770839691162,
-0.1306644082069397,
0.5113052725791931,
0.02072731778025627,
0.19281111657619476... | |
"know" what the class is, i.e.: the header that has the class definition should be included in the file where the function is implemented. Your code should be fine, as commented.
**after you added some context**
Your `test` function is not in the `Files` namespace. If you want it to be in the global context, you shou... | [
0.27425912022590637,
0.009988934732973576,
0.0030273974407464266,
0.16928347945213318,
0.22420524060726166,
-0.4716261923313141,
0.34737998247146606,
0.08585385233163834,
0.13528890907764435,
-0.64607173204422,
0.08588551729917526,
0.5496487617492676,
-0.08966301381587982,
0.02175004966557... | |
forward declaration here, so there's no default fall-back to the upper level of scope for name resolution. | [
-0.2500121593475342,
0.01664448156952858,
0.20575758814811707,
-0.15255481004714966,
-0.39690929651260376,
-0.052177876234054565,
0.08162065595388412,
-0.2918035387992859,
-0.40411895513534546,
-0.2644099295139313,
-0.3181694746017456,
0.1739450842142105,
0.16875508427619934,
0.39516910910... | |
How would I go about programming a daily message on my site that changes daily? I'm thinking of preloading all the messages in a MySQL database.
Any help would be appreciated!
Thanks,
I've tried
```
$msg_sql = "SELECT * FROM ".TABLE_PREFIX."quotes ORDER BY rand(curdate()) LIMIT 3";
$msg_res = mysqli_fetch_assoc(mys... | [
0.39487698674201965,
0.019978737458586693,
0.6162516474723816,
0.05715936794877052,
-0.06443613767623901,
0.4329979717731476,
0.24478580057621002,
0.21072453260421753,
-0.5413393378257751,
-0.7506557703018188,
-0.017126133665442467,
0.4876148998737335,
-0.359286367893219,
0.298715949058532... | |
digit month number and DD is a 2 digit day number).
Then, the only thing you need to do in order to display your motd is:
> ```
> $filename = '/var/www/motds/'.date("Y-m-d").'.txt';
> if (file_exists($filename)) {
> echo file_get_contents($filename);
> }
>
> ```
If you want your daily messages to be taken from ... | [
0.2155291885137558,
0.00965220294892788,
0.9393377304077148,
-0.28665441274642944,
0.14934398233890533,
-0.010690505616366863,
0.39840883016586304,
-0.11459086090326309,
-0.3850107789039612,
-0.637431263923645,
-0.30920520424842834,
0.31984174251556396,
-0.1974649876356125,
0.1441902816295... | |
$messagecount) + 2]);
``` | [
-0.22090992331504822,
0.0076277414336800575,
0.3372156322002411,
-0.6848433017730713,
0.12930119037628174,
-0.09535206109285355,
0.3715033531188965,
-0.1640009582042694,
0.0008296987507492304,
-0.552134096622467,
-0.2640303075313568,
0.657668948173523,
-0.6032362580299377,
0.09529170393943... | |
1) Is it possible to create a vector of strings in stata? 2) If yes, is it then possible to loop through the elements in this vector, performing commands on each element?
To create a single string in stata I know you do this:
```
local x = "a string"
```
But I have about 200 data files I need to loop through, a... | [
0.16035917401313782,
-0.18564677238464355,
0.11275641620159149,
0.10780316591262817,
-0.07021881639957428,
-0.17822358012199402,
0.10621000081300735,
-0.25580063462257385,
-0.4141674339771271,
-0.2766122817993164,
0.03997700288891792,
0.2192874699831009,
-0.43031010031700134,
-0.0729003027... | |
cut and paste into a string vector, and then call the elements of this vector one by one, as one might do in MATLAB.
Is there a way to do this in stata?
Sure -- You just create a list using a typical local call. If you don't put quotes around the whole thing your lists can be really long.
```
local mylist aaa bbb "cc... | [
0.40541666746139526,
-0.043887149542570114,
0.13060691952705383,
0.07840301841497421,
-0.15961427986621857,
0.15312892198562622,
-0.15326686203479767,
-0.012479404918849468,
-0.3724280297756195,
-0.5567171573638916,
0.016043316572904587,
0.45938464999198914,
-0.46249425411224365,
-0.090148... | |
a touch faster than putting `foreach filename in `mylist' {` on the first line.
If you want to manipulate your list, see [`help macrolists`](http://www.stata.com/help.cgi?macrolists).
Related questions have been asked >1 time on stackoverflow:
* [In Stata how do you assign a long list of variable names to a local m... | [
-0.2884454131126404,
-0.29751259088516235,
0.579126238822937,
-0.12995482981204987,
-0.04866921901702881,
-0.053507015109062195,
0.03589259088039398,
-0.27979496121406555,
-0.3798244893550873,
-0.5583005547523499,
-0.027912301942706108,
0.5486665964126587,
-0.17193184792995453,
-0.14407962... | |
On the XML below, I'm using the `SelectSingleNode` of `XmlDocument` to pull out the result value.
```
evtASxml.SelectSingleNode(@"//@value").Value
```
returns the value of the first "value."
```
evtASxml.SelectSingleNode(@"//Result/@value").Value
```
raises a null exception.
Could someone explain what's going on... | [
-0.39780834317207336,
0.07300998270511627,
0.44962677359580994,
0.238582581281662,
0.14478962123394012,
-0.04815157502889633,
0.07227334380149841,
-0.27393102645874023,
-0.3322400152683258,
-0.3783881962299347,
-0.18987341225147247,
0.4793078303337097,
-0.10630331933498383,
0.2553364932537... | |
subjectName="www.example.com" />
<CertificateChain chainRef="{f00f00-f00-f00-f00-f00f00f00f00}" />
<Flags value="0" />
<SSLAdditionalPolicyInfo authType="server" serverName="example.com">
<IgnoreFlags value="0" />
</SSLAdditionalPolicyInfo>
<Status chainIndex="0" elementIndex="0" />
<EventAuxInfo Proc... | [
-0.03546766936779022,
0.031217435374855995,
0.943612813949585,
-0.02419257164001465,
-0.0478181429207325,
-0.10549963265657425,
0.17293156683444977,
-0.4136456549167633,
-0.3494091033935547,
-0.6107311844825745,
0.0999370664358139,
0.3903575539588928,
-0.03174169361591339,
0.17670997977256... | |
I have an Image inside UIScrollView which i can zoom in and out.
I have a button that let the user rotate the Image 90 degrees:
```
(void)RotateImage {
CGAffineTransform rotateTrans = CGAffineTransformMakeRotation(-90.0 / 180.0 * 3.14);
BaseImg.transform = rotateTrans;
}
```
After the imaged is rotated i can... | [
0.3493193984031677,
0.03199049085378647,
0.7734975218772888,
-0.22579631209373474,
0.055141549557447433,
-0.023430773988366127,
0.1618785709142685,
-0.047479402273893356,
-0.13291597366333008,
-0.5494387149810791,
0.1386716067790985,
0.6680183410644531,
-0.26736173033714294,
0.210652366280... | |
view.
2. Create a UIView subclass that displays an image within a sublayer.
To **rotate the image**, see [How to Rotate a UIImage 90 degrees?](https://stackoverflow.com/questions/1315251/how-to-rotate-a-uiimage-90-degrees). If you're always and only doing 90 degree rotation, see [@Peter Sarnowski's solution](https://s... | [
0.0007033368456177413,
-0.3338799774646759,
0.8304142355918884,
-0.22137199342250824,
-0.2929348945617676,
-0.013686484657227993,
0.07197081297636032,
-0.14778904616832733,
-0.35441043972969055,
-0.5932621359825134,
-0.25172486901283264,
0.45840588212013245,
-0.16409943997859955,
0.0801006... | |
anticlockwise order.
If the image is not square, you may also need to resize `baseImg` to reflect its new aspect ratio.
To **create a UIView subclass**, you need to have it store a `CALayer` as a sublayer of the view layer. Store the image in the sublayer, and transform the sublayer at will. This is faster, and allow... | [
0.4120675325393677,
-0.2819060683250427,
0.9589661359786987,
-0.05989322438836098,
-0.25956442952156067,
0.08563309162855148,
-0.05652748420834541,
-0.24914048612117767,
0.06590868532657623,
-0.7464099526405334,
-0.021717006340622902,
0.49730831384658813,
-0.1062173992395401,
0.20033572614... | |
I am wondering how to build a join table articles\_categories, but one where there can only be one category per article. I know the typical way to do categories is to allow multiple categories for each article with has\_and\_belongs\_to\_many, but I'd like only allow one category per article. I have already set up my a... | [
0.21577122807502747,
0.41373395919799805,
0.36334502696990967,
-0.027974141761660576,
-0.35402166843414307,
-0.2586250603199005,
0.17759522795677185,
-0.14376838505268097,
-0.3053540885448456,
-0.6267817616462708,
0.2476518750190735,
0.5068557858467102,
-0.25033140182495117,
0.237180516123... | |
articles model to has\_one :category and the category model to has\_many :articles, but I get an error while testing in irb:
```
a = Article.first
a.category
```
The error is:
```
Category Load (0.7ms) SELECT "categories".* FROM "categories" WHERE "categories"."article_id" = 1500 LIMIT 1
PG::Error: ERROR: column... | [
0.08874745666980743,
0.17140604555606842,
0.8114703893661499,
0.021786727011203766,
0.05393029749393463,
-0.24890826642513275,
0.02176039293408394,
-0.4573592245578766,
-0.4292178750038147,
-0.49580344557762146,
0.028039870783686638,
0.6588751077651978,
-0.4105367362499237,
0.2282427996397... | |
call `article.category`. It will automatically look for column `<relation name>_id` which should point to record in `<relation name>` | [
-0.06724362075328827,
0.3164995014667511,
0.7362291216850281,
-0.0010547864949330688,
-0.12653423845767975,
-0.3001173734664917,
-0.09072699397802353,
-0.23049235343933105,
-0.1911366730928421,
-0.2524445056915283,
-0.29272159934043884,
0.48482730984687805,
-0.33737146854400635,
0.28538244... | |
OK, in this program I am required to make a table based of user input. The problem is I cannot figure out how to get the table headers to properly align with the information that is displayed. The table headers would not line up from lets say if the user enters in Michael for player one and Michael Jordan for player 2.... | [
0.10162925720214844,
0.6276814341545105,
0.22559712827205658,
-0.12383371591567993,
0.12578818202018738,
0.08573645353317261,
0.050725892186164856,
-0.07222546637058258,
-0.3166451156139374,
-0.8282301425933838,
0.22396130859851837,
0.49226391315460205,
-0.5052900910377502,
-0.524617969989... | |
string name; //player name
int playerNum, //player number
pointsScored; //points scored
};
int main()
{
int index, //loop count
total = 0; //hold total points
const int numPlayers = 5; //nuymber of players
BasketballPlayerInfo players[numPlayers]; //Array of players
//ask user fo... | [
-0.4951584041118622,
-0.07488694787025452,
0.4032624661922455,
-0.18398645520210266,
0.04960821196436882,
0.12061794102191925,
-0.03550831973552704,
-0.05143018066883087,
-0.447670578956604,
-0.5361784100532532,
-0.24002648890018463,
0.28860563039779663,
-0.18041865527629852,
0.33282756805... | |
{
//collect player name
cout << " " << endl;
cout << "Enter the name of player # " << (index + 1);
cout << ": ";
//input validation
if(!(getline(cin, players[index].name)))
{
cout << "Player Name must | [
0.05261782184243202,
-0.2544896602630615,
0.5522753596305847,
-0.3230944275856018,
0.22892478108406067,
-0.1812976747751236,
-0.28801605105400085,
-0.38695594668388367,
-0.24572528898715973,
-0.24058577418327332,
-0.5530557632446289,
0.4517933428287506,
-0.24880868196487427,
0.102065831422... | |
be alphabetical characters only!\n";
cout << "Program terminating please start over." << endl;
system("pause");
exit(0);
}
//getline(cin, players[index].name);
//collect players number
cout << "Enter the number of player # " << (index + 1); | [
-0.3014736771583557,
-0.39920496940612793,
0.5774166584014893,
-0.36412009596824646,
0.2720329761505127,
0.14023371040821075,
-0.3345324397087097,
-0.10860949009656906,
-0.33112743496894836,
-0.49999475479125977,
-0.5077676773071289,
0.3717368543148041,
-0.3455771207809448,
0.0972313135862... | |
cout << ": ";
//input validation
if(!(cin >> players[index].playerNum))
{
cout << "Player Name must be numeric characters only!\n";
cout << "Program terminating please start over." << endl;
system("pause");
exit(0); | [
-0.34395816922187805,
-0.12856628000736237,
0.5278304815292358,
-0.5004072785377502,
0.3857394754886627,
0.04670305922627449,
-0.20519976317882538,
0.03845702111721039,
-0.028146199882030487,
-0.33144116401672363,
-0.7291542291641235,
0.3985263407230377,
-0.1426510512828827,
0.410465836524... | |
}
//collect points scored
cout << "Enter points scored for player # " << (index + 1);
cout << ": ";
//input validation
if(!(cin >> players[index].pointsScored))
{
cout << "Player Name must be numeric characters only!\n"; | [
-0.4267430007457733,
-0.010664131492376328,
0.21038657426834106,
-0.2862197160720825,
0.19374611973762512,
0.06470181047916412,
-0.20569251477718353,
-0.15426574647426605,
-0.0021103944163769484,
-0.30926090478897095,
-0.5039774775505066,
0.429906964302063,
-0.1005512997508049,
-0.15625615... | |
cout << "Program terminating please start over." << endl;
system("pause");
exit(0);
}
cin.ignore();
}
//display
cout << "\n";
cout << "Here is the information for each player: \n";
cout << fixed << showpoint << setprecision(2);
cout << "\n";
cout | [
-0.13563087582588196,
-0.14458249509334564,
0.6292240023612976,
-0.502701997756958,
0.19166027009487152,
0.18870426714420319,
-0.33301159739494324,
0.09772910177707672,
0.02040795050561428,
-0.7186679840087891,
-0.4899400770664215,
0.4018094539642334,
-0.4608062207698822,
0.216226056218147... | |
<< " \tName\tNumber\tPoints\n";
cout << "------------------------------------------------" << endl;
for(index = 0; index < numPlayers; index++)
{
cout << "Player # " << (index + 1);
cout << ": \t" << players[index].name << "\t" << players[index].playerNum << "\t" << players[index].... | [
-0.5501600503921509,
-0.30827468633651733,
0.5774281620979309,
-0.19391174614429474,
-0.12037001550197601,
-0.006592164281755686,
-0.2626895010471344,
-0.20623616874217987,
-0.43863481283187866,
-0.5406468510627747,
-0.12024969607591629,
0.24772614240646362,
-0.05410927161574364,
0.0123912... | |
for(index = 0; index < numPlayers; index++)
{
//hold total
total += players[index].pointsScored;
}
cout << "Total Points scored are: " << total << endl;
system("pause");
return 0;
}
```
As stated in the documentation:
> Note: Creating a main window without a central widget is not suppo... | [
-0.30546900629997253,
-0.2076663076877594,
0.4750865697860718,
0.013309781439602375,
0.06022084876894951,
-0.3488209545612335,
0.021842431277036667,
0.1021813154220581,
-0.4340204894542694,
-0.5586775541305542,
-0.31739261746406555,
0.20170733332633972,
-0.19068288803100586,
0.367867469787... | |
I have a problem here that requires to design a data structure that takes O(lg n) worst case for the following three operations:
```
a) Insertion: Insert the key into data structure only if it is not already there.
b) Deletion: delete the key if it is there!
c) Find kth smallest : find the ݇k-th smallest key in ... | [
-0.3415360152721405,
0.1381581425666809,
0.14447520673274994,
-0.17620253562927246,
0.06777441501617432,
0.058562859892845154,
0.15746130049228668,
-0.28372639417648315,
-0.19208931922912598,
-0.6131954789161682,
-0.26250043511390686,
0.28550010919570923,
-0.2748022973537445,
0.30125564336... | |
with the c) part.
Anyone has any idea please share.
Two solutions come in mind:
* Use a balanced binary search tree (Red black, AVG, Splay,... any would do). You're already familiar with operation (1) and (2). For operation (3), just store an extra value at each node: the total number of nodes in that subtree. You co... | [
0.01337648555636406,
-0.04532846435904503,
0.11780344694852829,
-0.0019854719284921885,
0.1771010458469391,
0.3724575340747833,
-0.05555623769760132,
-0.26533442735671997,
-0.26652809977531433,
-0.4094299376010895,
-0.16986076533794403,
0.04729234054684639,
-0.2885013222694397,
0.287244766... | |
suppose you want to find the 8th smallest element, you know you should go to the right side.
* Use a skip list. It also supports all your (1), (2), (3) operations for O(logn) on average but may be a bit longer to implement. | [
-0.1731996387243271,
-0.1403532177209854,
0.03243478387594223,
-0.15144462883472443,
0.3456687033176422,
0.010895430110394955,
0.26988038420677185,
-0.18514716625213623,
-0.47148340940475464,
-0.4499252736568451,
-0.09600367397069931,
0.1629902571439743,
-0.2080307900905609,
-0.31479588150... | |
I'm new to MCV and I'm learning MVC3. I created a model and a controller and view was generated for me. The generated code makes perfect sense to me. I wanted to modify the generated view and controller so that I could upload a file when I "create" a new record. There is a lot of good information out there about how to... | [
0.20073209702968597,
-0.01015173364430666,
0.6597816944122314,
0.04082746431231499,
-0.08220963180065155,
-0.14158786833286285,
-0.08447897434234619,
-0.6118698120117188,
-0.5663724541664124,
-0.707206130027771,
0.15245001018047333,
0.5541447401046753,
-0.02963372878730297,
0.2762671709060... | |
and view from scratch, in the same project (no model), the example works just fine. I just can't add that functionality to the generated page. Basically, I'm trying get the Create action to also send the file. For example, create a new product entry and send the picture with it.
Example Create view:
```
@model Produc... | [
0.13733063638210297,
-0.0814143493771553,
0.5329871773719788,
-0.013013392686843872,
-0.23935604095458984,
0.31103119254112244,
-0.04515302926301956,
-0.4338611662387848,
-0.1890842765569687,
-0.6675364375114441,
0.09640105068683624,
0.6300941109657288,
-0.0432761088013649,
-0.015011318027... | |
@Html.LabelFor(model => model.Title)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Title)
@Html.ValidationMessageFor(model => model.Title)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.Description)
</div>
<div class="editor-field">
... | [
-0.1834569126367569,
0.02176152542233467,
0.44450312852859497,
0.14459362626075745,
-0.22996583580970764,
0.0688454657793045,
-0.017159296199679375,
-0.7249612808227539,
-0.17804884910583496,
-0.33221176266670227,
-0.1596221923828125,
0.20371153950691223,
-0.11617065966129303,
0.0564147680... | |
</p>
</fieldset>
}
<div>
@Html.ActionLink("Back to List", "Index")
</div>
```
Example Controller:
```
[HttpPost]
public ActionResult Create(Product product)
{
if (ModelState.IsValid)
{
if (Request.Files.Count > 0 && Request.Files[0] != null)
{
... | [
0.0526716373860836,
-0.7623971104621887,
0.682094395160675,
-0.01876458339393139,
0.21472810208797455,
0.11112465709447861,
0.18633319437503815,
-0.4560365676879883,
-0.42042282223701477,
-0.470898300409317,
-0.21883229911327362,
0.32836419343948364,
-0.3271542489528656,
0.1384557634592056... | |
}
db.Products.Add(product);
db.SaveChanges();
return RedirectToAction("Index");
}
return View(find);
}
```
This will create the record just fine but there are not files associated with the Request.
I've also tried a controller action like this:
```
[H... | [
0.09393813461065292,
-0.3068685233592987,
0.3477857708930969,
-0.15624208748340607,
-0.1387508362531662,
-0.21455977857112885,
0.40017154812812805,
-0.40532270073890686,
-0.01425840426236391,
-0.6565048098564148,
-0.1045801043510437,
0.3442875146865845,
-0.43492749333381653,
0.344810038805... | |
{
if (file.ContentLength > 0)
{
//Not getting here
}
return RedirectToAction("Index");
}
```
I'm wondering if maybe you can't post a file at the same time as posting form fields? If that is the case, what are some patterns for creating a new record and associating a pi... | [
0.5595292448997498,
-0.04248644411563873,
0.3057897686958313,
0.11767491698265076,
-0.2271978259086609,
-0.4899100959300995,
0.3810693323612213,
0.15161336958408356,
-0.37476596236228943,
-0.7502728700637817,
-0.01470336876809597,
0.4066696763038635,
-0.27327924966812134,
0.184995278716087... | |
return objects with non-trivial destructors:
> In some cases, the compiler will not inline a particular function for mechanical reasons. For example, the compiler will not inline:
> * A function if it would result in mixing both SEH and C++ EH.
> * Some functions with copy constructed objects passed by value when -GX/... | [
-0.02660524845123291,
0.10608381032943726,
0.20999985933303833,
-0.12471281737089157,
-0.3781836926937103,
0.18154864013195038,
0.4954797923564911,
-0.2830381989479065,
0.020551349967718124,
-0.41249001026153564,
-0.2635529935359955,
0.4628770649433136,
-0.6400645971298218,
0.1002877652645... | |
I have a web service hosted on azure as a web role.
In this web role I override the Run() method and perform some db operations in the following order to basically act as a worker role.
1. go to blob storage to pull a small set of data.
2. Cache this data for future use.
3. Kill some blobs that are too old.
4. > ```
... | [
0.46406057476997375,
-0.10810811072587967,
0.3351938724517822,
-0.12816302478313446,
-0.2337740808725357,
-0.11604634672403336,
0.4971805810928345,
-0.12963810563087463,
0.017280789092183113,
-0.8940173387527466,
0.0443539060652256,
0.3546808660030365,
-0.14240099489688873,
0.1862157583236... | |
Never actually starting up either instance.
I have enabled diagnostics and it isn't showing me anything to suggest there is a problem.
I'm at a loss for why this could be happening.
I don't typically like to answer my own question when someone else has made an effort to help me however I feel that the approach I used ... | [
0.06107574701309204,
-0.27286815643310547,
-0.019150713458657265,
0.29359304904937744,
-0.23356059193611145,
-0.27272096276283264,
0.34129878878593445,
0.4197806715965271,
-0.038633301854133606,
-0.8609569072723389,
0.2804672122001648,
0.5570923089981079,
-0.023149432614445686,
-0.02521194... | |
to anyone seeing an inconsistency between deploying devfabric and deploying to azure. | [
0.24768932163715363,
-0.21214540302753448,
0.31097474694252014,
0.39584386348724365,
-0.0009555693832226098,
-0.11485055088996887,
0.20437069237232208,
0.32189813256263733,
-0.12491481751203537,
-0.5511970520019531,
-0.2328311651945114,
0.3922637403011322,
-0.13453666865825653,
0.067831091... | |
I know from Algebra class that with ABC and 123 we can make 216 different permutations for a three letter string, right? (6 x 6 x 6) I'd like to create a console program in C++ that displays ever possible permutation for the example above. The thing is, how would I even begin trying to calculate them. Perhaps:
AAA
BAA... | [
0.6848872900009155,
0.5478457808494568,
-0.05032024160027504,
-0.17920513451099396,
-0.3784322738647461,
0.2368401139974594,
0.2807829678058624,
-0.11379745602607727,
-0.42636609077453613,
-0.21880292892456055,
0.2295464277267456,
0.04147239029407501,
-0.3579517900943756,
0.303512483835220... | |
appreciated!!!
If you need a fixed-number strings, you can use `N` nested loops (three in your case).
```
string parts = "ABC123";
for (int i = 0 ; i != parts.size() ; i++)
for (int j = 0 ; j != parts.size() ; j++)
for (int k = 0 ; k != parts.size() ; k++)
cout << parts[i] << parts[j] << parts[... | [
-0.05506579950451851,
0.0016740387072786689,
0.27805596590042114,
-0.31443047523498535,
0.15601329505443573,
0.21327021718025208,
0.4750744104385376,
-0.41378262639045715,
-0.3251899778842926,
-0.4766484498977661,
-0.3264070451259613,
0.5013983845710754,
-0.14998334646224976,
-0.2866671681... | |
How do I use an unevaluated (and/or possibly undefined) variable as a parameter for a function? For example:
```
function myFun(a:int):void {
a = 5;
}
```
If you are familiar with Mathematica it would be equivalent to:
```
f[a_Integer]:=a=5
Attributes[f]={HoldAll};
```
The core idea being that it is the varia... | [
0.1334766298532486,
0.03499956056475639,
0.21571165323257446,
-0.06164661794900894,
-0.1598920226097107,
-0.096534863114357,
0.15297304093837738,
-0.2821859121322632,
-0.24711816012859344,
-0.24683183431625366,
-0.12991394102573395,
0.5880908370018005,
-0.30596864223480225,
0.2774527072906... | |
my_fun("a");
}
```
According to these guys: [get string representation of a variable name in as3](https://stackoverflow.com/questions/8437580/get-string-representation-of-a-variable-name-in-as3) if it's a classe you can get it's name. If it's a local variable you cannot, the reason is probably related with effici... | [
0.09654980152845383,
0.08311916887760162,
0.06793506443500519,
-0.06027950718998909,
-0.18825817108154297,
-0.22509685158729553,
0.37569084763526917,
0.2553240656852722,
-0.6989468932151794,
-0.27482953667640686,
-0.23184770345687866,
0.55087810754776,
-0.056910257786512375,
0.191593185067... | |
I've spent about 16 hours researching and attempting different code changes, but cannot figure this one out. I have an iOS app that consumes a website using ASIHTTPrequest:
```
-(void)refresh{
NSURL *url = [NSURL URLWithString@"http://undignified.podbean.com/"];
ASIHTTPRequest *request = [ASIHTTPRequest reque... | [
0.17450907826423645,
0.31526127457618713,
0.42330822348594666,
-0.20894841849803925,
0.011033791117370129,
0.07189159095287323,
0.429756760597229,
-0.12038369476795197,
0.03982255235314369,
-0.9057629704475403,
-0.1536494344472885,
0.6720783114433289,
-0.16690024733543396,
0.18575422465801... | |
array and finally load the mp3 URLs into a UITableView.
To summarize:
1. Consuming website data with ASIHTTPRequest
2. Trying to search through the responseString for all links that have \*.mp3 extensions and load them into an array.
3. Add parsed links to UITableView.
I think at this junction I have attempted too ... | [
0.12345339357852936,
-0.04780915006995201,
0.723107635974884,
-0.051887147128582,
-0.79360032081604,
-0.03655451536178589,
0.03753633424639702,
-0.5522119402885437,
-0.4232041835784912,
-0.612887442111969,
-0.1402333378791809,
0.6637239456176758,
-0.3120432198047638,
-0.06404116004705429,
... | |
mp3 files:
```
a href="http://undignified.podbean.com/mf/web/ih2x8r/UndignifiedShow01.mp3" target="new"><img src="http://www.podbean.com/wp-content/plugins/podpress/images/audio_mp3_button.png" border="0" align="top" class="podPress_imgicon" alt="icon for podbean" /></a> Standard Podcasts [00:40:24m]: <a... | [
-0.33516865968704224,
-0.04710942506790161,
0.7565957307815552,
-0.1442861557006836,
-0.14707112312316895,
0.2800751328468323,
0.13843968510627747,
-0.5314921736717224,
-0.5103247165679932,
-0.5694891810417175,
-0.5333995223045349,
0.6861046552658081,
-0.39063334465026855,
0.03374516591429... | |
I am wondering if when you get a list of tokens back from apple's push feedback service, are these specific to only the app that made the call (using that app's pem certificate), or will apple send you back the tokens for all your apps that have app id's under the same account?
The reason I ask, is that I have a scrip... | [
0.4364064931869507,
0.2247878909111023,
0.2254997342824936,
0.0952967181801796,
-0.04993455111980438,
0.3207814395427704,
0.03336300328373909,
-0.14300933480262756,
-0.27266713976860046,
-0.3006700575351715,
0.2738749086856842,
0.18226788938045502,
-0.07407180219888687,
-0.0748134106397628... | |
created the new pem files for this new app.
As this is a new app there is only one token in the database and I have not sent any push yet, but when I ran the script, the feedback service reported 1200 tokens that needed to be removed. Since I was not expecting this, I was only checking to remove those tokens from the ... | [
0.1711016595363617,
0.028775785118341446,
0.27850639820098877,
0.03334229066967964,
-0.23632830381393433,
0.5502061247825623,
0.02609291672706604,
-0.38228654861450195,
-0.3770409822463989,
-0.370454877614975,
0.25181272625923157,
-0.058419566601514816,
-0.29408735036849976,
-0.11460146307... | |
of devices for which there were failed-delivery attempts" which leads me to believe that I should only get tokens on a per-application basis as opposed to all applications.
Can anybody confirm or deny how feedback service works with multiple apps, so I can then figure out where my problem is (if I have one at all)?
T... | [
0.16330495476722717,
-0.13655053079128265,
0.4494220018386841,
-0.08584850281476974,
0.3272712528705597,
0.06556635349988937,
-0.0006008759373798966,
-0.5363895893096924,
-0.34613773226737976,
-0.8963752388954163,
-0.11061137169599533,
0.5150457620620728,
-0.32758304476737976,
-0.159242421... | |
already be the case for your `timesheets.map{ }`.
[`options(...)`](https://github.com/playframework/Play20/blob/master/framework/src/play/src/main/scala/views/helper/Helpers.scala#L70) provides conveniences methods to constructs the `Seq[(String, String)]` and there is not a method that applies here. | [
0.3562583029270172,
-0.2089066058397293,
0.5934964418411255,
0.06884820759296417,
0.4171140193939209,
-0.24945929646492004,
-0.17382679879665375,
0.07574892789125443,
-0.4336093068122864,
-0.5239611268043518,
-0.1368766576051712,
0.38757872581481934,
0.0768704041838646,
-0.0985369682312011... | |
I am using jquery autocomplete pluguin. Configured to use multiple Values.
I set option **minLength : 2**
minLength option is working only for first autosuggest words, for multiple values its not working.
How do i configure or which method i need to override to fix this issue.
<http://jqueryui.com/demos/autocomplet... | [
-0.03665294125676155,
-0.20856347680091858,
0.48042142391204834,
-0.05685635283589363,
0.0036293219309300184,
0.19682535529136658,
0.5066293478012085,
0.09527744352817535,
-0.055152248591184616,
-0.869438648223877,
-0.08938480168581009,
0.853515625,
-0.10887223482131958,
0.1446879804134369... | |
if ( term.length < 2 ) {
return false;
}
}
});
```
See: <http://jqueryui.com/demos/autocomplete/#multiple-remote> | [
0.3703678846359253,
-0.2998883128166199,
0.2050260752439499,
-0.06939585506916046,
0.27519491314888,
-0.15892548859119415,
0.1800064742565155,
-0.2666487693786621,
-0.19849629700183868,
-0.26763975620269775,
-0.3480721116065979,
0.8286911845207214,
-0.152158722281456,
0.3185333013534546,
... | |
I am currently working on an Android app and I am trying to get a random value from a database table that looks like this:
```
| ID | Score|
| 1 | 20 |
| 2 | 5 |
| 5 | 5 |
| 6 | 5 |
| 14 | 15 |
```
(lets assume these are the only values in the table)
I would like to get a random value from this tab... | [
0.26819226145744324,
0.07419268786907196,
0.14557212591171265,
0.20368410646915436,
0.019610699266195297,
0.19893549382686615,
-0.0290669072419405,
-0.10162832587957382,
-0.13954398036003113,
-0.7248038649559021,
0.31619974970817566,
0.21275919675827026,
-0.3851940631866455,
0.174151271581... | |
10% of the time and so on...
If that is even possible, how would you go about it?
Given a `List<Integer>`, `add()` each song index `score` times, [`Collections.shuffle()`](http://docs.oracle.com/javase/6/docs/api/java/util/Collections.html#shuffle%28java.util.List%29) the list, and play in order. For better results,... | [
-0.030478015542030334,
-0.09760360419750214,
0.3161929249763489,
-0.03878747299313545,
0.11407618969678879,
0.11978801339864731,
0.30610254406929016,
-0.32604506611824036,
-0.40423154830932617,
-0.312703013420105,
-0.04567356035113335,
0.5504037141799927,
-0.01928381808102131,
-0.135644659... | |
I am using Rails 3.2.3 and deploying to Heroku's Cedar Stack and I am having problems with my asset pipeline and compiling the jQuery UI files I need.
Specifically the problem manifests itself in two separate issues that I think are related:
1) in development my dropdown buttons do not work, but in production they do... | [
0.24457114934921265,
0.20720191299915314,
0.008032907731831074,
-0.23685595393180847,
0.014576664194464684,
0.23421773314476013,
0.23355711996555328,
-0.2916015386581421,
-0.04092131927609444,
-0.5716811418533325,
0.2822949290275574,
0.8445083498954773,
-0.01641094870865345,
-0.20669104158... | |
the assets locally and also during slug compilation](https://devcenter.heroku.com/articles/rails3x-asset-pipeline-cedar), but to no avail.
My application.js:
```
//= require jquery
//= require jquery_ujs
//= require jquery-ui
//= require bootstrap
//= require_tree .
```
My Gemfile:
```
source 'https://rubygem... | [
0.09700599312782288,
0.26352524757385254,
0.40149083733558655,
-0.009305492043495178,
0.09930354356765747,
0.43298861384391785,
0.3300745189189911,
-0.5100059509277344,
-0.04860754683613777,
-0.3571852147579193,
-0.3697410821914673,
0.7135156989097595,
-0.035026196390390396,
0.046377625316... | |
asset server (Apache or nginx will already do this)
config.serve_static_assets = false
# Compress JavaScripts and CSS
config.assets.compress = true
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = false
# Generate digests for assets URLs
config.assets.digest = true
```
M... | [
-0.026922743767499924,
-0.2600598633289337,
0.20827317237854004,
-0.12008817493915558,
-0.23575222492218018,
-0.1466037631034851,
0.3710983395576477,
-0.24340933561325073,
-0.278665691614151,
-0.6422820091247559,
-0.2119426429271698,
0.7034795880317688,
-0.2453923225402832,
-0.002827965887... | |
I have a GAE Entity called *MyFile*
```
public class MyFile {
static enum LocationEnum {Folders, Hidden};
static enum FileType {File, Folder);
@Id private Long id;
private Key<MyFile> parent;
private String name;
private LocationEnum location;
private FileType fType;
// getters a... | [
0.17007479071617126,
0.057572148740291595,
0.41196608543395996,
-0.0925135388970375,
0.10573534667491913,
0.3385905921459198,
-0.164503276348114,
-0.020968077704310417,
0.06559409201145172,
-0.6476190090179443,
-0.20336461067199707,
0.3311375081539154,
-0.2042451798915863,
0.34295842051506... | |
Query<MyFile> q1 = ofy().query(MyFile.class).filter("parent", parent).filter("location", LocationEnum.Folders).order("name");
return q1.list();
}
```
It seems my order is ignored as the results are returned ordered by id. It did occur to me that I was missing something to do with indexing, but I noticed GAE b... | [
-0.37148788571357727,
0.12106375396251678,
0.3837312161922455,
-0.1496420055627823,
-0.2723475992679596,
0.4950864911079407,
0.1034516841173172,
-0.11255355924367905,
-0.17587649822235107,
-0.7482635974884033,
-0.20016269385814667,
0.41022974252700806,
-0.4276721775531769,
0.41119703650474... | |
I'm trying to understand on a deeper level if I'm missing something as to understanding when Java needs an initialization of a variable vs a simply declaration. In the following code, the variable 'row' doesn't need to be assigned a value to compile and run, however, the variable 'column' does.
Note: This program doe... | [
-0.16180650889873505,
0.10250627994537354,
0.13809503614902496,
-0.37686383724212646,
-0.025471678003668785,
-0.06433145701885223,
0.2594071924686432,
-0.17117469012737274,
-0.19944509863853455,
-0.5580880045890808,
0.06337301433086395,
0.3285675644874573,
-0.2994909882545471,
-0.074382811... | |
for (column=0; column<2; column++){
}
}
System.out.print("Col:" + column + " row:" + row);
```
Why does `row` compile w/o initialization at the top, but Java thinks `column` "might not have been initialized."?
The expression `row = 0` (from outer loop) is guaranteed to be evaluated, therefore `row` variable will ... | [
-0.3690263628959656,
-0.06824062019586563,
0.11899462342262268,
-0.44128111004829407,
0.17653633654117584,
-0.18301478028297424,
0.2846774458885193,
-0.4057931900024414,
-0.12925535440444946,
-0.4030352234840393,
-0.30532315373420715,
0.38474416732788086,
-0.4682016968727112,
-0.0309140440... | |
I would like to test my JDO - DAO with **multiple threads** in order to verify if the persistence layer is aware of synchronization.
Here is my piece of code in a JUnit test
```
for(int i=0;i<10;i++) {
Runnable runnable = new UserAccountLifeCycle(..);
Thread thread = new Thread(runnable);
thread.start();... | [
0.07467654347419739,
-0.32646989822387695,
0.6999216079711914,
-0.11832468956708908,
0.12325602769851685,
-0.109469473361969,
0.14588592946529388,
-0.07322799414396286,
-0.27540773153305054,
-0.6183769106864929,
-0.061788301914930344,
0.5527328252792358,
-0.49254822731018066,
0.21093438565... | |
= new ContentBusiness(..);
conBusiness.createEntities(..);
}
```
If I run the test I get:
> Exception in thread "Thread-6" java.lang.NullPointerException: No API
> environment is registered for this thread. at
> com.google.appengine.api.datastore.DatastoreApiHelper.getCurrentAppId(DatastoreApiHelper.java:86)
>... | [
0.3539203405380249,
0.20091339945793152,
0.3514396548271179,
0.18311162292957306,
-0.1581636369228363,
0.13275742530822754,
0.8695979714393616,
-0.5516151785850525,
0.10248438268899918,
-0.8175337314605713,
-0.160340815782547,
0.515451967716217,
-0.2395211160182953,
0.22899742424488068,
... | |
org.datanucleus.store.appengine.jdo.DatastoreJDOPersistenceManager.getObjectById(DatastoreJDOPersistenceManager.java:73)
> at
> it.icaroproject.main.persistence.dao.GaedatastoreUserAccountDAO.addCategories(GaedatastoreUserAccountDAO.java:174)
> at
> it.icaroproject.main.business.CategoryBusiness.createEntities(Cate... | [
-0.014158149249851704,
0.1666385531425476,
0.48678889870643616,
-0.175338014960289,
0.028041787445545197,
0.08920861780643463,
0.4608888626098633,
-0.4515802562236786,
-0.3538838028907776,
-0.5326211452484131,
-0.15608282387256622,
0.48569029569625854,
-0.49688059091567993,
0.1633917540311... | |
Same as Win32:
```
GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, (LPCTSTR)(void*)(myFunc), &h);
```
<http://www.kernel.org/doc/man-pages/online/pages/man3/dlsym.3.html> is not helpful.
Use `dladdr`. Documentation [here](http://linux.die.net/man/3/dladdr). | [
-0.3594908118247986,
-0.2082519382238388,
0.26578637957572937,
-0.14969536662101746,
-0.2617482841014862,
-0.35782620310783386,
0.3679185211658478,
-0.4219385087490082,
-0.18406854569911957,
-0.7328810095787048,
-0.2951345145702362,
0.6883783340454102,
-0.3690187335014343,
0.13773034512996... | |
I want to show a tooltip based on mouse over event . I have tried this code, but failed, nothing will show up.
Please advise.
```
<img onmouseover="showLongText();" BORDER=0 height=15 width=15 src="images/pick-button.gif"/>
<div id="longTextDiv" style="display:none;">
ddd
</div>
<script type="text/javascript">
func... | [
0.2225511372089386,
-0.16856840252876282,
0.8095669150352478,
-0.41733479499816895,
0.006678121630102396,
0.06367190182209015,
0.2736251950263977,
-0.38524100184440613,
-0.1393977552652359,
-0.5912175178527832,
-0.12837731838226318,
0.625585675239563,
-0.23056645691394806,
-0.1113086491823... | |
var longTextDiv = $("#longTextDiv");
//alert(longTextDiv);
longTextDiv.css({
left : e.pageX,
top : e.pageY,
display : "block"
});
longTextDiv.setCapture();
});
``` | [
0.048956967890262604,
-0.15518943965435028,
0.5544074773788452,
-0.45712706446647644,
0.09817423671483994,
0.04717696085572243,
0.30172720551490784,
-0.1477007269859314,
-0.13858702778816223,
-0.4246927499771118,
-0.7143682837486267,
0.6020417213439941,
-0.6669839024543762,
-0.102985531091... | |
I'm not too clear about this and neither are the docs.
When I'm creating a custom view, I override like so:
```
@Override
public void onDraw(Canvas canvas) {
super.onDraw(canvas);
//more code here...
}
```
My question is whether it's necessary to call `super.onDraw(canvas);`. The code seems to work fine wi... | [
0.36880427598953247,
-0.291691392660141,
0.33510562777519226,
-0.24917955696582794,
-0.24557073414325714,
0.09820523113012314,
0.16513998806476593,
0.014035869389772415,
-0.3164794147014618,
-0.9041827917098999,
0.07433773577213287,
0.6258966326713562,
-0.3128172755241394,
-0.0739746168255... | |
View yourself (which it seems you are), there's no reason to call it.
Also, if you're extending View (and not some class that extends view), super.onDraw doesn't really do anything.
For me, I call super.onDraw when I want to draw lines over a KeyboardView. So, super.onDraw draws the keyboard, and my custom LatinKeybo... | [
0.2979189157485962,
-0.45085105299949646,
0.6660208702087402,
-0.18341264128684998,
-0.3043801188468933,
0.23491430282592773,
-0.11357613652944565,
0.2323012351989746,
-0.09764263033866882,
-0.614654541015625,
0.22739021480083466,
0.5369304418563843,
-0.04139794409275055,
-0.16268461942672... | |
I used certain characters in website such as `• — “ ” ‘ ’ º ©`.
I found that when testing to see what my website looked like under different browsers ([BrowserLab](https://browserlab.adobe.com/en-us/index.html))
the afore-mentioned characters are replaced with `�`.
I then changed the charset in the webpage header fr... | [
0.1815892457962036,
0.30056101083755493,
0.6263172626495361,
-0.04992527887225151,
-0.12213204801082611,
0.19357521831989288,
0.07984098047018051,
-0.1413768082857132,
-0.21898958086967468,
-0.4308718740940094,
0.018474698066711426,
0.2158650904893875,
-0.0734066441655159,
0.18513296544551... | |
that will display across browsers, can anyone help me with the answer? Thanks.
You should save your HTML source as UTF8.
Alternatively, you can use HTML entities instead. | [
0.49158284068107605,
-0.09770604968070984,
0.32149097323417664,
0.16950978338718414,
-0.40875524282455444,
-0.22641168534755707,
0.31770265102386475,
0.6050922870635986,
-0.3356572985649109,
-0.7925690412521362,
-0.15415339171886444,
0.29624083638191223,
-0.1619577258825302,
0.287591189146... | |
It is 04.17 in the morning and i cant figure what is wrong! Help please!
I have table with such columns in table user\_logs:
```
id | user_id | action | reference | time
----------------------------------------
1 | 1 | login | 0 | 1333800404
2 | 1 | logout | 1 | 1333800424
3 | 1 ... | [
-0.14660197496414185,
0.5090819597244263,
0.9737674593925476,
-0.09640701860189438,
0.1402076780796051,
-0.407101035118103,
0.7017189264297485,
-0.34969478845596313,
-0.12914596498012543,
-0.8700698614120483,
0.13428063690662384,
0.6326020956039429,
0.04338834062218666,
0.0529538094997406,... | |
| 1333800434
4 | 1 | logout | 3 | 1333800444
```
And query:
```
SELECT reference r,
sum(time-(SELECT time FROM users_logs WHERE id = r)) time_of_logon
FROM users_logs
WHERE user_id = 1 AND action = 'logout'
```
Unfortunately sum() function returns unexpected value.
If I remove sum() I get such a... | [
-0.15506796538829803,
0.09406035393476486,
0.7510057091712952,
-0.18143652379512787,
0.020814035087823868,
0.584632933139801,
-0.0223455261439085,
-0.793885350227356,
-0.5576757788658142,
-0.5236150622367859,
0.004932860378175974,
0.4951680302619934,
-0.5581501126289368,
-0.118659168481826... | |
decrementing time of logoff from time i got from subquery (time of login connected with logout). Now i have time user was logged in. So far so good. Now, when I add sum (like in first query) I would expect sum of time\_of\_logon (should be 30). If I put avg function instead of sum i would expect 15 ((10+20)/2).
**Sum ... | [
-0.020281337201595306,
-0.11970514059066772,
0.9344473481178284,
-0.2809149920940399,
-0.07966352999210358,
0.31354954838752747,
0.1814878284931183,
-0.20622742176055908,
-0.43034806847572327,
-1.0018539428710938,
0.07555792480707169,
0.7105635404586792,
0.11714814603328705,
0.099488817155... | |
Because both - avg and sum result is twice as big as it should be.
Maybe it's the time issue that my brain is not working anymore but i cant figure out what is wrong. Please help.
```
SELECT user_id, sum(time_of_logon) as sum_login_time
FROM
(
SELECT user_id,
reference as r,
(time-(SELECT time FRO... | [
0.012270119972527027,
0.040777359157800674,
0.3604622483253479,
-0.06761817634105682,
0.138187438249588,
0.11916714906692505,
0.018267469480633736,
-0.527576208114624,
-0.3115648627281189,
-0.6941509246826172,
-0.06416888535022736,
0.5777549147605896,
-0.2942180633544922,
-0.17025399208068... | |
```
#!/bin/sh
INTERVAL=1
COUNT=0
while [ $COUNT -le 9 ]
do
(( COUNT++ ))
sleep $INTERVAL
echo "count is $COUNT"
done
```
On execution.
```
$ sh ascript
ascript: 9: COUNT++: not found
count is 0
ascript: 9: COUNT++: not found
count is 0
ascript: 9: COUNT++: not found
count is 0
ascript: 9: COUNT++: not f... | [
-0.18127043545246124,
0.18664103746414185,
0.3973540663719177,
-0.11163176596164703,
0.09741217643022537,
-0.3558206558227539,
0.5910216569900513,
-0.13715386390686035,
-0.28157809376716614,
-0.48997077345848083,
-0.2317165583372116,
0.5605101585388184,
-0.48303672671318054,
-0.23425222933... | |
is really just `bash`. If your `sh` is a real one you might not be so lucky. | [
0.820066511631012,
0.09625401347875595,
0.020174771547317505,
-0.08619111031293869,
-0.20138098299503326,
-0.3775971531867981,
0.5494082570075989,
0.43104204535484314,
-0.12833459675312042,
-0.14916080236434937,
-0.07961826771497726,
0.429869145154953,
0.1533016711473465,
-0.02895400859415... | |
I am using jQuery to attach a function to my click event for an entire class. For example:
```
$(".clickDiv").click(function(){
$(this).hide();
});
```
On my client-side javascript, I create more `.clickDiv` instances dynamically.
Do I need to call the `$(".clickDiv).click(function...)` again, or will the new... | [
0.12987641990184784,
-0.2523403763771057,
0.2436535805463791,
-0.17182427644729614,
-0.05582239106297493,
-0.20212401449680328,
-0.03396809101104736,
-0.0741715282201767,
-0.12104932218790054,
-0.4947085380554199,
-0.2962091267108917,
0.5209799408912659,
-0.5651309490203857,
0.345077037811... | |
elements, whether it occurs directly on the element or bubbles from a descendant (inner) element.
>
>
> When a selector is provided, the event handler is referred to as delegated. The handler is not called when the event occurs directly on the bound element, but only for descendants (inner elements) that match the se... | [
0.015569119714200497,
-0.5778148770332336,
0.05933814495801926,
0.15864910185337067,
0.17084437608718872,
0.017427248880267143,
-0.180614173412323,
-0.1474560648202896,
-0.29549527168273926,
-0.38776248693466187,
-0.26092931628227234,
0.16889166831970215,
-0.211317777633667,
0.077232919633... | |
elements; they must exist on the page at the time your code makes the call to .on(). To ensure the elements are present and can be selected, perform event binding inside a document ready handler for elements that are in the HTML markup on the page. If new HTML is being injected into the page, select the elements and at... | [
0.34911441802978516,
-0.25017380714416504,
0.24876680970191956,
0.16602694988250732,
0.18237808346748352,
-0.14957906305789948,
0.07013536989688873,
-0.478535532951355,
-0.3136913776397705,
-0.5867717862129211,
-0.31276580691337585,
0.37916919589042664,
-0.2945878505706787,
-0.160233780741... | |
added to the document at a later time. By picking an element that is guaranteed to be present at the time the delegated event handler is attached, you can use delegated events to avoid the need to frequently attach and remove event handlers. This element could be the container element of a view in a Model-View-Controll... | [
0.13747479021549225,
-0.5633633732795715,
0.4853566884994507,
0.33295613527297974,
0.11942695826292038,
-0.21111290156841278,
-0.13113880157470703,
-0.08438581973314285,
-0.3540119528770447,
-0.45534953474998474,
-0.15945613384246826,
0.24205321073532104,
-0.2762519419193268,
-0.1427498161... | |
for the document to be ready.
---
Just because too much people here suggested you should use `live`, `live` is deprecated since version `1.7` by `on` and was replaced in version `1.4.3` by `delegate`
```
$(selector).live(events, data, handler); // jQuery 1.3+
$(document).delegate(selector, events, dat... | [
0.5451241135597229,
-0.13590678572654724,
0.5037344098091125,
-0.04181893169879913,
0.18096596002578735,
-0.1362641155719757,
0.31027916073799133,
-0.2369259148836136,
-0.2179153859615326,
-0.5267995595932007,
-0.7274659276008606,
0.6574892401695251,
-0.3945084512233734,
0.0327540487051010... | |
I'm using RavenDB & need to store dynamic data like:
```
public class User {
public string Name;
public dynamic Data;
}
```
It appears that I could use many different types such as `dynamic`, `RavenJObject`, `DynamicJsonObject`, `ExpandoObject`, `Dictionary<string, object>`, but I don't know what the differe... | [
-0.06167853623628616,
-0.21655923128128052,
0.3422837257385254,
0.003556809388101101,
-0.09343858063220978,
-0.1519170105457306,
0.060361091047525406,
-0.16187772154808044,
-0.3674769401550293,
-0.5849279761314392,
0.10375339537858963,
0.7397284507751465,
-0.5014529824256897,
0.38620337843... | |
= new User();
user.Data.SomethingNew1 = "foo";
```
This looks harmless & works fine when you create your user. But when you **Load** user, RavenDB doesn't know what type you want for `dynamic` so it uses `RavenJObject`. You can't dynamically create properties (expando style) with `RavenJObject` so this fails:
```
va... | [
-0.189833864569664,
-0.15755552053451538,
0.3798087239265442,
-0.08339613676071167,
-0.05856943875551224,
-0.2175411581993103,
0.23603667318820953,
-0.3169655203819275,
-0.18851900100708008,
-0.6693739891052246,
-0.15127015113830566,
0.6571847796440125,
-0.4810793399810791,
0.0878458172082... | |
User {
public ExpandoObject _Data = new ExpandoObject();
public dynamic Data {
get { return _Data; }
}
}
```
There are ways to make the expando object private & to create a setter for `Data`, but you get the idea.
More Problems
-------------
Update: Unfortunately this solution exposes more prob... | [
-0.1953134536743164,
-0.1355052888393402,
0.4674566388130188,
-0.1616366058588028,
0.2186891883611679,
-0.19423073530197144,
0.08392275869846344,
-0.12446016818284988,
-0.46885302662849426,
-0.8398917317390442,
-0.19663606584072113,
0.6754628419876099,
-0.6960232853889465,
0.13421931862831... | |
runtime exception *Cannot implicitly convert type 'Raven.Abstractions.Linq.DynamicList' to 'System.Collections.Generic.List'*:
```
List<string> keys = user.Data.Keys;
``` | [
-0.23795592784881592,
-0.15755273401737213,
0.33256831765174866,
0.04855286329984665,
0.21057075262069702,
-0.1914992481470108,
0.4134431779384613,
-0.07094943523406982,
-0.14403575658798218,
-0.5277254581451416,
-0.3135221004486084,
0.43148642778396606,
-0.6847090125083923,
-0.04810835793... | |
I have on array like:
`$myarray = array("color", "red", "size", "big", "flavor", "bitter");` where color, size and flavor are the keys and the other are the values. How can I loop true the values only on the array.
I have a few arrays like that one so I only need to create a table and display their values like:
```
... | [
0.10789331793785095,
0.46440351009368896,
0.292118102312088,
-0.061656564474105835,
-0.056121841073036194,
0.35125958919525146,
0.28358370065689087,
-0.15374869108200073,
-0.01154311653226614,
-0.6731659770011902,
0.0680626854300499,
0.49819451570510864,
-0.15803825855255127,
0.14317594468... | |
appreciated
Thanks
```
while (list(, $key) = each($array)) {
$value = current($array);
next($array);
echo $key, ': ', $value, PHP_EOL;
}
```
But yes, you should really use a proper associative array instead of this makeshift solution. | [
-0.2246353179216385,
0.09060481935739517,
0.5823453664779663,
-0.004538212437182665,
-0.07643724977970123,
-0.12900346517562866,
0.48613134026527405,
-0.03495877981185913,
0.012303833849728107,
-0.465038001537323,
-0.15347181260585785,
0.6190027594566345,
0.18842777609825134,
-0.2255854904... | |
I'm running Xcode 4.3.2, under Lion 10.7.3, but every time I'm installing my iPhone app on the device it keeps asking me for an Admin user name and password.
I've done everything suggested here, and even have reinstalled Xcode:
[Another StackOverflow related question](https://stackoverflow.com/questions/1837889/autho... | [
0.15513606369495392,
0.5078271627426147,
0.4967916011810303,
-0.3496708869934082,
-0.014827772043645382,
0.055246010422706604,
0.4725106358528137,
0.1076546311378479,
-0.1351914405822754,
-0.6926571726799011,
-0.1992979645729065,
0.6215959191322327,
-0.24729040265083313,
0.1342385560274124... | |
I moved the Developer Certificate to "**login**", which is always unlocked, and now everything works perfectly. The annoyance of xCode asking for the password is gone.
Please see this picture for more details:  | [
0.345562607049942,
-0.14579789340496063,
0.505440890789032,
0.04807714372873306,
0.4864710569381714,
-0.1671023815870285,
0.6817680597305298,
0.06473338603973389,
-0.37920770049095154,
-0.4992322027683258,
-0.19081063568592072,
0.45352399349212646,
0.16289398074150085,
0.19565853476524353,... | |
I have been working on the following problem from this [book](http://www.cs.berkeley.edu/~vazirani/algorithms/chap6.pdf).
> A certain string-processing language offers a primitive operation which splits a string into two pieces. Since this operation involves copying the original string, it takes n units of time for a ... | [
0.34471338987350464,
-0.16502700746059418,
-0.4806289076805115,
-0.20433355867862701,
0.01249595358967781,
0.357255756855011,
0.017474759370088577,
-0.29794448614120483,
-0.42950209975242615,
-0.4854668080806732,
-0.2095157951116562,
-0.009285609237849712,
-0.18540674448013306,
0.204820871... | |
position 3 incurs a total cost of 20+17=37, while doing position 10 first has a better cost of 20+10=30.
I need a dynamic programming algorithm that given m cuts, finds the minimum cost of cutting a string into m+1 pieces.
The divide and conquer approach seems to me the best one for this kind of problem. Here is a Jav... | [
-0.5748769044876099,
-0.2521072328090668,
0.4590589702129364,
-0.29671812057495117,
-0.10568378120660782,
0.30186915397644043,
0.2886950671672821,
-0.5857932567596436,
-0.21195340156555176,
-0.4772394895553589,
-0.19377923011779785,
0.22509589791297913,
-0.24832698702812195,
0.004241080023... | |
cost = Math.min(findMinCutCostImpl(m, n, i), cost);
}
return cost;
}
private int findMinCutCostImpl(int[] m, int n, int i) {
if (m.length == 1) return n;
int cl = 0, cr = 0;
if (i > 0) {
cl = Integer.MAX_VALUE;
int[] ml = Arrays.copyOfRange(m, 0, i);
int nl = m[i];
for (int j=0; ... | [
-0.25738364458084106,
-0.23496931791305542,
0.7840770483016968,
0.06993910670280457,
0.25074538588523865,
0.5937527418136597,
-0.024163823574781418,
-0.4989185631275177,
-0.2843852639198303,
-0.37811994552612305,
-0.36839669942855835,
0.926458477973938,
0.06935957819223404,
0.0128414826467... | |
}
}
if (i < m.length - 1) {
cr = Integer.MAX_VALUE;
int[] mr = Arrays.copyOfRange(m, i + 1, m.length);
int nr = n - m[i];
for (int j=0; j<mr.length; j++) {
mr[j] = mr[j] - m[i];
}
for (int j=0; j<mr.length; j++) {
cr = Math.min(findMinCutCostImpl(mr, | [
-0.270710825920105,
-0.018589768558740616,
0.8382846117019653,
-0.07763051241636276,
0.3374174237251282,
0.42205527424812317,
0.37861311435699463,
-0.4691218137741089,
-0.4001745581626892,
-0.3275777995586395,
-0.38298898935317993,
0.7107128500938416,
0.004741258453577757,
0.21923129260540... | |
nr, j), cr);
}
}
return n + cl + cr;
}
```
For example :
```
int n = 20;
int[] m = new int[] { 10, 3 };
System.out.println(findMinCutCost(m, n));
```
Will print `30`
\*\* **Edit** \*\*
I have implemented two other methods to answer the problem in the question.
### 1. Median cut approximation
T... | [
-0.0011790217831730843,
-0.22176967561244965,
0.2968977689743042,
-0.1318037360906601,
0.03307020664215088,
0.3490820825099945,
0.1332741379737854,
-0.348691463470459,
-0.07949989289045334,
-0.8193129301071167,
-0.11980482190847397,
0.8558699488639832,
0.08098965138196945,
-0.0091642308980... | |
findMinCutCost2(int[] m, int n) {
if (m.length == 0) return 0;
if (m.length == 1) return n;
float half = n/2f;
int bestIndex = 0;
for (int i=1; i<m.length; i++) {
if (Math.abs(half - m[bestIndex]) > Math.abs(half - m[i])) {
bestIndex = i;
}
} | [
-0.20586472749710083,
-0.35666123032569885,
0.5151438117027283,
-0.42249634861946106,
0.4093112647533417,
0.05937447026371956,
0.49803197383880615,
-0.5222402215003967,
0.2999480366706848,
-0.2962981164455414,
-0.1150154173374176,
0.8787047863006592,
-0.027668707072734833,
-0.0819369032979... | |
int cl = 0, cr = 0;
if (bestIndex > 0) {
int[] ml = Arrays.copyOfRange(m, 0, bestIndex);
int nl = m[bestIndex];
cl = findMinCutCost2(ml, nl);
}
if (bestIndex < m.length - 1) {
int[] mr = Arrays.copyOfRange(m, bestIndex + 1, m.length);
int nr | [
-0.5347143411636353,
-0.26246780157089233,
1.0479415655136108,
-0.06922762095928192,
0.27304038405418396,
0.16657580435276031,
0.04903629422187805,
-0.6346319317817688,
-0.5906065106391907,
-0.08224295824766159,
-0.42298781871795654,
0.660363495349884,
-0.15383020043373108,
0.0420992858707... | |
= n - m[bestIndex];
for (int j=0; j<mr.length; j++) {
mr[j] = mr[j] - m[bestIndex];
}
cr = findMinCutCost2(mr, nr);
}
return n + cl + cr;
}
```
### 2. A constant time multi-cut
Instead of *calculating* the minimal cost, just use different indices and buffers. Since this method exe... | [
-0.18484991788864136,
-0.21027103066444397,
0.5210667848587036,
-0.2923377752304077,
0.033654745668172836,
0.1745150089263916,
0.18969027698040009,
-0.5499493479728699,
-0.5425977110862732,
-0.40989062190055847,
-0.3234349489212036,
0.5037661194801331,
-0.2643091082572937,
0.09504401683807... | |
char[][] charArr = new char[m.length+1][];
charArr[0] = new char[m[0]];
for (int i=0, j=0, k=0; j<n; j++) {
//charArr[i][k++] = string[j]; // string is the actual string to split
if (i < m.length && j == m[i]) {
if (++i >= m.length) {
charArr[i] = new char[n - m[i-1]];
... | [
0.1754721999168396,
-0.1079450324177742,
0.06111472472548485,
-0.3284432291984558,
-0.09758006781339645,
0.3724638521671295,
0.133915513753891,
-0.7019950151443481,
-0.3052939474582672,
0.15411651134490967,
-0.45315322279930115,
0.6276870369911194,
-0.19544373452663422,
0.2484976351261139,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.