text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
new one ?
```
public ResponseMessage call(){
Future<ResponseMessage> future = CacheManager.getInstance().asyncFetch();
ResponseMessage response = null;
try {
response = future.get();
}
catch (InterruptedException e) {
Thread.currentThread().interrupt();
} catch (ExecutionExcept... | [
-0.07156427204608917,
-0.43041154742240906,
0.4397139251232147,
-0.20438915491104126,
0.39873912930488586,
0.10175007581710815,
0.32278284430503845,
-0.22207656502723694,
-0.5676239132881165,
-0.6799907684326172,
-0.3560892641544342,
0.6172125935554504,
-0.595084011554718,
0.36988011002540... | |
don't have control over the thread scheduling, you really don't know that a given thread is executing a particular task at the instant you interrupt it
If you want to cancel a task you've given an executor service, call `cancel(true)` on its associated `Future`. When your task detects an interrupt request, it should p... | [
0.2639204263687134,
-0.30866140127182007,
0.33194467425346375,
0.1525907814502716,
0.3742201328277588,
-0.4837847054004669,
0.17272010445594788,
0.31085649132728577,
-0.7610791325569153,
-0.3865630328655243,
-0.2908865809440613,
0.6188862919807434,
-0.30195993185043335,
0.6198280453681946,... | |
I've just started using QuickCheck with a bunch of Haskell code. I'm behind the times, I know. This question is a two-parter:
Firstly, what are the general best-practices for Quick Check? So far, I've picked up the following:
* Name your tests prop\_\* (annoying, because everything else is camelCase)
* Test exported ... | [
0.25060319900512695,
0.020867571234703064,
-0.2161942571401596,
0.023056065663695335,
-0.07244721800088882,
-0.04594331607222557,
0.4442048668861389,
-0.04423678293824196,
-0.11394065618515015,
-0.663499116897583,
0.024067210033535957,
0.580338716506958,
0.014698684215545654,
-0.1794992536... | |
are properties kept?
+ The same file?
+ in a `test/` directory? (If so, then how do you import the stuff in `src/`?)
+ in a `Properties/` directory under `src`?
Most importantly, how do we tend to go about testing properties on type classes? For example, consider the following (simplified) type class:
```
class Ge... | [
0.3053620159626007,
0.13950002193450928,
-0.005662539042532444,
0.10929393768310547,
-0.03529539704322815,
-0.2974718511104584,
0.19863437116146088,
-0.2875276803970337,
0.044705793261528015,
-0.6587342023849487,
0.013782063499093056,
0.6783453822135925,
0.21380823850631714,
0.305304855108... | |
the test is more complicated. What's the standard way to generalize such tests?
I believe the `prop_` convention came from QC coming with a script that ran all functions that started with `prop_` as tests. So there's no real reason to do so, but it *does* visually stand out (so the property for a function `foo` is `pro... | [
0.642993152141571,
0.08160130679607391,
-0.18615762889385223,
0.006730375811457634,
-0.17547135055065155,
-0.14540354907512665,
0.4089095890522003,
-0.3421040177345276,
-0.1275734305381775,
-0.3688541054725647,
0.10286315530538559,
0.79449862241745,
-0.36945047974586487,
0.1016923189163208... | |
Have internals in a non-exported module, with the functions to actually be exported re-exported from another module. Then you can import the internal module into one that defines the QC properties, and that module is only built (and has a QC dependency) if a flag specified in the .cabal file is used.
If your project i... | [
0.4319681227207184,
0.1315838247537613,
-0.022998200729489326,
-0.01673547923564911,
-0.009419870562851429,
-0.2814043462276459,
0.06292421370744705,
-0.36943528056144714,
-0.4327012896537781,
-0.43723204731941223,
-0.38047927618026733,
0.5140005350112915,
-0.1734200119972229,
0.0939388796... | |
up like that.
As Norman Ramsey said in his answer, for type classes you can just define the property as being *on* the typeclass and use accordingly. | [
0.25453823804855347,
-0.04898965358734131,
-0.2003912627696991,
0.2362210601568222,
-0.22282618284225464,
0.06163761764764786,
-0.01470725517719984,
-0.2261456400156021,
-0.5717086791992188,
-0.526268482208252,
-0.11924444884061813,
0.1131528839468956,
-0.5550493597984314,
0.11071528494358... | |
I have been searching for tableviews and singleton classes but could not find any solution so here I am.
I have a table view in a viewcontroller when user selects a row I want to send the selected data to an array in singleton class and print it to screen in another viewcontroller.
Here is my Singleton Class code:
... | [
0.12904103100299835,
0.036639254540205,
0.5114286541938782,
-0.3171210289001465,
-0.27388280630111694,
0.05293687805533409,
0.09548266977071762,
-0.45999032258987427,
-0.010499304160475731,
-0.9332538843154907,
0.08781487494707108,
0.23833885788917542,
-0.24738000333309174,
0.4451417922973... | |
sharedInstance = [[DataController alloc]init];
}
return sharedInstance;
}
@end
```
So how do Should I pass the data to the Array in the Singleton Class I tried following,
```
- (void) tableView: (UITableView *) tableView didSelectRowAtIndexPath: (NSIndexPath *) indexPath {
StartHuntViewController *sta... | [
-0.12268730252981186,
-0.1519952416419983,
0.366081565618515,
0.18440735340118408,
-0.21059168875217438,
-0.09782622009515762,
0.4101264476776123,
-0.5312163233757019,
-0.03841853141784668,
-0.724966287612915,
-0.15549370646476746,
0.26568734645843506,
-0.0028300387784838676,
0.25111120939... | |
can I pass it to NSArray\* standLoc?
**EDIT**
---
SO i have edited my code and it works fine fow multiple contorller views right now
my Singleton .m and .h :
```
#import <Foundation/Foundation.h>
@interface DataController : NSObject {
NSString* standLoc;
}
@property (nonatomic,retain)NSString* standLoc; // ... | [
0.269739031791687,
-0.25798046588897705,
0.6409175992012024,
-0.0202853474766016,
-0.14913970232009888,
-0.20321834087371826,
0.18090692162513733,
-0.7072647213935852,
-0.08434177190065384,
-0.7323161363601685,
0.0367814376950264,
0.34282559156417847,
-0.20959600806236267,
0.35269835591316... | |
}
}
return sharedInstance;
}
+(id) allocWithZone:(NSZone *)zone{
@synchronized (self){
if (sharedInstance == nil) {
sharedInstance = [super allocWithZone:zone];
return sharedInstance;
}
}
return nil;
}
-(id)copyWithZone:(NSZone *)zone{ // incase if we want to ... | [
0.08466319739818573,
-0.4288930296897888,
0.13367700576782227,
0.1538304090499878,
0.15349560976028442,
0.02391359768807888,
0.37219634652137756,
-0.26957324147224426,
-0.3880641758441925,
-0.44624072313308716,
0.0596277080476284,
0.6674912571907043,
-0.39154496788978577,
0.32076495885849,... | |
to override some functions of memory allocation
-(id) retain {
return self;
}
-(id) autorelease{
return self;
}
-(NSUInteger ) retainCount{
return NSUIntegerMax;
}
-(id) init{ // lets set the default data in it
@synchronized (self){
[super init];
standLoc = [[NSString alloc] initWithSt... | [
0.06717706471681595,
-0.32262054085731506,
0.8340553045272827,
-0.167921245098114,
-0.0068120891228318214,
0.1257236748933792,
0.44367873668670654,
-0.48300185799598694,
-0.24873650074005127,
-0.3686557412147522,
-0.09657314419746399,
0.4373772442340851,
-0.051777224987745285,
0.0540275424... | |
function to set static data which is the member of the class, reaching data will be allowed with this method
@synchronized (self){
if (standLoc != data) {
[standLoc release];
standLoc = [data retain];
}
}
}
-(NSString *) standLoc{
@synchronized(self){
return s... | [
0.027027830481529236,
-0.3758799433708191,
0.5400812029838562,
-0.13867536187171936,
0.039500195533037186,
-0.05411793291568756,
0.1942318230867386,
-0.37511923909187317,
-0.1283656358718872,
-0.10299330204725266,
-0.2580380141735077,
0.4467076063156128,
-0.44588521122932434,
0.33535867929... | |
:
```
DataController* sharedSingleton = [DataController sharedInstance];
NSString* transfer = [stands objectAtIndex:indexPath.row];
[sharedSingleton setData:transfer];
```
You need to do two things to make this happen.
First, the window's root view controller will always resize its view to the size of the wi... | [
-0.06649407744407654,
-0.3783416152000427,
0.698976457118988,
0.05609915778040886,
-0.2027517408132553,
0.027899187058210373,
-0.03578522801399231,
-0.15133677423000336,
-0.4368229806423187,
-0.7589585781097412,
-0.20754587650299072,
0.2886146306991577,
-0.23623628914356232,
0.441996097564... | |
black subviews to explicitly hide any views that would otherwise appear outside the window's bounds. It places these black subviews in front of its root view controller's view. You need to move your root view controller's view to the front, like this:
```
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceO... | [
-0.06097801774740219,
-0.4013986587524414,
0.5157436728477478,
-0.3107486963272095,
0.10723215341567993,
0.13967132568359375,
0.5449344515800476,
-0.18591074645519257,
-0.23785445094108582,
-0.7126474976539612,
-0.31716030836105347,
0.384576678276062,
-0.22097577154636383,
0.31597915291786... | |
I am a noob with Sencha 2 and I am trying to find a way to render a new view when a button is clicked. Specifically, I have this view called Home
**Home**
```
Ext.define("Blog.view.Home", {
extend:'Ext.Panel',
xtype:'homepanel',
config:{
iconCls:"home",
title:"Home",
items:[
{
default... | [
-0.014079215936362743,
0.05565561354160309,
0.6524711847305298,
-0.2011890858411789,
-0.09746671468019485,
0.07419201731681824,
0.15206368267536163,
0.24649983644485474,
0.10722308605909348,
-0.7674189209938049,
-0.19971342384815216,
0.41445547342300415,
0.09309086203575134,
0.137145251035... | |
docked:'top',
items:[
{
id:'newBlog',
xtype:'button',
iconCls:'add',
handler:function () {
//What do I do here? | [
0.11135988682508469,
-0.2341165393590927,
0.5468043088912964,
0.0016731055220589042,
0.4039524793624878,
0.1981697678565979,
0.15492363274097443,
-0.23707257211208344,
-0.4029664397239685,
-0.2075919508934021,
0.0984281599521637,
0.5441603660583496,
-0.1388411670923233,
-0.0331281870603561... | |
}
}
]
},
{
html:"Recent Blogs"
}
]
}
});
```
And I want that button, when clicked, to render a new view. I am just not sure how I would do such thing. Can someone give me some pointer? Is this the best way to do this? Should I move this to my controller? | [
0.21218222379684448,
-0.06361296772956848,
0.6144348382949829,
-0.055721465498209,
0.22767381370067596,
-0.29361557960510254,
-0.19858720898628235,
0.3513695299625397,
-0.05810047313570976,
-0.7169198393821716,
-0.005741586443036795,
0.49606552720069885,
-0.25413399934768677,
0.37139081954... | |
If yes, what event should I listen to?
The way I do it (i'm also learning) is defining the property 'action' of my button, for example:
```
{
xtype: 'button'
action: 'doSomething',
}
```
and handling the event in the control configuration of my controller:
```
control: {
'button[action=doSomething]' : {
... | [
0.1172841414809227,
-0.4200199544429779,
0.7412580847740173,
-0.008245863951742649,
-0.01482234988361597,
0.0025582644157111645,
0.20621861517429352,
-0.4540064036846161,
-0.17993809282779694,
-0.6908926367759705,
-0.11995327472686768,
0.8892053365707397,
-0.05501456558704376,
-0.114173032... | |
In below link there is add button which allows you to ADD multiple textbox which i am using on my application.
<http://jsfiddle.net/cN5SR/200/>
Now I want to know how can I bind that array of string value with my ViewModel.
let's say if my property in ViewModel is as below:
```
Public class MyViewmodel
{
Public... | [
0.30751359462738037,
-0.03161850571632385,
0.4317764937877655,
-0.07930541038513184,
-0.3954039216041565,
-0.2264968454837799,
0.11048267781734467,
-0.3571198284626007,
-0.5224834084510803,
-0.5650360584259033,
0.24920517206192017,
0.5506959557533264,
-0.2295052856206894,
0.279571592807769... | |
I'm looking for some regex/automata help. I'm limited to `+` or the Kleene Star. Parsing through a string representing a ternary number (like binary, just 3), I need to be able to know if the result is 1-less than a multiple of 4.
So, for example `120 = 0*1+2*3+1*9 = 9+6 = 15 = 16-1 = 4(n)-1`.
Even a pointer to the ... | [
0.5105127692222595,
0.06050785258412361,
-0.12104383111000061,
0.24625682830810547,
-0.21308493614196777,
0.07388492673635483,
0.3171294927597046,
0.03546484559774399,
-0.29993507266044617,
-0.49464309215545654,
0.049474917352199554,
0.4035625457763672,
-0.36283236742019653,
0.145814776420... | |
an instance variable called newData that you instantiate at the top of your Class, rather than in the addBtn\_clickHandler function.
The first time it works, because you've never added it to the collection before. When you click the button again, I suspect you're simply changing the properties on the same object, the... | [
-0.18497420847415924,
-0.57438063621521,
-0.13996414840221405,
0.20919004082679749,
-0.1450626403093338,
-0.2074730098247528,
0.04460112005472183,
0.1617167443037033,
-0.23034590482711792,
-0.7126945853233337,
0.048128265887498856,
0.3662150204181671,
-0.33229225873947144,
0.36306878924369... | |
I have an application that is responsible for archiving old applications, which will do a large number of applications at a time and so it will need to run for days at a time.
When my company developed this they did a fair bit of performance testing on it and they seemed to get decent numbers out of this, but I have b... | [
0.5235110521316528,
0.3761354386806488,
0.004713665693998337,
0.1877458095550537,
0.23069186508655548,
-0.1828809678554535,
0.07459872961044312,
0.23958583176136017,
-0.30065038800239563,
-0.5959834456443787,
0.3404902219772339,
0.32486140727996826,
0.14361301064491272,
0.42127877473831177... | |
have monitoring it with jconsole there still is plenty of memory available and does not appear to be shrinking.
I have noticed however that the survivor space and tenured gen of the heap can very quickly fill up until a garbage collection comes along and clears it out which seems to be happening rather frequently whic... | [
0.6244447231292725,
-0.0031664702109992504,
0.4518895447254181,
0.07819478213787079,
0.13393975794315338,
0.15744324028491974,
0.3025706708431244,
0.05693893879652023,
-0.4955572485923767,
-0.5676254630088806,
-0.007319453172385693,
0.6764662861824036,
0.28293704986572266,
0.12544564902782... | |
25 minutes on marksweep compaction's (145,940 collections).
This seems like a large amount of time to be spent on garbage collection and I am just wondering if anyone has looked into something like this before and knows if this is normal or not?
**Edits**
Local processing seems to be slow, for instance I am looking ... | [
0.45790162682533264,
-0.09939002245664597,
0.2892057001590729,
0.25933659076690674,
-0.1708207130432129,
-0.25443005561828613,
0.44575560092926025,
-0.1460067629814148,
-0.012233603745698929,
-0.6300627589225769,
0.04072367027401924,
0.3245704472064972,
0.2341739982366562,
-0.0811619907617... | |
I would either have to pull the data down over the net or set up a large test base in our dev environment which may end up having to do.
Running Java HotSpot Client VM version 10.0-b23
Really just need high throughput, haven't configured any specific garbage collection parameters, would be running what ever the defau... | [
0.5942453742027283,
0.03017488680779934,
0.3183611333370209,
0.13139159977436066,
-0.33925098180770874,
-0.2549257278442383,
0.7366974353790283,
0.3421076536178589,
-0.21878033876419067,
-0.5206664800643921,
0.35580360889434814,
0.45693886280059814,
-0.205179363489151,
0.17179687321186066,... | |
pretty badly done. Should have figured the garbage collection was symptom from constantly copying the status text into memory, rather than an actual cause.
Cheers Guys.
According to your numbers, total garbage collection time was about 18 hours out of 7 days execution time. At about 10% of total execution time, that's... | [
0.4778396785259247,
0.2207036018371582,
0.15119554102420807,
0.2284819781780243,
-0.08647160977125168,
0.2696461081504822,
0.7512690424919128,
-0.08033417165279388,
-0.574942409992218,
-0.5671659708023071,
0.42574208974838257,
0.46643567085266113,
0.13755816221237183,
-0.4243556261062622,
... | |
I'm using Rails 3.2.2 and am not getting the field\_with\_errors div when the validation fails.
**views/sessions/new.html.erb**
```
<%= form_tag sessions_path do %>
<p><%= label_tag :email %><br />
<%= email_field_tag :email %></p>
<p><%= label_tag :password %><br />
<%= password_field_tag :password %></p>
... | [
0.15497377514839172,
0.05998256057500839,
0.7096614241600037,
-0.14676310122013092,
-0.20899184048175812,
-0.1692204475402832,
0.46579378843307495,
-0.6281148195266724,
-0.3383497893810272,
-0.6982266306877136,
0.1191805824637413,
0.48726212978363037,
-0.2179892659187317,
-0.03801928833127... | |
flash.now[:error] = "Invalid email or password"
render 'new'
end
end
```
**models/user.rb**
```
attr_accessible :first_name, :last_name, :email, :password, :password_confirmation
has_secure_password
validates :email, :presence => true, :uniqueness => true
validates :password, :presence => true, ... | [
0.016567010432481766,
0.28813716769218445,
0.1375049203634262,
-0.09114187210798264,
-0.17437250912189484,
-0.10527972877025604,
0.08899569511413574,
-0.21844880282878876,
-0.26465368270874023,
-0.6895220279693604,
-0.12294306606054306,
0.5604686737060547,
-0.4642097055912018,
-0.237417206... | |
<h2><%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:</h2>
<ul>
<% @post.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
```
You can then extract that into a partial for re-use with your other models. | [
-0.24486103653907776,
0.08437380939722061,
0.35422176122665405,
-0.061101093888282776,
-0.21630382537841797,
0.14543360471725464,
0.5604199767112732,
-0.06398315727710724,
-0.052298638969659805,
-0.6161129474639893,
-0.30160069465637207,
-0.02125759981572628,
-0.525822639465332,
0.32339084... | |
Is it possible to add an observer in iOS development for when a cell is dequeued and reused inside a `UITableView`?
Thanks.
It's no longer included by default, you need to render your own error messages.
Here's some sample code generated in a scaffold for a `Post` model:
```
<% if @post.errors.any? %>
<div id="err... | [
0.23486100137233734,
0.042736515402793884,
0.34949108958244324,
0.3113856315612793,
0.1046958640217781,
0.08876746147871017,
0.41214847564697266,
-0.008586266078054905,
-0.3017931580543518,
-0.8072232604026794,
0.20259055495262146,
0.13322709500789642,
-0.727928876876831,
-0.38458073139190... | |
</div>
<% end %>
```
You can then extract that into a partial for re-use with your other models. | [
0.15780995786190033,
0.0692887157201767,
0.248525008559227,
0.01728915423154831,
0.04827528074383736,
-0.0009023344609886408,
0.01456662081182003,
0.04864336550235748,
0.32250624895095825,
-0.7071630954742432,
-0.14634455740451813,
0.31019285321235657,
-0.12607814371585846,
0.1062248274683... | |
I am wanting to check if input fields have the attribute required. If these fields have an empty value, and also have the attribute required, append an error div after each field. I got a little stumped when it comes to using the selector
```
// initialize validator for a bunch of input fields
var inputs = $("#Conta... | [
0.21650253236293793,
0.08620645850896835,
0.2914324700832367,
0.01226750761270523,
0.19584645330905914,
-0.06279516965150833,
0.46463268995285034,
-0.4126124083995819,
0.10803534090518951,
-0.35042232275009155,
-0.17760945856571198,
0.8325077295303345,
-0.20737558603286743,
0.0051702130585... | |
completed");
}
```
try something like this it should add class to all inputs that meet the criteria
```
$("#Contact :input").each(function(){
if ($(this).attr("required") && $(this).val() === "")
{
$(this).addClass("req");
}
});
``` | [
-0.06441133469343185,
-0.1812582015991211,
0.6393288969993591,
-0.23012995719909668,
0.372392475605011,
-0.15280355513095856,
0.46357306838035583,
-0.5947901606559753,
0.04969628155231476,
-0.6223486065864563,
-0.5364117622375488,
0.8356624245643616,
-0.35504063963890076,
0.112908154726028... | |
I need to get the maximum value out of this code, but it's really screwy. Anyone got any suggestions?
```
import java.util.Scanner;
public class Test{
public static void main(String args[])
{
Scanner scan = new Scanner(System.in);
final int sentinel = 0;
int number;
int maxv... | [
0.6959693431854248,
-0.15517576038837433,
0.6545841097831726,
-0.3401145935058594,
0.1422799974679947,
0.15365056693553925,
0.5703452825546265,
-0.5152930021286011,
-0.0763862207531929,
-0.5757299065589905,
-0.18835824728012085,
0.5955060124397278,
-0.4887503683567047,
0.4601113200187683,
... | |
System.out.println ("Enter a number: ");
number = scan.nextInt();
while (number != sentinel)
{
count++;
System.out.println("Enter another number");
number = scan.nextInt();
maxval = number; | [
-0.17543210089206696,
-0.5293525457382202,
0.8704249262809753,
-0.29253920912742615,
0.22757796943187714,
0.26218947768211365,
0.5190281271934509,
-0.5116782188415527,
-0.5993212461471558,
-0.4587523341178894,
-0.3377975821495056,
0.33536776900291443,
-0.2783050835132599,
0.459103226661682... | |
}
if (number > maxval)
{
maxval = number;
System.out.println ("The max value is " + maxval);
}
}
}
```
you overwrite the `maxval` variable every time you get a new number. You have to do something like this
```
while (number != sentinel)
{
count++; | [
0.1349160522222519,
-0.031123805791139603,
0.391202449798584,
-0.4194270670413971,
0.2734183073043823,
-0.19841846823692322,
0.6983171105384827,
-0.28029680252075195,
-0.2190386950969696,
-0.4995286464691162,
-0.16666701436042786,
0.7373784780502319,
-0.24741429090499878,
0.450321584939956... | |
System.out.println("Enter another number");
number = scan.nextInt();
if (number > maxval && number != sentinel) //So you don't overwrite it when you get the sentinel character
maxval = number;
}
System.out.println ("The max value is " + maxval);
``` | [
-0.14494866132736206,
-0.33744022250175476,
0.625981330871582,
-0.332226037979126,
0.19974403083324432,
0.155798077583313,
0.5777176022529602,
-0.3027324378490448,
-0.5019394159317017,
-0.6469415426254272,
-0.26048949360847473,
0.45898622274398804,
-0.3317103683948517,
0.32708561420440674,... | |
I have the next very strange situation and problem:
* .NET 4.0 application for diagram editing (WPF).
* Runs ok in my PC: 8GB RAM, 3.0GHz, i7 quad-core.
* While creating objects (mostly diagram nodes and connectors, plus all the undo/redo information) the TaskManager show, as expected, some memory usage "jumps" (up an... | [
0.1225583553314209,
0.0028647216968238354,
0.29088902473449707,
0.05260943993926048,
-0.12723129987716675,
-0.10160896182060242,
0.3715045750141144,
0.10241863876581192,
-0.7280720472335815,
-0.7709933519363403,
0.2424466907978058,
0.14275017380714417,
-0.008427338674664497,
0.205834060907... | |
some slow/weak laptos/netbooks of my beta testers (under 2GHz of speed and under 2GB of RAM). I was thinking of a memory leak, but...
EDIT 1: Also, there is the case that the memory usage grows and grows until collapse (only in slow machines).
* In a Windows XP Mode machine (VM in Win 7) with only 512MB of RAM Assig... | [
0.003179448889568448,
0.011674992740154266,
0.25516608357429504,
0.07277607917785645,
-0.10564801841974258,
-0.1092529371380806,
0.2968548536300659,
-0.028999458998441696,
-0.5684561133384705,
-0.6856549978256226,
-0.18570217490196228,
0.642185389995575,
-0.2759896218776703,
-0.20853224396... | |
diagram can be created while the memory usage takes off like a rocket to space (hundreds of MBs consumed in seconds). Anyone with similar experiences? what were they strategies?
So, I really have a big trouble because I cannot reproduce the error, only see these strange behaviour (mem jumps), and the tool supposed to ... | [
0.059278704226017,
-0.03552328795194626,
-0.12200453132390976,
0.040421705693006516,
-0.05068620294332504,
0.408343642950058,
0.31110289692878723,
-0.059267256408929825,
-0.8543322682380676,
-0.9238470792770386,
0.4334389269351959,
0.250855028629303,
-0.4294932186603546,
0.1464423090219497... | |
can be consuming so much memory, so fast??!!!
This would suggest that you're likely creating a lot of "garbage" - basically, creating and letting many objects go out of scope quickly, but which take long enough to get into Gen1 or Gen2. This puts a large burden on the GC, which in turn can cause freezes and hangs on ma... | [
0.12629742920398712,
-0.10243257135152817,
-0.015027627348899841,
0.27853792905807495,
0.044200241565704346,
-0.28606221079826355,
0.3833848237991333,
0.06008926406502724,
-0.5117464661598206,
-0.654926061630249,
0.16698938608169556,
0.13619840145111084,
-0.21934112906455994,
0.03463653102... | |
time you take a memory snapshot. This would make it look like there is no memory "leak" (as there isn't), but does not show the total memory pressure on the system.
A tool like [PerfView](http://blogs.msdn.com/b/vancem/archive/2011/12/28/publication-of-the-perfview-performance-analysis-tool.aspx) could be used to inve... | [
0.10155842453241348,
-0.13803279399871826,
0.45038682222366333,
0.071114182472229,
0.13292908668518066,
-0.09408103674650192,
0.24377946555614471,
-0.07811135053634644,
-0.5871930122375488,
-0.5978708863258362,
-0.17149010300636292,
0.5327884554862976,
-0.039365239441394806,
0.086928553879... | |
```
class classe (){
public:
int key;
static void *funct(void *context){
printf("Output: %d, ", key);
}
void Go(){
classe c = static_cast<this>(context); //<- This doesn't work, Context of this-> goes here
pthread_create(&t, NULL, &classe::funct, c);
}
};
int main(){
... | [
0.17046745121479034,
0.09255729615688324,
0.3129502534866333,
-0.28624430298805237,
0.2538248896598816,
-0.02303648181259632,
0.1856663078069687,
-0.1362246572971344,
-0.0364622138440609,
-0.46894267201423645,
-0.6741224527359009,
0.8670766353607178,
-0.5009082555770874,
0.2664525806903839... | |
`Output: 15, Output: 18,`, the thing is to get context of `this` throws error.
Someone know how to fix this?
I can see a few problems with your code:
First, `static_cast<>` requires a type in the `<>`, and `this` acts like a variable (so not a type). The type of `this` is `classe*` (pointer to `classe` object) within... | [
-0.0004784847260452807,
0.0972340852022171,
-0.07947338372468948,
-0.006204656790941954,
0.04838551953434944,
-0.13822400569915771,
0.21635350584983826,
-0.08498838543891907,
0.029930589720606804,
-0.5794869065284729,
-0.09331928938627243,
0.6815010905265808,
-0.5123595595359802,
0.2200893... | |
(`classe::funct`). Class memeber functions require an object to work on (sort of like an implicit parameter == `this`). You also don't have a `t` defined in `classe::Go()` that you could pass to `pthread_create()`
You could try:
```
static void *funct(void *key){ // funct is now a free function, all data is provided ... | [
-0.05111953243613243,
-0.24653665721416473,
0.20962414145469666,
-0.14826537668704987,
0.023227399215102196,
-0.040174636989831924,
0.20073698461055756,
-0.12807010114192963,
0.15091469883918762,
-0.6259878873825073,
-0.5520311594009399,
0.5108372569084167,
-0.5032727122306824,
0.245390579... | |
c;
c.key = 15;
c.Go();
c.key = 18;
c.Go();
}
``` | [
0.04219833388924599,
0.06464477628469467,
0.29465416073799133,
-0.5179110765457153,
0.423591673374176,
-0.3019566237926483,
0.053019970655441284,
-0.05075446516275406,
-0.2487790733575821,
-0.06034282594919205,
-0.7166821360588074,
1.0462485551834106,
-0.3784100115299225,
0.210711672902107... | |
I have the following Table elements how do i run a query that reproduce the table but hav an extra row at the bottom showing the sum of col2
```
Col1 | col2
---------------
Water | 22
water | 3
water | 5
Air | 10
Earth | 3
Air | 5
```
I don't know why you want that but ... | [
0.004278993234038353,
0.5088431239128113,
0.6429096460342407,
0.13570450246334076,
-0.22000211477279663,
0.4866570234298706,
0.028313204646110535,
-0.3764611780643463,
-0.14337992668151855,
-0.38125741481781006,
0.041815005242824554,
0.0020393459126353264,
-0.23164168000221252,
0.135398209... | |
a try:
```
SELECT Col1, Col2 FROM tableName
UNION
SELECT 'SUM' as Col1, SUM(Col2) Col2 FROM tableName
``` | [
-0.6072379350662231,
-0.08892003446817398,
0.4041065275669098,
-0.2969799041748047,
0.045905642211437225,
0.30077120661735535,
-0.02890155464410782,
-0.20085272192955017,
-0.20538827776908875,
-0.5457804203033447,
-0.5191724300384521,
0.18696817755699158,
-0.3158153295516968,
-0.0626869276... | |
I'm trying to get a very simple test of Amazon SimpleDB running with Node.js/Express. This is the code I'm using (AWS key/secret sanitized, of course):
```
var express = require('express');
var simpledb = require('simpledb');
var app = express.createServer();
var sdb = new simpledb.SimpleDB(
{keyed:'MYKEY', s... | [
0.302855521440506,
-0.0026107507292181253,
0.6119825839996338,
-0.09208958595991135,
0.05129137635231018,
0.03881007060408592,
0.6531689763069153,
-0.6088396906852722,
-0.03396233916282654,
-0.7588257193565369,
-0.04396040365099907,
0.47950682044029236,
-0.5156028270721436,
0.0717553645372... | |
is the error I'm getting:
```
DEBUG: simpledb: 2012-04-06T01:34:24.856Z create {"keyid":"MYKEY","secret":"MYSECRET","secure":false,"consistent":true,"test":false,"maxtry":null,"expbase":null,"delaymin":null,"delayscale":null,"randomdelay":null} {"secure":false,"host":"sdb.amazonaws.com","path":"/","version":"2009-04-... | [
-0.7381566166877747,
0.07697127014398575,
0.3125135898590088,
-0.10644187778234482,
0.031072260811924934,
0.36926212906837463,
0.4514070451259613,
-0.3435901999473572,
-0.2640337646007538,
-0.4840092062950134,
-0.06632860749959946,
0.4433170557022095,
-0.3972567915916443,
0.033725555986166... | |
at closeTag (/home/rob/node_modules/simpledb/node_modules/aws-lib/node_modules/sax/lib/sax.js:226:5)
at Object.write (/home/rob/node_modules/simpledb/node_modules/aws-lib/node_modules/sax/lib/sax.js:567:29)
at Parser.<anonymous> (/home/rob/node_modules/simpledb/node_modules/aws-lib/node_modules/xml2js/lib/xml2j... | [
-0.13413791358470917,
0.2955121397972107,
0.3043128550052643,
-0.000056630025937920436,
-0.07848935574293137,
-0.09490711241960526,
0.5927510857582092,
-0.14075997471809387,
-0.23002225160598755,
-0.22339731454849243,
0.18467290699481964,
0.3612048029899597,
-0.24439992010593414,
0.2946804... | |
this seems to have been caused by the latest version of a
> dependent lib - I've rebuilt and publish a new version 0.0.8 - please
> let me know if this works - thanks!
[Source.](https://github.com/rjrodger/simpledb/issues/22) It has since been fixed. | [
0.11033505201339722,
0.1605490893125534,
0.6365540027618408,
-0.20763491094112396,
-0.002671947469934821,
-0.20851503312587738,
0.6103691458702087,
0.29738637804985046,
-0.4324607253074646,
-0.23861725628376007,
-0.25292518734931946,
0.3187558650970459,
-0.32077839970588684,
0.445483207702... | |
Using `htmlentities()` is there a way I can set to allow only `<b>` and `<i>` to convert into bold and italic text? I know there was one way of doing this, but i have forgotten.
It's pretty easy
```
<?php
$string = htmlentities($text);
$string = str_replace(array("<i>", "<b>", "</i>", "</b>"), ... | [
-0.022889064624905586,
0.00411755358800292,
0.8390026688575745,
-0.335803747177124,
-0.2169474959373474,
0.16604651510715485,
0.5062592625617981,
-0.25115758180618286,
-0.30557116866111755,
-0.6538293361663818,
-0.3320314586162567,
0.5553433895111084,
-0.6284128427505493,
-0.19840584695339... | |
I'm wondering how many images I can store in the iPhone documents directory so that I don't get any memory issues. I'm torn between caching images or loading them from a webserver every time the user wants to access them. There most likely won't be more than 10-20 images cached at any given time...
Any thoughts?
The e... | [
0.14103612303733826,
0.25165724754333496,
0.33760544657707214,
-0.14726780354976654,
0.23953650891780853,
0.3542635440826416,
0.305877149105072,
-0.08140699565410614,
-0.29373130202293396,
-0.7512000799179077,
-0.05855124071240425,
0.5501977205276489,
-0.3899925649166107,
-0.21009202301502... | |
);
```
Or without the typedef (in a harder to read one-liner):
```
register_enum< shader::FUNC >( L, "functions",
(const char *(*)( shader::FUNC ))shader::to_cstring );
```
\*Note that in function signatures, the top-level `const` gets removed.
The next question is why did the compiler not find the ... | [
-0.17268967628479004,
0.13035476207733154,
0.26720505952835083,
-0.1121755838394165,
-0.024234836921095848,
-0.05903759226202965,
0.1476772427558899,
-0.3479676842689514,
0.01888950541615486,
-0.5006223320960999,
-0.4467596411705017,
0.5347055196762085,
-0.4829224646091461,
0.2013251334428... | |
infer the type of the argument to the constructor, the compiler must know which overload you want to use. | [
0.10961072146892548,
0.3771440386772156,
-0.3126750886440277,
0.13542553782463074,
-0.16044850647449493,
0.17241571843624115,
-0.007704883813858032,
-0.26124393939971924,
0.2149706482887268,
-0.3202398717403412,
-0.21640744805335999,
0.5882066488265991,
-0.2570638954639435,
-0.177698969841... | |
I'm doing video processing tasks and one of the problems I need to solve is choosing the appropriate encoding algorithm for a video that has just one static image throughout the entire video.
Currently I tried several algorithms, such as DivX and XviD, but they produce 3MB video for a 1 minute long video. The audio is... | [
0.11867711693048477,
-0.03921414539217949,
0.6438831686973572,
0.2842179536819458,
-0.17061057686805725,
-0.08689340204000473,
0.23075369000434875,
-0.3539316952228546,
-0.4299236834049225,
-0.5220107436180115,
0.0809449851512909,
0.543942391872406,
-0.014864537864923477,
0.170868426561355... | |
expect this video to be about 550KB - 600KB and not 3MB.
Any ideas about how I could optimize the video so it's not that huge?
I hope this is the right stackexchange forum to ask this question.
Set the frames-per-second to be very low. Lower than 1fps if you can. Your goal would be to get as close to two keyframes (o... | [
0.4371977746486664,
-0.25256627798080444,
0.5988364219665527,
0.2646200656890869,
0.06420805305242538,
-0.11849837750196457,
0.16764886677265167,
-0.38286247849464417,
-0.25144630670547485,
-0.7004479169845581,
0.30401650071144104,
0.37405672669410706,
-0.13557355105876923,
-0.216116383671... | |
maximum interval between keyframes in frames (default: 250 or one keyframe every ten seconds in a 25fps movie.
>
>
> This is the recommended default for MPEG-4). Most codecs require regular keyframes in order to limit the accumulation of mismatch error. Keyframes are also needed for seeking, as seeking is only possib... | [
0.14941921830177307,
-0.1392543762922287,
0.5805763006210327,
0.12776531279087067,
-0.0316329300403595,
-0.01766865700483322,
0.3780401349067688,
-0.5236551761627197,
-0.1094539538025856,
-0.5795198678970337,
-0.029746010899543762,
0.45801669359207153,
-0.23865224421024323,
-0.174707323312... | |
decoder, encoder and luck. It is common for MPEG-1/2 to use values <=30.
xvidenc:
> max\_key\_interval= - maximum interval between keyframes (default: 10\*fps)
Interestingly, this solution may reduce the ability to seek in the file, so you will want to test that. | [
-0.016690490767359734,
0.00837346725165844,
0.3222375512123108,
0.1454094648361206,
-0.004274230916053057,
-0.0025634239427745342,
0.2252061516046524,
-0.30422160029411316,
-0.16060520708560944,
-0.6291207671165466,
-0.12386155873537064,
0.7654789686203003,
-0.3636353313922882,
-0.06565681... | |
I have the following application\_controller method:
```
def current_account
@current_account ||= Account.find_by_subdomain(request.subdomain)
end
```
Should I be calling it using a before\_filter or a helper\_method? What's the difference between the two and what should I consider in terms of the trade-offs... | [
-0.07753557711839676,
-0.06446880102157593,
0.6321090459823608,
-0.059186771512031555,
0.12345519661903381,
-0.079686239361763,
0.013008455745875835,
-0.1628624051809311,
-0.42328086495399475,
-0.6633870601654053,
-0.06737623363733292,
0.4305734932422638,
-0.2751956880092621,
0.47028493881... | |
:current_user
end
```
**helpers/sessions\_helper.rb**
```
module SessionsHelper
private
def current_account
@current_account ||= Account.find_by_subdomain(request.subdomain)
end
def current_user
@current_user ||= User.find(session[:user_id]) if session[:user_id]
end
def logged_in?
if cur... | [
-0.2110958844423294,
0.1003233939409256,
0.8038575053215027,
-0.032063644379377365,
0.3609759509563446,
-0.22707431018352509,
0.06777699291706085,
-0.3557701110839844,
-0.5476500391960144,
-0.48004913330078125,
-0.31797948479652405,
0.6566240787506104,
-0.28767913579940796,
0.4696380198001... | |
should use helper method when you have a method in your controller that you would like to reuse in your views, this current\_account might be a nice example for helper\_method if you need to use it in your views. | [
0.08317992091178894,
-0.3084697127342224,
0.3999221920967102,
0.5618413686752319,
0.08777910470962524,
-0.2161053717136383,
-0.1120186448097229,
0.38084617257118225,
-0.2751883864402771,
-0.661690890789032,
0.32799220085144043,
0.45404526591300964,
-0.18058261275291443,
0.08116020262241364... | |
I used couchdb's PHP lib to add a view:
```
public function addView() {
$design_doc = new stdClass();
$design_doc->_id = '_design/need';
$design_doc->language = 'javascript';
$design_doc->views = array( 'all' => array('map' => "function(doc) { if (doc.type == 'need') emit(doc.type, doc) }" ) );
$r... | [
0.2709731459617615,
0.00978103093802929,
0.8077569007873535,
-0.34373751282691956,
-0.3480471670627594,
0.19140732288360596,
0.0660005435347557,
-0.4616592526435852,
-0.01468746643513441,
-0.8853177428245544,
0.20905929803848267,
0.5326765179634094,
-0.3287246823310852,
0.19548989832401276... | |
{
"map":"function(doc) { if (doc.type == 'need') emit(doc.type, doc) }"
}
}
}
```
Then when trying to actually execute the view, it throws eacces error:
```
curl -X GET mysite.com/bids/_design/need/_view/all
{
"error":"error","reason":"eacces"
}
```
**Permissions**: the instance is running... | [
-0.19636966288089752,
0.007899317890405655,
0.48622453212738037,
-0.09075969457626343,
-0.46835219860076904,
0.07115499675273895,
0.38641417026519775,
-0.20909501612186432,
-0.002976180287078023,
-0.5773856043815613,
0.023610547184944153,
0.6381883025169373,
-0.3313049376010895,
0.13918066... | |
was successful and the view was then able to run properly | [
0.010179134085774422,
-0.22266075015068054,
0.6430256366729736,
-0.39627620577812195,
-0.02963769994676113,
-0.15345562994480133,
0.5786339044570923,
0.07231438159942627,
-0.0896124616265297,
-0.044231168925762177,
0.221650168299675,
0.5861582159996033,
0.4424446225166321,
0.00358831626363... | |
I have a seemingly simple problem, but I can't quite figure out a solution. I am creating a database design to store goals. The goals are updated manually, and I need an entry each time the goal is updated. For Example:
Lose 10 pounds:
Day 1: lost 1 pound.
Day 3: lost 2 pounds.
day 7: lost 7 pounds.
And then once th... | [
0.4167284667491913,
0.3279731273651123,
0.46389541029930115,
-0.059692610055208206,
-0.11506472527980804,
0.38308751583099365,
0.2919946312904358,
-0.36693820357322693,
-0.3178272843360901,
-0.6602818369865417,
0.5407313704490662,
-0.18885286152362823,
-0.22190465033054352,
0.0853077024221... | |
- int - PK
GoalId - int - FK
IntervalX - string?
IntervalY - string?
GoalAmount - String?
Is this the best way to track this? Has anyone seen a base schema out there I can build off of to accomplish this?
Another thought I had was maybe use this design for all my raw data, and rely on stored procedure and views ... | [
-0.21330174803733826,
-0.2118038833141327,
0.5099182724952698,
0.11875320971012115,
-0.20123526453971863,
0.14214670658111572,
-0.04602685198187828,
0.15289005637168884,
-0.3112647533416748,
-0.35839128494262695,
0.34604567289352417,
0.010319831781089306,
-0.32721948623657227,
-0.132022574... | |
then the x axis will go 1,2,3,... and Y will go 10,20,30,... (This is something else entirely I need to figure out the best way to implement, but that's on the backburner for now)
Types of goals are tricky since there are many I would like to do. They will need to be a bunch of different data types:
Examples of goals... | [
0.5821961164474487,
-0.08754537254571915,
0.35641059279441833,
0.3781173825263977,
-0.07772798091173172,
0.058256156742572784,
0.030839018523693085,
-0.010529018938541412,
-0.14839774370193481,
-0.5723685026168823,
0.42422595620155334,
0.5708411335945129,
-0.10259880870580673,
0.1012382358... | |
certianly on the right track. The only other thing I can recommend is looking into key value indicators, and using this principle in your design. KVIs (or KPIs, as they're referred to in management) are values of disparate sources, which are converted into a common set of values that can be processed using common logic... | [
0.3297668397426605,
0.1701039969921112,
0.17086318135261536,
0.5264091491699219,
0.04265075922012329,
-0.14487296342849731,
0.13310401141643524,
-0.12067516148090363,
-0.24151019752025604,
-0.3921333849430084,
0.17137031257152557,
0.44575339555740356,
0.27993106842041016,
0.169884294271469... | |
The milestone is the value the needs to have a common processing value, or key value indiator. For example, losing 10 pounds, you could have a key value type of "Weight Loss", converting 1 pound to 1 KVI. Where you wish to compare milestones with one another, you may wish to adjust the weights. For example, I wish to b... | [
0.2962629497051239,
0.13235849142074585,
0.14871133863925934,
0.5194301009178162,
0.11781814694404602,
0.1824847161769867,
0.394447386264801,
0.00025262031704187393,
-0.3276579976081848,
-0.5489892363548279,
0.3877130448818207,
0.11114879697561264,
0.3432843089103699,
0.006622807122766972,... | |
1 pound. More like 30 miles. Cutting sugar from my diet is not easy, but let's call the KVI "Days without sugar", and give each day without sugar a value equivalent to half a pound. The KVIs are then:
```
1 pound = 2 KVI
1 day without sugar = 1 KVI
1 mile = 1/30 KVI
```
If I ride an extra 15 miles per day, I can pro... | [
0.21174581348896027,
0.000773859559558332,
0.29695820808410645,
0.13185834884643555,
-0.3914032578468323,
-0.013342814520001411,
0.6686743497848511,
-0.16039541363716125,
-0.33738231658935547,
-0.41272395849227905,
0.5558417439460754,
0.4076978862285614,
-0.005898278206586838,
-0.399570643... | |
my overall goal. However, I can't go over that and still expect to feel healthy. My milestone for this goal would therefore look something like:
```
Lose 10 pounds: KVIType="Weight Loss", Target=20KVI, cap=100%
No sugar for period (let's say 2 weeks):KVIType="Days without sugar", target=14KVI, cap=100%
Cycle 15 miles ... | [
0.39430826902389526,
0.11861566454172134,
0.12514540553092957,
0.07559467852115631,
-0.24367837607860565,
0.2688377797603607,
0.7918370962142944,
-0.036716002970933914,
-0.39080435037612915,
-0.6432582139968872,
0.2496652752161026,
0.41089755296707153,
0.10529524087905884,
-0.4199094474315... | |
grammar course completed, for example
1000 words vocabulary = 100 KVI
Conversation = 20 KVI
```
In this example, you would cap each milestone at 100%. You may know the grammar off by heart and have 10,000 words under your belt, but until you've spent some time speaking the language, you haven't learned it.
By adjust... | [
0.44719040393829346,
0.4881380498409271,
0.015085041522979736,
0.0023278752341866493,
-0.14158351719379425,
0.29261934757232666,
0.6830934882164001,
-0.47591888904571533,
-0.06938452273607254,
-0.661677896976471,
0.23153725266456604,
0.35433611273765564,
0.27345049381256104,
-0.20075209438... | |
is 100 pounds overweight and has to for health reasons, so he'd have a higher KVI value for that one. You can also expand on how the milestones are combined to provide a progress indication of the goal (i.e. using the sum of all KVIs, average or minimum percentage completed for any component milestone).
This is sort o... | [
0.14330393075942993,
-0.24674081802368164,
0.6395768523216248,
0.15396536886692047,
0.08740841597318649,
0.21125899255275726,
0.030795475468039513,
-0.5733457803726196,
-0.08936391770839691,
-0.5159716010093689,
-0.08362612873315811,
0.26415321230888367,
0.03453077748417854,
0.015950474888... | |
1) PRIMARY KEY CLUSTERED,
UserId INT FOREIGN KEY REFERENCES User(UserId),
GoalName VARCHAR(50),
GoalStart DATETIME,
GoalComplete DATETIME,
TargetKVI DOUBLE PRECISION,
CurrentKVI DOUBLE PRECISION
)
CREATE TABLE Milestone (
MilestoneId INT IDENTITY(1,1) PRIMARY KEY CLUSTERED,
GoalId INT F... | [
-0.06775364279747009,
-0.17777377367019653,
0.6173104643821716,
0.1108647882938385,
0.07354612648487091,
0.3196111023426056,
-0.31922709941864014,
-0.33721038699150085,
-0.03149248659610748,
-0.7102740406990051,
-0.005527357570827007,
0.3455364406108856,
-0.0355774350464344,
-0.03538656234... | |
CompletedDate DATETIME,
Cap INT)
CREATE TABLE Progress (
ProgressId INT IDENTITY(1, 1) PRIMARY KEY CLUSTERED,
MilestoneID INT FOREIGN KEY REFERENCES Milestone(MilestoneId),
InputValue DOUBLE PRECISIoN,
KVIValue DOUBLE PRECISION,
OccuranceDate DATETIME
)
CREATE TABLE User (
UserId INT IDENT... | [
0.06142258644104004,
-0.06472785770893097,
0.816114068031311,
-0.11930179595947266,
0.06560058146715164,
0.33664053678512573,
-0.12665162980556488,
-0.2906304895877838,
-0.05010693892836571,
-0.610811710357666,
-0.09956563264131546,
0.04019707441329956,
0.2803095877170563,
0.10703298449516... | |
I'm running this code in Firefox 11 on Windows 7. (See <http://jsfiddle.net/QStkd/>).
```
$('<div><input type="text" value="val" /></div>').dialog();
```
The value in the input isn't selected, which is does do in Chrome and IE, it also doesn't work if I manually call the `select()` method.
Is this a known problem... | [
0.2504701614379883,
-0.15235871076583862,
0.6516503691673279,
-0.42761531472206116,
0.04737195372581482,
-0.19121123850345612,
0.3298414945602417,
-0.20450620353221893,
-0.037748996168375015,
-0.8060744404792786,
-0.3269228935241699,
0.7884472608566284,
-0.6458260416984558,
-0.357570290565... | |
from [jquery.dialog.ui.js](https://github.com/jquery/jquery-ui/blob/1.8.16/ui/jquery.ui.dialog.js#L352):
```
// set focus to the first tabbable element in the content area or the first button
// if there are no tabbable elements, set focus on the dialog itself
$(self.element.find(':tabbable').get().concat(
uiDialo... | [
0.06290078908205032,
-0.19084231555461884,
0.7728762626647949,
-0.28367239236831665,
-0.02578870952129364,
-0.05320277065038681,
0.0633455440402031,
-0.16052980720996857,
-0.20317871868610382,
-0.5214238166809082,
-0.48174798488616943,
0.7049341201782227,
-0.42225873470306396,
-0.259486645... | |
jsFiddle is actually the culprit here (possibly the hashchange event, or some focus event on one of the panes after you press 'run' -- I haven't dug that deeply).
**EDIT**: (sorry, it's late) Looks like the root cause of the "problem" is Firefox. Not sure if this is designed behavior or not, but from what I can see, i... | [
0.4012784957885742,
0.10502029210329056,
0.4520655572414398,
-0.25496187806129456,
-0.27288803458213806,
-0.18093642592430115,
0.5949591994285583,
0.3084806799888611,
-0.29854902625083923,
-0.8562777638435364,
-0.08433833718299866,
0.6775857210159302,
-0.44332870841026306,
-0.0500338003039... | |
has two iframes side by side (let's call them left and right). Left contains a textarea, and right contains your jquery-ui dialog -- similar to the fiddle you posted. right has the following code:
```
<script type="text/javascript">
$('<div><input type="text" value="val" /></div>').dialog();
$('input').select();
</scr... | [
-0.058017756789922714,
-0.005902112927287817,
0.7295301556587219,
-0.3281950056552887,
-0.14165905117988586,
0.38884809613227844,
-0.172210231423378,
-0.30102935433387756,
-0.050146784633398056,
-0.9194579720497131,
0.10955248773097992,
0.3997226059436798,
-0.07537990063428879,
-0.36668965... | |
I have an array that looks like this
```
Array
(
[0] => Array
(
[Title] => The Title
[Price] => 700
[Quantity] => 2
)
)
```
Say I wanted to change the Quantity to 5 how would I do that if the array were stored in the variable $ItemArray?
Try `$itemArray[0]['... | [
0.35984891653060913,
-0.06091739237308502,
0.30738258361816406,
-0.06561246514320374,
-0.05016619339585304,
0.3224582374095917,
0.019468573853373528,
-0.43548840284347534,
-0.26016902923583984,
-0.32919126749038696,
0.07480250298976898,
0.7240246534347534,
-0.1972922384738922,
0.4282805621... | |
you have an array, `$itemArray`, which contains an [associative array](http://php.net/manual/en/language.types.array.php). To access that inside array, you simply use standard PHP array syntax: `$itemArray[0]`.
Then, you need the `Quantity` field of that inner array. Using the nested array syntax, you append `['Quanti... | [
0.03454619273543358,
-0.022794382646679878,
0.31896600127220154,
-0.0008022654219530523,
-0.2475140541791916,
0.29141706228256226,
0.007797657512128353,
-0.31125718355178833,
-0.10953665524721146,
0.004839870147407055,
-0.33706387877464294,
0.5579612851142883,
-0.205222949385643,
0.0857641... | |
I know that a function pointer stores the address of a function.
```
int fun(int x){
//return something
}
int (pfun*)(int)=&fun;
int main(){
std::cout << &fun << "\n"; // this print out 1
std::cout << fun << "\n" ; // this print out 1
std::cout << &pfun << "\n"; // this print out 0x0022ff40
std::cout << pfun << ... | [
-0.16158871352672577,
0.04539148136973381,
0.5192059278488159,
0.0015732411993667483,
0.011382071301341057,
-0.2144167423248291,
0.30400797724723816,
-0.3301751911640167,
-0.14324268698692322,
-0.6081598997116089,
-0.1986057311296463,
0.42961570620536804,
-0.3957313299179077,
0.00639045238... | |
compiler change pfun value to a real pointer like 0X..... so that at runtime will know which function to call since the names doesn't existe after compilation?
The expressions `fun` and `&fun` have the same meaning: `&fun` which is equivalent to the value stored in `pfun`, so it is no wonder that the three of them yiel... | [
-0.09654071182012558,
0.02500179037451744,
0.0974673256278038,
-0.17933744192123413,
-0.2727818787097931,
0.09687256813049316,
0.14591573178768158,
-0.2338397204875946,
-0.11262211948633194,
-0.46804335713386536,
-0.2937577962875366,
0.5784918665885925,
-0.6059877276420593,
-0.244011387228... | |
to find the best match among the existing overloads which happens to be `bool` (a function pointer is implicitly convertible to `bool`). The function pointer will be converted to `false` only if the function pointer is null, which is not the case. The `true` value is finally printed as `1` (you can check this by doing:... | [
0.05271076411008835,
-0.012443330138921738,
0.24949757754802704,
-0.007114007603377104,
-0.13674885034561157,
-0.10960423946380615,
0.344338983297348,
-0.13601313531398773,
0.08495508134365082,
-0.574683427810669,
-0.26169753074645996,
0.8172623515129089,
-0.39243653416633606,
0.0199237857... | |
give you a number different than `1`... Note that the value might differ in different runs and basically has no meaning at all. | [
0.4354430139064789,
-0.18250203132629395,
-0.20386658608913422,
0.16995655000209808,
-0.10311286896467209,
-0.11345867812633514,
0.21043379604816437,
-0.2498917281627655,
-0.15820564329624176,
-0.20545142889022827,
-0.013483556918799877,
0.11547783762216568,
-0.21796633303165436,
0.1858535... | |
I have a place in my Django app where I need to construct a callback to my domain after a third-party auth, but I'm stuck on how to do this since that view in question doesn't really map to one model (or rather, the view code references multiple models), and the docs for get\_absolute\_url() construction and permalinks... | [
0.2780410647392273,
0.1657557487487793,
0.43872132897377014,
-0.34163719415664673,
-0.0008384531829506159,
-0.2180427759885788,
0.38324037194252014,
0.14818298816680908,
-0.2689673602581024,
-0.38978031277656555,
-0.21635816991329193,
0.6589577198028564,
-0.3579607903957367,
0.286746859550... | |
depend on my using generic views. Actually I don't understand why generating a permalink is even tied to models at all, it seems like it should only depend on the urlconf. What am I missing here?
`permalink` is a thin wrapper of `django.core.urlresolvers.reverse`. Its belongs to django.db.models to be a shortcut becaus... | [
0.17559804022312164,
-0.14625541865825653,
0.5680283904075623,
-0.01728999614715576,
-0.3198932111263275,
0.07409952580928802,
-0.018314534798264503,
-0.15063586831092834,
0.09058360755443573,
-0.14917594194412231,
0.4557272791862488,
0.4877442419528961,
-0.25964123010635376,
0.44717374444... | |
callback URI is in the same domain w/ the view rendering the template, you could rely on [`request`](https://docs.djangoproject.com/en/1.4/ref/request-response/#django.http.HttpRequest.build_absolute_uri) to get actual absolute URI:
`request.build_absolute_uri(reverse('signup'))`
Furthermore, you may want to escape t... | [
-0.2977689802646637,
-0.018542390316724777,
0.6661393642425537,
-0.02575061470270157,
-0.11923224478960037,
-0.19340355694293976,
0.07576601952314377,
-0.24272076785564423,
-0.09597375988960266,
-0.13102874159812927,
-0.4561404585838318,
0.7882733941078186,
-0.3170320391654968,
0.094907440... | |
I'm investigating a Windows dump file in WinDBG. I can switch the call stack frame by command .frame, but I found that the registers always contain the last context.
I mean, if it is possible to restore the context which belongs to a specific call stack frame that is not the top one?
If you're debugging an x64 target, ... | [
0.24418962001800537,
0.25041019916534424,
0.21459202468395233,
-0.10705781728029251,
0.08226429671049118,
-0.18619194626808167,
0.2993411719799042,
-0.16236349940299988,
-0.20679375529289246,
-0.5069818496704102,
-0.05611797049641609,
0.8062453269958496,
-0.3311336040496826,
0.158344462513... | |
work. .frame will still show you something for the registers, but it's not as likely to be correct (it will basically only be correct by luck). | [
0.9513832926750183,
-0.003629702376201749,
0.40403589606285095,
0.2791736423969269,
0.40113043785095215,
0.12789544463157654,
0.11436418443918228,
-0.47771120071411133,
-0.20658279955387115,
-0.38013485074043274,
0.1390714794397354,
0.35460442304611206,
0.24473229050636292,
-0.374466776847... | |
In Linux, to create a socket we include the sys/socket.h header file and use the socket() function. The header file is located at /usr/include/sys/socket.h.
```
extern int socket (int __domain, int __type, int __protocol) __THROW;
```
Can anyone please tell the location where the socket() function is actually imple... | [
0.16904683411121368,
0.02958310954272747,
0.2379780113697052,
-0.1199454516172409,
0.01860628090798855,
-0.015828479081392288,
-0.2727338373661041,
0.28316789865493774,
0.002464368473738432,
-0.8726513981819153,
-0.484584242105484,
0.46205535531044006,
-0.41319242119789124,
0.3334480524063... | |
Here's one of those ColdFusion things that seems like it should be so easy... but I'm not finding the easy path.
I have an array of lists.
The array could be any size, and the length of each list can be any size.
(this can be manipulated into a multi-dimensional array, whatever... the point is, i have a list of lists)... | [
0.1901153028011322,
0.11106414347887039,
0.3632907569408417,
0.10420886427164078,
-0.09860987961292267,
0.3352413773536682,
0.06750065088272095,
-0.4201318323612213,
-0.40994855761528015,
-0.5234209895133972,
0.30518728494644165,
0.05837346240878105,
-0.291689932346344,
0.00653118547052145... | |
short version, there would be 6 unique combinations. For the first longer example, we would have 3\*3\*3\*3\*2\*2 = 324 unique combinations.
Counting them is easy... but what's the best way get the actual combinations in a structured format?
Must be missing something simple... I've been very close for hours now!
:-/
... | [
0.5439998507499695,
-0.07634532451629639,
0.31456732749938965,
-0.04941842705011368,
-0.15988434851169586,
0.17532752454280853,
0.4418925642967224,
-0.3999379873275757,
-0.3188711404800415,
-0.5124994516372681,
0.1142750158905983,
0.4349956810474396,
-0.368344783782959,
-0.2163940668106079... | |
var _array = '';
var x = 0;
var i = 0;
var j = 0;
var _current = [];
for (x=1; x lte _arrayslen; x++) {
_size = _size * arraylen(arguments._arrays[x]);
_current[x] = 1;
}
for (i=1; i lte _size; i++) {
result[i] = [];
for (j=1; j | [
-0.26092830300331116,
-0.5183016061782837,
0.7601840496063232,
-0.5195184946060181,
-0.0995105430483818,
0.3644449710845947,
0.5065503120422363,
-0.5628829002380371,
-0.4235730469226837,
-0.15475867688655853,
-0.4039768874645233,
0.4338904619216919,
-0.33061453700065613,
0.1370594501495361... | |
lte _arrayslen; j++) {
arrayappend(result[i], arguments._arrays[j][_current[j]]);
}
for (j=_arrayslen; j gt 0; j--) {
if (arraylen(arguments._arrays[j]) gt _current[j]) {
_current[j]++;
break;
} | [
-0.3211122751235962,
-0.6355082988739014,
0.6807766556739807,
-0.5927230715751648,
0.024035761132836342,
-0.060990024358034134,
0.5194658041000366,
-0.45344972610473633,
-0.23155026137828827,
-0.17397478222846985,
-0.5032810568809509,
0.5451205968856812,
-0.4943334758281708,
-0.04314824193... | |
else {
_current[j] = 1;
}
}
}
return result;
}
</cfscript>
<cfset arrays = [[129,128,127],[130,131,132],[135,133,134],[137,138,136],[140,139],[141,142]]>
<cfset r = array_cartesian_product(arrays)>
<cfoutput>#arraylen(r)#</cfoutput>
<cfdump var="#r#">
``` | [
-0.06797342747449875,
-0.24960632622241974,
0.5327070951461792,
-0.31485021114349365,
0.13273394107818604,
0.5827898383140564,
0.0849514901638031,
-0.7143127918243408,
-0.403890997171402,
-0.2264534831047058,
0.09162962436676025,
0.4356904625892639,
-0.1347017139196396,
-0.0243491698056459... | |
I am making a TicTacToe game in Java I am required to use a two-dimensional array and to use recursion to check if there is a winner.
I feel like I could easily do a non-recursive check for a winner, but I don't know where to start if I were to use recursion to do it because I am very new at recursion. Could someone g... | [
0.2282382845878601,
0.15889401733875275,
0.12268627434968948,
-0.13640196621418,
-0.09421123564243317,
-0.17496530711650848,
0.18346382677555084,
-0.0886048972606659,
-0.014176678843796253,
-0.6944873929023743,
0.18665990233421326,
0.4074692130088806,
-0.28072410821914673,
-0.2901065349578... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.