text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
+------+
| p |
+------+
| 0.5 |
+------+
1 row in set (0.00 sec)
```
However, changing the p-value that I'm asking for:
```
SELECT p FROM rParam | [
-0.49072733521461487,
-0.02132559008896351,
0.6430762410163879,
-0.2862100899219513,
-0.03544049710035324,
0.48914003372192383,
0.1725926697254181,
-0.621149480342865,
-0.20683547854423523,
-0.3220716714859009,
-0.2459326535463333,
0.3656845688819885,
-0.2796115577220917,
-0.11059966683387... | |
WHERE p=0.6 GROUP BY p;
Empty set (0.00 sec)
```
but we can clearly see from the first output that there are rows for which p=0.6? This is a problem for most of the p-values - why does mySQL return the empty set?
This sounds like an rounding error. Floating point numbers cannot always be represented exact... | [
-0.5107051730155945,
-0.06316760927438736,
0.27787938714027405,
-0.033356115221977234,
-0.27414989471435547,
0.32761383056640625,
-0.020147819072008133,
-0.46609222888946533,
-0.3005222678184509,
-0.3777486979961395,
-0.1692562997341156,
0.20591424405574799,
-0.09863359481096268,
0.0298385... | |
instead of a `GROUP BY`. | [
-0.0009278298821300268,
0.04863547906279564,
-0.02236812748014927,
-0.23483550548553467,
-0.40831440687179565,
-0.06865623593330383,
0.3067064881324768,
-0.22856730222702026,
-0.46185097098350525,
-0.26952841877937317,
-0.589985191822052,
-0.15006199479103088,
-0.2944160997867584,
0.159236... | |
I have some fortran code compiled with intel fortran compiler ifort. When I do a profile test with gprof, I get that most of the time is used in IO operations, I think finding the end of the files, but I can no find any more documentation on this:
```
index % time self children called name | [
0.2158181220293045,
0.4765830636024475,
-0.10336782038211823,
-0.039912622421979904,
0.1490020751953125,
0.012436283752322197,
0.1533249318599701,
0.1960422843694687,
-0.02593049965798855,
-0.6861405968666077,
0.4092472791671753,
0.49820971488952637,
0.001263212296180427,
0.367145091295242... | |
<spontaneous>
[1] 20.6 0.07 0.00 _IO_wfile_seekoff [1]
-----------------------------------------------
<spontaneous>
[2] 20.6 | [
0.2684355676174164,
-0.32573410868644714,
0.2943071126937866,
-0.04081330448389053,
-0.3434053063392639,
-0.02015560306608677,
0.3434757590293884,
-0.47612735629081726,
0.03442078456282616,
-0.5120371580123901,
-0.04060469940304756,
0.25755706429481506,
-0.2962879240512848,
0.0276175942271... | |
0.07 0.00 sforcepf_ [2]
-----------------------------------------------
<spontaneous>
[3] 20.6 0.02 0.05 | [
0.38401728868484497,
-0.0329909473657608,
0.4376860558986664,
-0.020817846059799194,
-0.4138995110988617,
-0.25716105103492737,
0.4160054922103882,
-0.2799837589263916,
0.07826008647680283,
-0.30330967903137207,
-0.1979459673166275,
0.2664742171764374,
-0.20923097431659698,
-0.062490791082... | |
_IO_wfile_underflow [3]
0.01 0.04 258716/258717 strncmp [4]
-----------------------------------------------
0.00 0.00 1/258717 _IO_wdefault_doallocate [15]
0.01 0.04 258716/258717 _IO_wfile_underflow [3]
[4] | [
-0.4537852704524994,
0.27319493889808655,
0.6342316269874573,
-0.022462308406829834,
-0.11142609268426895,
0.15741194784641266,
0.3149126470088959,
-0.41819489002227783,
-0.12064392864704132,
-0.3977961838245392,
-0.14155365526676178,
0.48892125487327576,
-0.16658468544483185,
0.2321793287... | |
14.7 0.01 0.04 258717 strncmp [4]
0.04 0.00 3104592/3109256 strerror_r [5]
-----------------------------------------------
0.00 0.00 4664/3109256 __strcmp_sse42 [14]
0.04 0.00 | [
-0.5661764144897461,
0.2754105031490326,
0.819453239440918,
0.09698701649904251,
-0.09316316246986389,
0.11629851162433624,
0.3676031231880188,
-0.2995457351207733,
-0.5449795722961426,
-0.5067858099937439,
-0.2587180733680725,
0.6019377112388611,
-0.10992473363876343,
0.3121998608112335,
... | |
3104592/3109256 strncmp [4]
[5] 11.8 0.04 0.00 3109256 strerror_r [5]
-----------------------------------------------
```
So, the question would be, is this IO specific to Linux, or to ifort, or to fortran? I am trying to optimize this code, and have found no useful info about this terms in goog... | [
0.049178168177604675,
0.28513067960739136,
0.324919193983078,
-0.005593132693320513,
-0.28096306324005127,
-0.11993257701396942,
0.06281035393476486,
-0.12773847579956055,
-0.09739313274621964,
-0.3948969542980194,
-0.027491962537169456,
0.6131460070610046,
-0.32350507378578186,
-0.0831002... | |
you are writing Fortran statements to compare strings, and the Intel Fortran compiler is calling an existing function to implement the comparisons. Some of those system functions will themselves be implemented (in part) by calls to even more fundamental functions provided on your platform.
`gprof` is showing you the c... | [
0.27882739901542664,
0.36679360270500183,
0.049421537667512894,
0.018234655261039734,
-0.12948057055473328,
-0.13945667445659637,
-0.0811462327837944,
-0.15763355791568756,
-0.061049655079841614,
-0.38326677680015564,
-0.2314586341381073,
0.6119166016578674,
-0.44832491874694824,
-0.108048... | |
compilers, that all Intel compilers use the same (Intel-created) function for some operation and that that function uses platform-specific lower-level functions.
Unless you are prepared to rewrite these low-level functions, and take the risk that you will screw them up for other programs using the same functions, then... | [
0.5040212869644165,
0.29489776492118835,
-0.2322062999010086,
0.28439855575561523,
-0.01782204397022724,
-0.12013482302427292,
0.3605135381221771,
-0.09412522614002228,
-0.061087701469659805,
-0.44212833046913147,
-0.1283162385225296,
0.5610148906707764,
-0.3777141571044922,
-0.26680681109... | |
deal with the error that arises, then you may want to implement a superior program strategy. That will be easier than re-writing the low-level I/O routines which deal with the consequences of your strategy. | [
0.1496378481388092,
0.2579967975616455,
-0.0831894725561142,
0.10523790866136551,
0.17584280669689178,
-0.03512408956885338,
0.30936989188194275,
-0.14001096785068512,
0.08539891988039017,
-0.6761454343795776,
-0.15109111368656158,
0.8526938557624817,
0.048051971942186356,
-0.3639019131660... | |
I have read all possible answer [here](https://stackoverflow.com/questions/4533317/netbeans-with-glassfish-have-no-suitable-driver-found-for-mysqljdbc) and [here](https://stackoverflow.com/questions/9622105/java-sql-sqlexception-no-suitable-driver-found-for-netbeans) and [here](https://stackoverflow.com/questions/28393... | [
0.04361448809504509,
0.22624137997627258,
0.19624556601047516,
-0.15690328180789948,
-0.21836751699447632,
-0.018702233210206032,
0.4015195071697235,
-0.12163664400577545,
-0.23012426495552063,
-0.6253489255905151,
0.054517440497875214,
0.5729244947433472,
-0.24372878670692444,
0.213805526... | |
use it in Tomcat you have to explicitly load jdbc driver. I experienced the same error in a servlet in Tomcat. And adding `Class.forName("com.mysql.jdbc.Driver");` solve it.
The other thing I think, is to put the jar file in your `WEB-INF/lib`, then in your project properties, in Libraries, add the JAR you store in `W... | [
-0.1639498472213745,
0.34572312235832214,
0.0038417507894337177,
-0.21865761280059814,
-0.17033317685127258,
-0.11067821085453033,
0.23124483227729797,
-0.05108794569969177,
-0.20523987710475922,
-0.5052339434623718,
0.21990887820720673,
0.7182317972183228,
-0.47708234190940857,
0.04340730... | |
I have a very large std::vector of std::vectors containing a fixed number of unsigned integers.
All vectors of uints are sorted ascending.
My current way to eliminate duplicate vectors is
```
unsigned int i = 0;
while ( i < new_combs.size() )
{
unsigned int j = i + 1;
while ( j < new_combs.size() )
{
unsi... | [
-0.2984618544578552,
0.12096481770277023,
0.7250754237174988,
-0.09343387186527252,
0.0005561822326853871,
0.30806782841682434,
0.47213858366012573,
-0.47943970561027527,
-0.2614282965660095,
-0.8090221285820007,
0.0983397513628006,
0.3837658166885376,
-0.35211148858070374,
0.5500024557113... | |
new_combs.erase(new_combs.begin() + j);
else
++j;
}
++i;
}
```
here, new\_combs is a vector containing vectors as mentioned above.
Is there a more efficient way to eliminate duplicates if the vector of vectors is unsorted?
A shorter way would be using `<algorithm>`:
```
std::sort(new_combs.begin(),... | [
-0.0809565931558609,
0.007851563394069672,
0.4627046585083008,
-0.13701647520065308,
-0.09428256750106812,
0.003172814380377531,
0.3008747696876526,
-0.46780306100845337,
-0.5275659561157227,
-0.9768479466438293,
-0.1784994751214981,
0.44296956062316895,
-0.6395708322525024,
0.319409996271... | |
I have a `Dynamic Web Project` in Eclipse which has a dependency to another Java project in my workspace. When running the web project in the build-in Tomcat server, I've added the project dependency to the class path in the *run configuration*. I would like to create a WAR for deploying the web project on an external ... | [
0.45101651549339294,
0.24364107847213745,
-0.19692280888557434,
-0.09863682091236115,
-0.49697160720825195,
0.16673608124256134,
0.18435175716876984,
-0.08793402463197708,
-0.25190746784210205,
-0.5166022777557373,
0.2190229892730713,
0.9358822107315063,
-0.5777434706687927,
0.192036092281... | |
where my dependencies are included?
[Maven multimodule project](http://maven.apache.org/plugins/maven-eclipse-plugin/reactor.html) is well suited here,
If you don't want to go for it then just the build the dependency into (.jar) add it to runtime dependency of web project(/WEB-INF/lib) and build up the WAR | [
0.4843776822090149,
0.09562777727842331,
0.05281998589634895,
-0.06865295767784119,
-0.18888697028160095,
-0.2870440185070038,
0.19677230715751648,
-0.3832673728466034,
-0.07112719863653183,
-0.34202176332473755,
0.1690099686384201,
0.5601364970207214,
-0.012321163900196552,
0.141324460506... | |
On click of OK in jAlert nothing is triggered, even the dialog box doesn't close:
```
$(document).ready(function () {
$("#confirm_button").click(function () {
jAlert("Submitted", "Approval", function () {
//My code goes in here
});
});
});
```
I need to get the event on OK c... | [
-0.06576181948184967,
0.052153538912534714,
0.567031741142273,
-0.12623673677444458,
0.017794234678149223,
-0.37698793411254883,
0.39018118381500244,
-0.2632681429386139,
-0.08133453130722046,
-0.5187911987304688,
-0.488331139087677,
0.626130223274231,
-0.36845219135284424,
0.1127981096506... | |
charset="utf-8" type="text/javascript"></script>
<link href="jquery.alerts.css" charset="utf-8" rel="stylesheet" type="text/css" media="screen" />
<script type="text/javascript">
$(document).ready(function () {
$("#confirm_button").click(function () {
jAlert("Submitted", "App... | [
0.27626147866249084,
-0.07509222626686096,
0.5637903809547424,
-0.12857557833194733,
0.24427048861980438,
-0.03308327868580818,
0.17397083342075348,
-0.497383713722229,
0.03412218764424324,
-0.4112030863761902,
-0.682966411113739,
0.5101437568664551,
-0.4551178812980652,
-0.002492602216079... | |
});
});
</script>
</head>
<body>
<form runat="server">
<asp:Button ID="btnAlert" runat="server" Text="Click"/>
</form>
<input id="confirm_button" type="button" value="Show Confirm" />
</body>
</html>
```
`jAlert` is supposed to be invoked like so:
```
$.jAlert(...)
```
Change that, and t... | [
0.2968519926071167,
-0.040330201387405396,
0.5721787810325623,
-0.2961121201515198,
0.24253103137016296,
-0.1654396504163742,
0.6341285705566406,
-0.5205861330032349,
-0.04243853688240051,
-0.44557657837867737,
-0.18442460894584656,
0.7259021401405334,
-0.2301594614982605,
-0.0373473353683... | |
I Want to know why the first statements works and why not second one in c++
```
char a[10]="iqbal"; // it works
a="iqbal"; // does not work
```
Strictly speaking, an array is not a pointer! ***And an array ( base address of the array ) cant be a modifiable lvalue***. ie it cannot appear on the left hand side of a... | [
0.33941707015037537,
0.1334727704524994,
0.20461776852607727,
-0.04319397360086441,
-0.1597733497619629,
0.07379032671451569,
0.04170800745487213,
-0.27185651659965515,
-0.21161334216594696,
-0.36415258049964905,
0.022822141647338867,
0.41074657440185547,
-0.3076545298099518,
0.26270481944... | |
[here](http://publib.boulder.ibm.com/infocenter/comphelp/v7v91/index.jsp?topic=/com.ibm.vacpp7a.doc/language/ref/clrc05lvalue.htm) so that you get an idea of things which cannot appear on the LHS of `=`
> char a[10]="iqbal"; // it works
In this case, internally what happens is
```
a[0] = 'i';
a[1] = 'q';
.
.
a[5... | [
0.055628303438425064,
0.37775570154190063,
0.1810602843761444,
-0.2572692036628723,
0.048684146255254745,
-0.2055467814207077,
0.39943546056747437,
-0.36723440885543823,
-0.3701905310153961,
-0.4549371004104614,
-0.38111308217048645,
0.2890028953552246,
-0.4192771315574646,
0.3695612549781... | |
I trying submit a picture in a Iframe (fancybox), but if I close the iframe I don't get the Data on the server.
(this code are inside the frame)
```
<a class="button" id="finishButton" onclick="closeME()"><span>@PhotoPremier.Resources.Global.btnSubmit</span></a>
<script>
function closeME() {
if (ValidationToSub... | [
0.25589796900749207,
0.04550555720925331,
0.6491718292236328,
-0.2599795162677765,
0.01735595241189003,
0.19830821454524994,
0.5002516508102417,
-0.7103832364082336,
-0.021153150126338005,
-0.7254024147987366,
-0.2145489901304245,
0.08216754347085953,
-0.4972306489944458,
0.052767995744943... | |
pointers only in certain circumstances. Read this [SO post](https://stackoverflow.com/questions/1461432/what-is-array-decaying) to learn when arrays decay into pointers. Here is one more [nice article](http://www.lysator.liu.se/c/c-faq/c-2.html) which explains the differences between arrays and pointers
Also read abo... | [
0.015046265907585621,
0.1349571943283081,
0.5007764101028442,
-0.0563872829079628,
-0.046068355441093445,
-0.020076526328921318,
0.11838008463382721,
-0.2985057234764099,
-0.5123249292373657,
-0.5748801827430725,
-0.2145748734474182,
0.27861541509628296,
-0.36642640829086304,
0.29165086150... | |
) = Address of "iqbal"
```
This is wrong as we cannot assign something to a number. | [
0.1548500955104828,
0.22086022794246674,
0.15434323251247406,
-0.24008755385875702,
-0.10482373833656311,
0.04861894249916077,
0.1536066234111786,
-0.43706050515174866,
0.046752311289310455,
-0.34883439540863037,
-0.4443522095680237,
0.007066694088280201,
-0.6705886125564575,
0.61720740795... | |
I am new to LINQ and sorry if my question have been asked
I have 2 classes
```
public class Person
{
int ID {get;set;}
string FirstName {get;set;}
string LastName {get;set;}
}
```
and
```
public class House
{
int ID {get;set;}
string Address {get;set;}
string ZipCode {get;set;}
int Pers... | [
0.38980403542518616,
0.1766982078552246,
0.5887755751609802,
-0.24759411811828613,
0.16711533069610596,
0.08749799430370331,
0.19954250752925873,
-0.60182124376297,
-0.0978781133890152,
-0.8278946280479431,
-0.2478295862674713,
0.16557325422763824,
-0.2148904651403427,
0.2158384472131729,
... | |
=> new
{
id = h.ID,
Address= h.Address,
Zip= h.ZipCode ,
PersonFirstName = GetPersonByID(h.PersonId ).FirstName,
PersonLastname = GetPersonByID(h.PersonId ).lastname
});
```
Where GetPersonByID returns an object of Type `Person` that has the given ID. and then I take his first name and last name... | [
-0.2782514989376068,
-0.20421017706394196,
0.42972856760025024,
-0.060608766973018646,
0.02223833277821541,
0.16025027632713318,
0.20154431462287903,
-0.2662162184715271,
-0.12177864462137222,
-0.7654544115066528,
0.028114736080169678,
0.30738577246665955,
-0.03445741534233093,
0.358330339... | |
in SQL where you join a value from another table.
Thanks you very much for any help
You're extremely close! Using your code (and making all properties on House and Person public), here is a method using the LINQ Join method:
```
var st = GetAllHouses().Join(GetAllPersons(),
outerKey => outerKey.PersonId,
inne... | [
0.12036913633346558,
0.2026357352733612,
0.21761897206306458,
-0.0979715883731842,
0.01802031323313713,
-0.06513190269470215,
0.2127234935760498,
-0.5296186804771423,
-0.1459100842475891,
-0.44573020935058594,
-0.14422449469566345,
0.2728964388370514,
-0.17965494096279144,
0.16780509054660... | |
PersonLastname = person.LastName
});
```
Note: I would recommend the GetAllPersons() and the GetAllHouses() methods return IQueryable rather than IEnumerable. Doing so will build the expression (including the join), which means LINQ-to-SQL (or Entities) will build a proper SQL statement with the JOIN included, in... | [
-0.2021855115890503,
0.147284135222435,
0.4912090301513672,
0.04975156486034393,
0.030305085703730583,
-0.08986884355545044,
0.16604875028133392,
-0.18218620121479034,
-0.03167512267827988,
-0.2974734902381897,
-0.4093215763568878,
0.5880072116851807,
-0.08861871063709259,
0.00227858289144... | |
I need to use NSPredicate to match two strings, case-insensitive, diacritic insensitive, **and whitespace-insensitive**.
The predicate would look something like this:
```
[NSPredicate predicateWithFormat:@"Key ==[cdw] %@", userInputKey];
```
The 'w' modifier is an invented one to express what I'd like to use.
I ca... | [
0.2594537138938904,
0.06634248048067093,
0.31188273429870605,
-0.13029265403747559,
-0.0001712621742626652,
0.18001140654087067,
0.10163284838199615,
-0.3540608286857605,
0.1523638516664505,
-0.8726235032081604,
-0.08907090127468109,
0.6220198273658752,
-0.32555484771728516,
0.096501715481... | |
match all the values in the set above.
This can't be so hard to do, can it?
How about defining something like this:
```
+ (NSPredicate *)myPredicateWithKey:(NSString *)userInputKey {
return [NSPredicate predicateWithBlock:^BOOL(NSString *evaluatedString, NSDictionary *bindings) {
// remove all whitespace ... | [
0.13153702020645142,
0.11858023703098297,
0.2144048511981964,
-0.23383353650569916,
0.04368184506893158,
-0.024911697953939438,
0.38700878620147705,
-0.5722479224205017,
-0.1638539880514145,
-0.4142436683177948,
-0.1172226294875145,
0.4706249237060547,
-0.5021093487739563,
0.02802790701389... | |
B d", @"A bC", nil];
NSArray *filteredArray=[testArray filteredArrayUsingPredicate:[MyClass myPredicateWithKey:@"a B C"]];
NSLog(@"filteredArray: %@", filteredArray);
```
The result is:
```
2012-04-10 13:32:11.978 Untitled 2[49613:707] filteredArray: (
abc,
"a bc",
"A B C",
"A ... | [
-0.08212254196405411,
-0.19366461038589478,
0.13233143091201782,
-0.18878266215324402,
-0.03858434036374092,
0.06947346031665802,
0.38421630859375,
-0.37838199734687805,
-0.31231820583343506,
-0.3954727351665497,
-0.2347874492406845,
0.0345877930521965,
-0.35793447494506836,
0.121322430670... | |
I want to be able to call properties on objects that might be null but not explicitly have to check whether they are null or not when calling.
Like this:
```
var something = someObjectThatMightBeNull.Property;
```
My idea is to create a method that takes an Expression, something like this:
```
var something = GetV... | [
0.2191435843706131,
-0.07628830522298813,
0.1313585788011551,
-0.02169102616608143,
0.0215181615203619,
-0.14607778191566467,
0.7243936657905579,
-0.38728222250938416,
0.05720594897866249,
-0.5191754698753357,
-0.01303083822131157,
0.6210096478462219,
-0.10885057598352432,
-0.0560189746320... | |
appreciate that too.
Thanks!
Well, a probable not optimized solution, but just see if it seems to work.
First, we create a result class
```
public class BalanceResult
{
public int Id { get; set; }
public DateTime CreationDate { get; set; }
public IList<int> BalanceResults { get; set; }
... | [
0.3921867609024048,
-0.37236425280570984,
0.4753294587135315,
-0.0418592132627964,
0.3144493103027344,
0.3850364089012146,
-0.2975400984287262,
-0.2525065839290619,
-0.03743458911776543,
-0.5379514694213867,
0.06533612310886383,
0.3660544157028198,
0.003042253665626049,
0.00278402492403984... | |
public bool HasManyResults {get { return BalanceResults != null && BalanceResults.Count > 1; }}
public int DailyDifference { get { return HasManyResults ? BalanceResults.Last() - BalanceResults.First() : BalanceResults.First(); } }
}
```
then we change a little bit our query
```
var query = db.Balances
... | [
0.20512287318706512,
-0.26518896222114563,
0.5659272074699402,
-0.17939908802509308,
-0.019927240908145905,
0.22855046391487122,
0.3548673987388611,
-0.39440369606018066,
-0.255276083946228,
-0.4619462192058563,
-0.2987992465496063,
0.5562419295310974,
-0.41727912425994873,
0.3447088897228... | |
{
id = m.Id,
year = SqlFunctions.DatePart("mm", m.CreationDate), | [
0.17481690645217896,
-0.1796455979347229,
0.35258948802948,
0.12078583240509033,
0.45637720823287964,
0.22835063934326172,
-0.04454437643289566,
0.16785576939582825,
-0.4280761182308197,
-0.39290952682495117,
-0.07010821998119354,
0.07462261617183685,
0.1468004435300827,
0.7438763380050659... | |
month = SqlFunctions.DatePart("dd", m.CreationDate),
day = SqlFunctions.DatePart("yyyy", m.CreationDate) | [
0.1100553646683693,
-0.1361466944217682,
0.4774746298789978,
0.16721785068511963,
-0.11537296324968338,
0.09449158608913422,
0.08176127821207047,
0.3590182065963745,
-0.3100740313529968,
-0.269153892993927,
-0.10823642462491989,
-0.22097840905189514,
0.2358129620552063,
0.6377140283584595,... | |
}).ToList()//enumerate there, this is what we need from db
.Select(g => new BalanceResult
{ | [
0.38014402985572815,
-0.31686466932296753,
0.440886527299881,
-0.21413469314575195,
0.4816294014453888,
0.08684928715229034,
-0.01593734696507454,
-0.6103811860084534,
-0.15672335028648376,
-0.5583449006080627,
-0.11339817941188812,
0.4635440409183502,
-0.5342808365821838,
-0.0933133438229... | |
Id = g.Key.id,
CreationDate = new DateTime(g.Key.year, g.Key.month, g.Key.day),
BalanceResults = g.OrderBy(l => l.CreationDate).Select(l => l.BalanceValue).ToList() | [
0.304713636636734,
-0.31031692028045654,
0.4735449254512787,
-0.14564800262451172,
0.3829757273197174,
0.44194304943084717,
-0.34092646837234497,
-0.2100856900215149,
-0.4329322278499603,
-0.5906230807304382,
-0.2899213433265686,
0.09603927284479141,
-0.0905304029583931,
0.4220753312110901... | |
}).ToList();
```
and finally
```
foreach (var balanceResult in balanceResults.ToList())
{
var previousDayBalanceResult = balanceResults.FirstOrDefault(m => m.Id == balanceResult.Id && m.CreationDate == balanceResult.CreationDate.AddDays(-1));
balanceResult.Difference = pr... | [
-0.07322192192077637,
-0.15078920125961304,
0.7281436324119568,
-0.46016639471054077,
0.2874412536621094,
0.42022252082824707,
0.08439011126756668,
-0.45431968569755554,
-0.37277016043663025,
-0.30084067583084106,
-0.17443032562732697,
0.4801659882068634,
-0.13267357647418976,
0.4983456730... | |
}
```
as indicated, performance (use of dictionaries, for example), code readability should of course be improved, but... that's the idea ! | [
0.11078042536973953,
0.4341716170310974,
0.13555343449115753,
0.06607234477996826,
0.27290093898773193,
-0.353094220161438,
0.33609524369239807,
0.21940878033638,
0.16748827695846558,
-0.5237142443656921,
-0.32198792695999146,
0.7735211253166199,
-0.18054284155368805,
0.057415373623371124,... | |
I've just been trying to learn and messing around with code. And I've come across something I did not expect to happen. I have a JLabel in a MainApp class, I create an ActionListener (HelloListener) which is passed the JLabel. When the button is pressed, the actionPerformed method should update the JLabel to "Hello aga... | [
-0.1503509134054184,
-0.29388633370399475,
0.6108635067939758,
-0.19040030241012573,
-0.19781632721424103,
-0.003617107169702649,
0.5506083965301514,
-0.09429421275854111,
-0.37518417835235596,
-0.6059035062789917,
-0.3060019612312317,
0.5149970054626465,
-0.30445438623428345,
0.0444509983... | |
will only update the one in HelloListener, and I would then have to return it?
Why when I update the JLabel in the HelloListener does it also update in the MainApp class?
Here's the code:
```
public class MainApp extends JFrame {
public static void main(String[] args) {
new MainApp();
}
publi... | [
0.12261367589235306,
-0.19503502547740936,
0.9415796995162964,
-0.4045378565788269,
0.23200592398643494,
0.11176372319459915,
0.4321041703224182,
-0.270574688911438,
-0.05641753971576691,
-0.8424347043037415,
-0.22083760797977448,
0.2694724202156067,
-0.39822643995285034,
0.181314840912818... | |
add(jl);
JButton jb = new JButton("Click me!");
jb.addActionListener(new HelloListener(jl));
add(jb);
setVisible(true);
}
}
```
and
```
public class HelloListener implements ActionListener {
JLabel jl;
public HelloListener(JLabel jl) {
this.jl = jl;
}
... | [
-0.35119515657424927,
-0.43326738476753235,
0.7360313534736633,
-0.8106625080108643,
0.013595477677881718,
0.3597535789012909,
0.4030102789402008,
-0.30177849531173706,
-0.22317247092723846,
-0.4986472725868225,
-0.6338323354721069,
0.6698340773582458,
-0.6920495629310608,
-0.0632083341479... | |
}
}
```
> When I pass the HelloListener the JLabel, isn't that JLabel the
> property of the HelloListener class after it is passed? So when it
> updates it will only update the one in HelloListener, and I would then
> have to return it?
This is where the breakdown in your understanding is. When you "pass the JLab... | [
-0.13044139742851257,
0.14837254583835602,
0.2618785798549652,
-0.27146467566490173,
0.11610216647386551,
-0.3985866904258728,
0.5225188732147217,
0.02915835566818714,
0.004166082013398409,
-0.7029294967651367,
-0.14540132880210876,
0.7736497521400452,
-0.42157021164894104,
0.2816592156887... | |
exists everywhere it did before. So the `JLabel jl` in the `HelloListener` instance is just a **reference to the same actual JLabel instance** that is presented in the gui.
This is fundamental to how Java (and many programming languages) works. If you do
`Dog d = new Dog();`
and then pass `d` to a method
`walk(d);... | [
-0.030949754640460014,
-0.14687970280647278,
0.5376409292221069,
-0.44503360986709595,
0.28475427627563477,
-0.25199922919273376,
0.406703382730484,
-0.29208579659461975,
-0.22340692579746246,
-1.08806574344635,
-0.2874985933303833,
0.4368569254875183,
-0.4793166220188141,
0.15601179003715... | |
you looked at `d`, you would see the `lastWalkTime` value you set in the method. | [
0.535554051399231,
-0.5102694630622864,
-0.12525628507137299,
-0.055062975734472275,
-0.01827501319348812,
0.29225000739097595,
0.13850507140159607,
-0.38333964347839355,
0.2091263234615326,
-0.8058364391326904,
0.35147494077682495,
0.3555157780647278,
0.1410125344991684,
0.208295121788978... | |
Here is my table and the data contained in it:
```
Table: first
+----------+------+
| first_id | data |
+----------+------+
| 1 | 5 |
| 2 | 6 |
| 3 | 7 |
| 4 | 6 |
| 5 | 7 |
| 6 | 5 |
| | [
-0.2877379357814789,
0.4103640615940094,
0.5927277207374573,
-0.09168063849210739,
0.14661747217178345,
0.04084431380033493,
-0.15264126658439636,
-0.29615211486816406,
0.0772237479686737,
-0.5935827493667603,
-0.1336067020893097,
0.22724759578704834,
-0.16026753187179565,
0.16343133151531... | |
7 | 7 |
| 8 | 6 |
| 9 | 5 |
| 10 | 7 |
+----------+------+
Table: second
+-----------+----------+----------+
| second_id | first_id | third_id |
+-----------+----------+----------+
| 1 | 1 | 2 |
| 2 | | [
-0.6419969201087952,
0.018693314865231514,
0.6787567138671875,
-0.1810324341058731,
-0.0894150659441948,
0.3348453640937805,
0.16968804597854614,
-0.4187740385532379,
-0.2829365134239197,
-0.4130679965019226,
-0.39512479305267334,
0.39095184206962585,
-0.1708221137523651,
0.084139049053192... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.