text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
sales_previous = models.IntegerField()
```
I tried doing:
```
ratios = {'growth':'quarter__sales_now / quarter__sales_previous'}
CompanyCode.objects.extra(select=ratios)
# raises "Unknown column 'quarter__sales_now' in 'field list'"
```
I also tried using raw query:
```
query = ','.join(['round((%s),2) AS %s' % (... | [
0.03652049973607063,
0.4034905433654785,
0.6119763255119324,
-0.0687379464507103,
0.033928338438272476,
0.3012567162513733,
-0.3718232214450836,
-0.2468370795249939,
-0.13192090392112732,
-0.35091081261634827,
-0.04055427014827728,
0.7816369533538818,
0.23443080484867096,
0.406161934137344... | |
out. In above using:
```
CompanyCode.objects.select_related('quarter').extra(select=ratios)
```
solved the problem.
Basically, to access any related model data through 'extra', we just need to ensure that that model is joined in our query. Using select\_related, the query automatically joins the mentioned models.
... | [
0.1788880079984665,
-0.0010484779486432672,
0.3977515995502472,
0.10603884607553482,
-0.02501503750681877,
0.2645767033100128,
-0.4866751730442047,
-0.35746029019355774,
-0.3487340211868286,
-0.5048664212226868,
-0.044236019253730774,
0.5635659694671631,
-0.31655368208885193,
0.35245588421... | |
When I changed the sdk orm jar to v2 (default including by sdk),I got some excepion info.It's about the datanucleus-core-3.0.6.jar has ben registed bla bla....
After search,I knew it was a bug in 3.0.6. So, I relpace it by datanucleus-core-3.0.10.jar.
But it not success when compile the pojo Enhancer
```
java.lang.Run... | [
-0.15492914617061615,
0.2886770963668823,
0.3608219027519226,
-0.3225289285182953,
-0.11884192377328873,
0.17991629242897034,
0.7137337923049927,
0.014142649248242378,
-0.24340741336345673,
-0.4754619300365448,
-0.18706342577934265,
0.43565666675567627,
-0.5304059982299805,
0.1092600300908... | |
org.datanucleus.plugin.PluginManager.<init>(Lorg/datanucleus/PersistenceConfiguration;Lorg/datanucleus/ClassLoaderResolver;)V
at org.datanucleus.OMFContext.<init>(OMFContext.java:159)
at org.datanucleus.enhancer.DataNucleusEnhancer.<init>(DataNucleusEnhancer.java:172)
at org.datanucleus.enhancer.DataNucleus... | [
-0.09757078438997269,
0.3681744933128357,
0.760412335395813,
-0.13274003565311432,
-0.23079155385494232,
0.10163320600986481,
0.6775308847427368,
-0.27053821086883545,
-0.2284051477909088,
-0.8612746000289917,
-0.05068819224834442,
0.5905966758728027,
-0.26449722051620483,
0.36326074600219... | |
I am struggling mightily with installing ADT (Android Dev Tools) on Eclipse in Fedora 16 OS, 64-bit.
Eclipse itself is running fine.
As instructed, I first installed the regular Android SDK, the OS-level toolkit. That went smoothly and I was able to use the Android app within the tools dir.
In Eclipse, it was a litt... | [
0.20286449790000916,
0.09614460915327072,
0.6231124401092529,
-0.12545384466648102,
-0.5581361651420593,
0.02219017967581749,
0.28029724955558777,
-0.05057516321539879,
0.12199222296476364,
-0.9704427719116211,
0.01542422641068697,
1.0066132545471191,
-0.062433648854494095,
0.0101009467616... | |
adb] /opt/android-sdk-linux/platform-tools/adb: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory
[2012-04-04 02:06:35 - adb] 'adb version' failed!
/opt/android-sdk-linux/platform-tools/adb: error while loading shared libraries: libncurses.so.5: cannot open... | [
-0.47014206647872925,
0.5369032621383667,
0.0022869633976370096,
-0.19810043275356293,
-0.31527987122535706,
0.29953667521476746,
0.6293163895606995,
-0.5841485857963562,
-0.038918621838092804,
-0.6376120448112488,
-0.14534267783164978,
0.4813632071018219,
-0.5029991269111633,
0.4367733597... | |
shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory
[2012-04-04 02:06:35 - adb] Failed to parse the output of 'adb version':
Standard Output was:
Error Output was:
/opt/android-sdk-linux/platform-tools/adb: error while loading shared libraries: libncurses.so.5: cannot open shar... | [
-0.08563028275966644,
0.11016346514225006,
0.24841773509979248,
-0.006213145796209574,
-0.2916969358921051,
-0.1390228420495987,
0.590848445892334,
-0.04508719593286514,
-0.20355647802352905,
-0.7524926662445068,
-0.2543494403362274,
0.4964940547943115,
-0.6290400624275208,
0.2223132699728... | |
install ncurses-libs.i686 libstdc++.i686 libgcc.i686
``` | [
0.23189154267311096,
0.2418568879365921,
0.4600740969181061,
0.09320539236068726,
-0.20003893971443176,
-0.4839473366737366,
0.09667938947677612,
-0.0724768191576004,
-0.12477155029773712,
-0.6484468579292297,
-0.48132243752479553,
0.6710838079452515,
-0.667503297328949,
0.0649673566222190... | |
I have a website that contains a list of articles. I want to include a line that says how many articles there are in the DB, however I don't want it to show the exact count.
I would like it to round down to the nearest 10, so for example for 105 articles I would like it to say "100+", etc.
How would I go about doing ... | [
0.4666377305984497,
0.6021133661270142,
0.27447637915611267,
-0.038004498928785324,
-0.14467428624629974,
-0.03261531516909599,
0.26657891273498535,
-0.1230473667383194,
-0.29660293459892273,
-0.5739318132400513,
-0.009114067070186138,
0.3428170084953308,
0.1831163465976715,
0.087844140827... | |
I am new in android and i print log-cat using:
```
Log.w("Tag", "String text");
```
and log text print but after searching for a time i find some more way to print logcat like:
```
Log.v()
Log.d()
```
and now i am confuse in these methods.
Which is the best method for print log-cat and how may method for print ... | [
-0.022966979071497917,
0.13872098922729492,
0.6769313812255859,
-0.24205820262432098,
-0.11006706207990646,
0.27194952964782715,
0.3800604045391083,
-0.06930530071258545,
-0.05442437529563904,
-1.004994511604309,
-0.2569917142391205,
0.898384690284729,
-0.3656611740589142,
-0.2395627796649... | |
verbose mean, usually is Log.v ("", "");
**2:** `Log.d` - the output ***color is blue*** , the only output debug debugging meaning, but he would output the upper filter up through of DDMS Logcat label to select.
**3:** `Log.i` - output ***color is green*** , general tips, news information, it does not the output Log.... | [
-0.024678213521838188,
-0.18258698284626007,
0.7849293351173401,
0.013970986008644104,
-0.16174443066120148,
0.12946665287017822,
0.4549025893211365,
0.2300248146057129,
-0.20854657888412476,
-0.7424244284629822,
-0.4759562909603119,
0.5777707695960999,
-0.3021514117717743,
-0.321246474981... | |
think of error error here only to show the red error message, these errors we need careful analysis.
For more information:
<http://developer.android.com/guide/developing/debugging/debugging-log.html> | [
0.2161705046892166,
0.3091776371002197,
-0.2524147629737854,
-0.18128091096878052,
0.10245046764612198,
0.2344883382320404,
0.3516298830509186,
0.06601954251527786,
-0.10680530965328217,
-0.616981029510498,
-0.007587128784507513,
0.6342283487319946,
-0.33530393242836,
-0.19124354422092438,... | |
I am able to login to twitter using twitter4j and get information about the logged in user but i am not able to post tweet from my application. I am using java web application to post tweet. see the code below that i use.
```
String ACCESS_TOKEN = "ttttttttt";
String ACCESS_TOKEN_SECRET = "gggggggggggggg";
Str... | [
0.6219906210899353,
-0.03211443871259689,
0.403385192155838,
0.03471647575497627,
-0.12967942655086517,
0.15513086318969727,
0.6082094311714172,
0.05746261030435562,
-0.15717345476150513,
-0.5619876384735107,
0.06558510661125183,
0.6842037439346313,
-0.18508687615394592,
0.1642881780862808... | |
AccessToken accessToken = new AccessToken(ACCESS_TOKEN, ACCESS_TOKEN_SECRET);
OAuthAuthorization authorization = new OAuthAuthorization(ConfigurationContext.getInstance(), CONSUMER_KEY, CONSUMER_SECRET, accessToken);
Twitter twitter = new TwitterFactory().getInstance(authorization);
try {
//twitter.... | [
-0.3482271730899811,
-0.11342626065015793,
0.7713421583175659,
0.29285648465156555,
0.2057580202817917,
0.08186676353216171,
0.8440687656402588,
-0.11825214326381683,
-0.08540316671133041,
-0.5064698457717896,
-0.14881908893585205,
0.39481058716773987,
-0.15362076461315155,
0.2468789517879... | |
be one of Read, Write and Access direct messages. If not you can easily make an update.
(I tested your code in processing environment and it is working) | [
0.4160807132720947,
-0.15906992554664612,
0.2919735312461853,
0.17260532081127167,
-0.10154715925455093,
-0.25569993257522583,
0.36224305629730225,
0.2778519093990326,
-0.03193548694252968,
-0.8252183794975281,
-0.046665485948324203,
0.8294237852096558,
-0.04911862686276436,
-0.17724394798... | |
I am trying to do the following:
```
function main(callback) {
$.ajax('server-side', function() {
this.callback.call("hello");
}.bind({ callback: callback });
}
main(function(response) {
alert(response);
});
```
Response is `undefined`, I would expect it to be `"hello"`. Any ideas why?
`call` first ... | [
0.04594989866018295,
0.06699853390455246,
0.4021448493003845,
-0.3190577030181885,
0.13882340490818024,
-0.006352873053401709,
0.2619035542011261,
-0.08830597996711731,
-0.1273033320903778,
-0.6996086835861206,
-0.4110069274902344,
0.5803656578063965,
-0.5375194549560547,
0.197086423635482... | |
My use-case is as follows:
In activity A I call:
```
startActivity(B);
finish();
```
Now in onCreate of Activity B I need to know the activity that started B, so I wonder if in onCreate(...) of Activity B I call:
```
getIntent();
```
Would I even be able to get the Intent that started Activity B or would getInte... | [
0.2008882611989975,
0.031359825283288956,
0.5922513008117676,
-0.5272654891014099,
0.13644106686115265,
-0.2633606791496277,
0.2990685999393463,
-0.20732887089252472,
-0.03943169489502907,
-0.29826653003692627,
-0.3391433358192444,
0.9478747844696045,
-0.285043865442276,
-0.097555212676525... | |
I want to create more or less portable (stand-alone, no install, WinXP to Win7) Win32 forms application in Visual Studio 2010. When I create a new project, it appears that the only way I can do it is if I use .NET/CLR, which makes me think it will be *very* unportable.
What is the preferred way of creating such apps?... | [
0.5128970146179199,
0.30643177032470703,
0.242222860455513,
-0.15007907152175903,
-0.20445159077644348,
-0.0877220407128334,
0.1905653029680252,
-0.13678503036499023,
-0.26949992775917053,
-0.5310066342353821,
-0.012510748580098152,
0.6883566975593567,
-0.3504774570465088,
-0.0096181128174... | |
that *I think* most people running Windows have by now.
Besides .NET you have other alternatives such as MFC or native [Win32 API](http://www.winprog.org/tutorial/). | [
0.25075554847717285,
0.05219966918230057,
0.10656765848398209,
0.1929825097322464,
-0.05241963267326355,
-0.11277877539396286,
0.16277477145195007,
0.5065646171569824,
-0.28262993693351746,
-0.677544116973877,
-0.29622092843055725,
0.7832024097442627,
-0.008406507782638073,
0.2986148297786... | |
I have an iOS application. Application has 2 different views: Main and Settings. In fact, application needs to load and initialize some library and framework before it is used in Main View.
When I put this initialization in `viewDidLoad` method, it works OK. But when go to Settings and come back to Main View, initiali... | [
0.02433100901544094,
0.05552958697080612,
0.505609929561615,
-0.21518996357917786,
0.16090038418769836,
0.26913487911224365,
0.31808358430862427,
0.024808863177895546,
-0.30089086294174194,
-0.7906279563903809,
-0.04339437186717987,
0.5917186737060547,
-0.4188498556613922,
-0.0378437750041... | |
*)launchOptions
```
It should be in your appdelegate class.
Hope it helps | [
0.3346467912197113,
-0.10292452573776245,
0.11693163216114044,
0.4028366804122925,
0.13860829174518585,
-0.39853397011756897,
0.22482620179653168,
0.44322866201400757,
-0.18399128317832947,
-0.6679285764694214,
-0.374552458524704,
0.3346552550792694,
-0.11516830325126648,
-0.26561796665191... | |
In older version of python, 'str' object has no attribute 'format error will be resulted if i try to format string. params consists of something like `[u'name', '12']`. How to do the following in % string formatting?
```
def str(params):
......
if params:
msg_str = msg_str.format(*params)
```
Convert t... | [
-0.20176684856414795,
0.21979311108589172,
0.7083224654197693,
-0.23780383169651031,
-0.6246179938316345,
0.3022839426994324,
0.4128209054470062,
-0.6345651149749756,
-0.42060232162475586,
-0.1777144968509674,
-0.43950068950653076,
0.20506249368190765,
-0.48397400975227356,
-0.050164524465... | |
% lst
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: %d format: a number is required, not list
``` | [
-0.1274501383304596,
-0.20548948645591736,
0.5586138963699341,
-0.4069041907787323,
0.288006067276001,
0.21063661575317383,
0.004072060342878103,
0.07310526818037033,
0.07718824595212936,
-0.4900064170360565,
-0.3993465006351471,
0.28216496109962463,
-0.24721290171146393,
0.167163461446762... | |
I started porting a simple ASP.NET MVC web app from SQL to RavenDB. I noticed that the pages were faster on SQL than on RavenDB.
Drilling down with Miniprofiler it seems the culprit is the time it takes to do: **session.SaveChanges (150-220ms).** The code for saving in RavenDB looks like:
```
var btime = new TimeDat... | [
0.24300579726696014,
-0.427593857049942,
0.32417231798171997,
-0.013280344195663929,
-0.03871322423219681,
0.007106645964086056,
0.44174784421920776,
-0.20872491598129272,
-0.3020716905593872,
-0.8805952668190002,
0.08728380501270294,
0.4597863256931305,
-0.24813103675842285,
0.03043288737... | |
database machine is separate from my development machine which acts as the web server. The databases are running on the same database machine. The test data is quite small - say 100 rows. The queries are simple returning an object with 12 properties 48 bytes in size. Using fiddler to run a WCAT test against RavenDB gen... | [
0.14114093780517578,
0.12797911465168,
0.2307027131319046,
0.33394855260849,
-0.12972691655158997,
0.16450366377830505,
0.35339289903640747,
-0.37921974062919617,
-0.2745469808578491,
-0.5326095819473267,
0.4932718276977539,
0.3902879059314728,
-0.035806041210889816,
0.1642853170633316,
... | |
or b) the solution I created. So, decided to try testing it on **Appharbor** using another solution created by Michael Friis: **[RavenDN sample app](https://github.com/friism/RavenDBMvcSample)** and simply add Miniprofiler to that solution. Michael is one of the awesome guys at Apharbor and you can download the code **... | [
0.3798798620700836,
-0.08711890876293182,
0.22647808492183685,
0.17476347088813782,
0.16484300792217255,
0.115910105407238,
0.45348161458969116,
-0.11159487068653107,
-0.2803700268268585,
-0.7068201303482056,
0.12174974381923676,
0.4396916627883911,
-0.1880209594964981,
-0.20032899081707,
... | |
least twice since the first one usually takes longer as the application warms up.
Unless we're both doing something wrong, RavenDB is very slow to save - around 10-20x slower to save than read. Given that it re-indexes asynchronously, this seems very slow.
Are there ways to speed it up or is this to be expected?
Firs... | [
0.47324323654174805,
-0.04981382563710213,
0.49073153734207153,
0.34939706325531006,
-0.3580590486526489,
-0.2561964690685272,
-0.2749253511428833,
0.009061785414814949,
-0.21327681839466095,
-0.2778737246990204,
0.10341531783342361,
0.25627967715263367,
-0.2289799302816391,
-0.10696381330... | |
Maybe he's working hard to to get RavenHQ off the ground?!?
Second - We experienced a similar problem. Below's a link to a discussion on Google Groups that may be the cause:
[RavenDB Authentication and 401 Response](http://groups.google.com/group/ravendb/browse_thread/thread/71c5981fa3117cc6/6519fa6911408509?show_doc... | [
0.23302026093006134,
0.016765251755714417,
0.1405819207429886,
0.24845503270626068,
-0.2501254975795746,
-0.21876059472560883,
0.4008048176765442,
-0.16560468077659607,
-0.003608222585171461,
-0.35202884674072266,
0.2416355460882187,
0.5565033555030823,
-0.2774598002433777,
-0.113999180495... | |
into this problem early (luckily) which caused concern that we might hit more problems and, finally, because we did not have the time to:
1. fully test whether it fixed the performance problems we saw on the RavenDB Server
2. investigate and test the implications of using UnsafeAuthenticatedConnectionSharing & pre-aut... | [
0.28668609261512756,
0.0536852702498436,
0.014934844337403774,
0.16292299330234528,
0.02256482094526291,
-0.7417579889297485,
0.6797288656234741,
-0.5096784830093384,
0.38177430629730225,
-0.27822405099868774,
0.1831369698047638,
0.456918329000473,
-0.23948007822036743,
-0.375832736492157,... | |
Is there any need to use a custom buffer to either read or write files in C or C++ to reduce file I/O?
For example, if you need to read a file entry by entry (one char at a time, or one struct at a time), is it recommended to reduce the number of calls to fread() using a buffer? Does it make any difference in I/O (for... | [
0.290368914604187,
-0.04679877310991287,
0.21232308447360992,
-0.06053163483738899,
-0.11506561934947968,
0.20868800580501556,
-0.10348507016897202,
-0.3503963351249695,
-0.3396233916282654,
-0.5744895339012146,
0.0601879246532917,
0.6518939733505249,
-0.47177553176879883,
-0.1231191679835... | |
seems that everything is already there and you don't need to add this complexity to your program.
Looking at stackoverflow, I've found [an answer](https://stackoverflow.com/a/4413718/291609) with no votes claiming that there is no significant difference between using `fgetc`/`setvbuf()` vs. `fgets`. Is that really tru... | [
0.1708361655473709,
-0.04045723006129265,
0.34602391719818115,
-0.04380795359611511,
0.06218685954809189,
-0.007998408749699593,
0.07493412494659424,
-0.08981775492429733,
-0.38995814323425293,
-0.4509314000606537,
-0.14351974427700043,
0.6384807825088501,
-0.2704794704914093,
-0.062419012... | |
I want to convert a `String` to an array of objects of [Character](http://docs.oracle.com/javase/7/docs/api/java/lang/Character.html) class but I am unable to perform the conversion. I know that I can convert a String to an array of primitive datatype type "char" with the `toCharArray()` method but it doesn't help in c... | [
0.3927246928215027,
0.31980279088020325,
0.03944188356399536,
-0.3308536112308502,
-0.061473432928323746,
0.1258133053779602,
0.4680823087692261,
-0.40891483426094055,
-0.06654384732246399,
-0.31016188859939575,
0.06201793998479843,
0.5443833470344543,
-0.38300198316574097,
0.0944790020585... | |
I have a basic messaging system set up and I m using the same query to show sent and received messages. It works very well, but I need to get the fbook field for exp and dest. I thought of creating two queries and use one if the user sent the message he is viewing and use the other query if the message has been recieve... | [
-0.04165029153227806,
0.0887632742524147,
0.5247054696083069,
0.03277479112148285,
-0.03646335005760193,
-0.13479745388031006,
0.34652525186538696,
-0.182296484708786,
-0.041353706270456314,
-0.648155927658081,
-0.1641022264957428,
0.6782004833221436,
-0.161244735121727,
0.0213643237948417... | |
| view |
+-----+------+------+----------+----------------+---------------------+------+
| 114 | 243 | 245 | From 243 | Message to 245 | 2012-04-04 09:26:52 | 0 |
+-----+------+------+----------+----------------+---------------------+------+
```
Query
```
SELECT a.*, b.fbook FROM messages a
... | [
-0.3869015574455261,
0.22028350830078125,
0.8564125299453735,
-0.08659365028142929,
0.013053680770099163,
0.3982817232608795,
0.2431960552930832,
-0.32288646697998047,
-0.3943265676498413,
-0.5988659262657166,
-0.30138781666755676,
0.48068127036094666,
-0.03798786178231239,
-0.039084892719... | |
| Type | Null | Key | Default | Extra |
+------------------------+--------------+------+-----+---------------------+----------------+
| id | int(11) | NO | PRI | NULL | [
-0.42918235063552856,
-0.16442935168743134,
0.02380284108221531,
0.044231850653886795,
0.11498051881790161,
0.2851824462413788,
0.07007631659507751,
-0.49484485387802124,
0.02413340099155903,
-0.41996416449546814,
-0.2538241446018219,
0.28000468015670776,
-0.35972514748573303,
0.0410283356... | |
| auto_increment |
| username | varchar(50) | NO | | NULL | |
| fbook | | [
-0.24745026230812073,
-0.012627710588276386,
0.3720850646495819,
-0.14728796482086182,
0.3257358968257904,
0.15249545872211456,
0.35113951563835144,
-0.39905431866645813,
0.15500414371490479,
-0.4356365501880646,
-0.43947702646255493,
0.5620408654212952,
-0.3529597222805023,
-0.04565099254... | |
bigint(64) | YES | | NULL | |
+------------------------+--------------+------+-----+---------------------+----------------+
```
You want to do something like this:
```
SELECT a.*, b.fbook AS `exp-fbook`, c.fbook AS `dest-fbook`
FROM messages a
JOIN users b ON a.exp=b.id
JOI... | [
-0.1600821316242218,
-0.1589764505624771,
0.4760819673538208,
0.020255746319890022,
-0.17937113344669342,
-0.20564624667167664,
0.2604238986968994,
-0.2649928629398346,
-0.13501127064228058,
-0.40953898429870605,
-0.21886558830738068,
0.6184201836585999,
-0.7032489776611328,
-0.16636465489... | |
I get:
> Undefined variable: password
>
> Undefined variable: host
>
> Undefined variable: user
I am just curious why I am getting such notices,
although the variable has been defined in the private section of the class.
Can't I use private data member of the class in the member function (because that would ... | [
0.5436173677444458,
-0.07684024423360825,
0.5491205453872681,
-0.05788083374500275,
-0.05672954395413399,
-0.17348147928714752,
0.32887399196624756,
0.10222253203392029,
-0.025191733613610268,
-0.4620839059352875,
0.002378166653215885,
0.3063371777534485,
-0.18549597263336182,
0.3693541288... | |
{
$host=$hst;
$user=$usr;
$password=$pwd;
}
public function get_data()
{
$info=array("host"=>" ", "user"=>" ", "password"=>" ");
$info['host']=$host; | [
-0.15387845039367676,
-0.07941409200429916,
0.4705136716365814,
-0.1810167133808136,
0.20436108112335205,
-0.047300904989242554,
0.3181609809398651,
-0.10159001499414444,
0.05466955527663231,
-0.7109525203704834,
-0.6022546291351318,
0.6808282732963562,
-0.5332821607589722,
0.2668110430240... | |
$info['user']=$user;
$info['password']=$password;
return $info;
}
}
$user1=new data_base;
$user2=new data_base;
$user1->feed_data("localhost", "root", ""); //enter details for user 1 here
$user2->feed_data("", "", ""); //enter details for user 2 here
$perm_ad... | [
0.17481473088264465,
0.07490470260381699,
0.5583085417747498,
-0.09402026981115341,
0.08109544962644577,
-0.08068228513002396,
-0.07564601302146912,
-0.27860212326049805,
-0.22471095621585846,
-0.7151696681976318,
-0.25470787286758423,
0.4486845135688782,
-0.31847646832466125,
0.1692260652... | |
a local variable and thus undefined here.
As a sidenote: You can write
```
$info=array("host"=>" ", "user"=>" ", "password"=>" ");
$info['host']=$host;
$info['user']=$user;
$info['password']=$password;
return $info;
```
as
```
return array(
'host' => $this->host,
'user' => $this->user,
'pa... | [
-0.26995033025741577,
-0.1340719312429428,
0.4012269675731659,
-0.11442752927541733,
0.10882692784070969,
-0.09540032595396042,
0.22903579473495483,
0.33595409989356995,
-0.018282020464539528,
-0.620741605758667,
-0.3340122103691101,
0.5474792718887329,
-0.36468586325645447,
0.259542316198... | |
> **Possible Duplicate:**
>
> [C compiler bug (floating point arithmetic)?](https://stackoverflow.com/questions/4002411/c-compiler-bug-floating-point-arithmetic)
I've got two doubles which I can guarantee are exactly equal to 150 decimal places - ie. the following code:
```
printf("***current line time is %5.150lf... | [
0.061820365488529205,
0.23761706054210663,
0.5556492209434509,
0.00884199421852827,
0.017446646466851234,
0.2719343900680542,
0.21710948646068573,
-0.236698180437088,
-0.4193044602870941,
-0.7057283520698547,
0.23416396975517273,
0.471690833568573,
-0.007773370947688818,
0.4206027388572693... | |
`doubles` but these are not subject to any error at all (the original figures have all been read with `sscanf` or #defined and are all specified to 10 decimal places).
**EDIT:** My mistake was assuming that `printf`-ing the doubles accurately represented them in memory, which was wrong because one value is being calc... | [
0.40425968170166016,
-0.051157109439373016,
0.3727758824825287,
0.03930085152387619,
0.06902961432933807,
-0.08284131437540054,
0.1762389838695526,
-0.39791712164878845,
-0.2998810410499573,
-0.7015964388847351,
0.24251985549926758,
0.3904606103897095,
-0.11816377192735672,
0.1774977296590... | |
looked the same were apparently inequal.
Floats certainly are not accurate to 150 significant digits, so I 'm not sure what conclusion can be drawn from the "visual" comparison (if any).
On the other hand, the values are obviously not bit-identical (and how could they be, since *one of them is calculated on the spot w... | [
0.6457292437553406,
-0.2029024213552475,
-0.04627372324466705,
0.41683632135391235,
-0.37928342819213867,
-0.031490638852119446,
0.1044028252363205,
-0.23555608093738556,
-0.01627546176314354,
-0.5763919949531555,
0.3836839497089386,
0.4710899591445923,
0.004699979908764362,
0.221084326505... | |
Following code used to save videos to photo Album.
```
else if ([mediaType isEqualToString:(NSString *)kUTTypeMovie])
{
NSString *sourcePath = [[info objectForKey:@"UIImagePickerControllerMediaURL"]relativePath];
UISaveVideoAtPathToSavedPhotosAlbum(sourcePath,nil,nil,nil);
}
```
If it is v... | [
0.12010364979505539,
-0.1109229251742363,
0.4514262080192566,
0.05292576178908348,
-0.11967968940734863,
-0.14733439683914185,
0.18558457493782043,
-0.3068544864654541,
-0.3630075454711914,
-0.7884572744369507,
-0.06481064856052399,
0.8375954627990723,
-0.40070101618766785,
-0.088168121874... | |
XML in memory and you cna then access any tag, however, this is less performant and can be problematic if you are using very large XML. SAX requires more work, but reads the XML and processes each tag as it gets to it.
Both are able to do what you need though. | [
-0.04979952052235603,
0.02596844546496868,
0.3764069080352783,
0.24846899509429932,
0.04311680793762207,
-0.4514038562774658,
-0.17664705216884613,
0.032294925302267075,
-0.1621730774641037,
-0.6574341654777527,
-0.10599967837333679,
0.3502342402935028,
0.026766642928123474,
-0.14836756885... | |
I am trying to develop a simple game where a group of user can come and play the game. Based on the performance of the user, they get positive score or negative score.
I want two parameters to be taken into account user's `weight`(no. of matches he has played and his performance in those matches) his `instantaneous s... | [
0.2651017904281616,
0.05300786346197128,
0.24170750379562378,
0.02908928506076336,
-0.1498250514268875,
-0.11491407454013824,
0.19069769978523254,
-0.4421839118003845,
-0.12319875508546829,
-0.5309921503067017,
0.2813187539577484,
0.4151829481124878,
-0.12450198084115982,
-0.15592715144157... | |
the wheel. I tried and came up with this, but this looks pretty naive and i am not sure how the performance will be in real world scenario.
```
Pos[i] and Neg[i] are the positive and negative score of the users in a match.
```
---
```
Step1: Calculate the average score of n people `for i in range(1, N): sum = sum... | [
-0.17887921631336212,
-0.03298297896981239,
0.3282834589481354,
-0.07377322018146515,
-0.06824281811714172,
0.18396472930908203,
0.1872239112854004,
-0.7485886216163635,
-0.09529321640729904,
-0.586937427520752,
0.23633505403995514,
0.67891925573349,
-0.12108198553323746,
0.041849829256534... | |
is the number of times he has scored positive scores and N2 the number of times he scored negative result)
Step4: Current Score = (POSi - SD)xW
Step5: His New Rating = Old Rating + Current Score
```
Please suggest something standard.
Well it has been done [here](http://blog.fruiapps.com/2012/04/Chose-a-mathematical... | [
0.0029053427278995514,
0.06215321272611618,
0.41024118661880493,
-0.018117455765604973,
0.031144315376877785,
-0.5881702899932861,
0.34671613574028015,
-0.483160138130188,
-0.2539336681365967,
-0.4318312108516693,
0.277525931596756,
0.4717685282230377,
0.09093903750181198,
0.13983453810214... | |
I have a table **User** which has the fields **(id, first\_name, middle\_name, last\_name).**
I want to write a query to find a user by his name. The name may be first name, middle name or last name.
```
$sql = "SELECT * FROM user
WHERE first_name like '%$name%' OR
middle_name like '%$name%' ... | [
-0.31755223870277405,
0.4088759422302246,
0.4634092450141907,
0.04255010187625885,
0.06350656598806381,
0.15788738429546356,
-0.233279287815094,
-0.08577781915664673,
-0.15651381015777588,
-0.6669827103614807,
0.08551348745822906,
0.3634642958641052,
-0.2563159465789795,
0.2659927606582641... | |
and add composite Fulltext index on `First_name,second_name,last_name` then use this query
```
select *
from table_name
where match (`First_name`,`second_name`,`last_name`) against('name')
```
It's pretty much faster then your query. | [
-0.3396153450012207,
0.22231820225715637,
0.16461484134197235,
-0.14242839813232422,
-0.12215378880500793,
0.1867247372865677,
-0.07760471105575562,
-0.17417356371879578,
0.11440204828977585,
-0.7635427713394165,
0.08472508192062378,
0.42686519026756287,
-0.22153839468955994,
-0.0593500882... | |
How to create dynamically tag inside table. At first create link then inside link create an img tag like if i have..
```
<table>
<tr>
<td>
<a>
<img />
</a>
// Add Some more when every time my function is run..? like that | [
0.21947817504405975,
-0.357232928276062,
0.46031653881073,
0.11030364036560059,
-0.056238822638988495,
-0.2220488339662552,
0.0027785319834947586,
-0.33669230341911316,
-0.1623876988887787,
-0.6975423693656921,
0.1398780643939972,
0.46773940324783325,
-0.6845548152923584,
0.031286831945180... | |
// <a>
// <img/>
// </a>
</td>
</tr>
</table>
```
Im using this inside function but its didn't work help me.
```
$(document.createElement("img")).attr('Some attr');
```
If you mean JQuery by "jquree", then try this:
```
$('table tr td').append('<a href="#"><img src="/favicon.i... | [
-0.0018665624083951116,
0.02240743674337864,
0.5717393755912781,
-0.05025350674986839,
-0.13746261596679688,
-0.02161783166229725,
0.3869810104370117,
-0.25174960494041443,
-0.11990515142679214,
-0.4872492551803589,
-0.03991933539509773,
0.39223089814186096,
-0.3771092891693115,
-0.0047259... | |
I'm trying to integrate my rails app with SugarCRM. Is it possible to fetch the Contact picture from SugarCRM using REST API? Please let me know.
To get the profile image for a user do the following:
1. Call the `login` method through REST
2. Call the `get_entry_list` method through REST, with the following parameters... | [
0.32886630296707153,
-0.2416578084230423,
0.6117337942123413,
-0.05057394504547119,
-0.22099487483501434,
0.02433779463171959,
0.41864705085754395,
-0.11099622398614883,
-0.06713644415140152,
-0.9575681686401367,
0.06071123853325844,
0.5475966930389404,
-0.3290865421295166,
-0.134263157844... | |
API with a method to serve profile images (similar to `get_document_revision`)
2. Login on the server from your rails app and get the image
3. Create a simple entrypoint+module in SugarCRM, which can show the picture
4. Remove the .htaccess restiction for images (if it doesn't create a security risk in your setup) | [
0.4107120931148529,
-0.29736363887786865,
0.26813265681266785,
0.19550052285194397,
-0.17926464974880219,
-0.128435418009758,
0.3878919184207916,
-0.2189602553844452,
-0.038985319435596466,
-0.7463311553001404,
0.04901301488280296,
0.37390193343162537,
-0.4215887486934662,
0.00469930749386... | |
I have a xml template like this
```
<User>
<UserId></UserId>
<UserName></UserName>
<Roles>
<Role></Role>
<Roles></Role>
</Roles>
</User>
```
Form this xml template file,dynamicaly i want to generate an xml.How can i do this.
Output xml should look like this
```
<User>
<UserId>user1</UserId>
<UserName>fr</UserName>... | [
0.23034438490867615,
0.04282718524336815,
0.281178742647171,
0.01921124756336212,
-0.1614960879087448,
-0.03730505332350731,
0.22236602008342743,
-0.3816334903240204,
-0.22045134007930756,
-0.8592923283576965,
0.10443607717752457,
0.37578269839286804,
-0.12010601907968521,
0.17331962287425... | |
in order to prevent forgetting to close elements I suggest you use "AutoClose" XmlWriter - I've blogged about how to create this simple class on my blog - [XmlWriter that automatically close elements using IDisposable](http://blog.drorhelper.com/2009/07/xmlwriter-that-automatically-close.html) | [
0.13385820388793945,
-0.06534135341644287,
0.39769789576530457,
0.014718285761773586,
-0.07246289402246475,
-0.3190794885158539,
0.2684273421764374,
-0.35309159755706787,
-0.2048969715833664,
-0.46875473856925964,
-0.1273076981306076,
0.5988011956214905,
-0.4131499230861664,
-0.19713860750... | |
Whenever I use a for ... in loop, the index variable of the loop always seems to be in the variables scope.
For example if I have a component with a method that uses this loop:
```
for(key in params){
writeOutput(key);
}
```
The variable 'key' will be placed in the variables scope. If I already have decla... | [
-0.004257719963788986,
0.04862465709447861,
0.40020662546157837,
-0.10273061692714691,
0.024437997490167618,
-0.006489067804068327,
0.3669518828392029,
-0.43686750531196594,
-0.3826563358306885,
-0.4453718066215515,
-0.1325192004442215,
0.5394184589385986,
-0.39652174711227417,
0.183350235... | |
any way to put the for ... in index in a different scope then the variables scope?
The default scope inside CFCs is variables if you don't var beforehand.
You have to var the index outside the loop like so:-
```
var key = "";
for(key in params){
writeOutput(key);
}
```
An alternative approach, to avoid varrin... | [
0.11636138707399368,
-0.1358461230993271,
0.6073771119117737,
-0.18444404006004333,
-0.11704186350107193,
-0.23803912103176117,
0.30535557866096497,
-0.20775040984153748,
-0.4020318388938904,
-0.43192148208618164,
-0.1489724963903427,
0.5503218770027161,
-0.5331891179084778,
0.032022528350... | |
I have a text file where data is stored as columns. How do I extract each column in to an array?
> eg: a b c d
>
>
> 10 11 12 13
```
14 15 16 17
```
I want four arrays as, a = {10,14}, b = {11,15} c = {12,16} d = {13,17}
Below is what I have done so far to add them in to a single array:
```
CArray <double,doub... | [
0.0004954172763973475,
0.16195407509803772,
0.645270586013794,
-0.2266133576631546,
-0.06554564833641052,
0.5071462988853455,
0.31099826097488403,
-0.566641628742218,
-0.18336735665798187,
-0.6799674034118652,
-0.10914857685565948,
0.40840038657188416,
-0.11739406734704971,
0.1691941022872... | |
for (int i=0; i< arrayValues.GetSize()-1;i++){
// Temp_data[i] = arrayValues.ElementAt(i);
data->Add(arrayValues.ElementAt(i));
}
}
}
CATCH_ALL(e)
{
e->ReportError(); // shows what's going wrong
}
END_CATCH_ALL
void splitString(CString S, CArray<double,double>& arrayValues){
CString... | [
0.07028453797101974,
-0.5630864500999451,
0.5886445045471191,
0.14088857173919678,
-0.020802268758416176,
0.06589879095554352,
0.3328576385974884,
-0.2718510329723358,
-0.2794428765773773,
-0.6029107570648193,
-0.37219539284706116,
0.2023504376411438,
-0.39368534088134766,
0.06131570786237... | |
and split it and then store all the values in an array.
so at the end you will have total lines of arrays.
now use the indexes and store them in different column array based upon the indexes like :
all the elements in the arrays with similar index will be stored in array `colN`. | [
-0.1015031710267067,
-0.26765692234039307,
0.4709646999835968,
0.012490680441260338,
0.05304521322250366,
0.1484033763408661,
-0.264543354511261,
-0.3471260070800781,
-0.21021252870559692,
-0.488099604845047,
-0.13728788495063782,
0.2330789417028427,
-0.3608688414096832,
0.0512686781585216... | |
I'm working on a php site that needs both Japanese and English. In most places I have no trouble getting the Japanese to display correctly, but I can't get the characters to display if I use a function like this:
echo.php:
```
<?php
function draw(){
echo "日本語";
}
draw();
?>
```
I get "日本語"
but if I try this :
inde... | [
0.43264517188072205,
0.14464038610458374,
-0.10022733360528946,
-0.24244153499603271,
-0.44811511039733887,
-0.0806954950094223,
0.6218202114105225,
-0.4879785180091858,
0.09326158463954926,
-0.3339782953262329,
0.13390402495861053,
0.6652809977531433,
-0.18924464285373688,
-0.296918511390... | |
the code:
```
<html lang="ja">
<head>
<title>Running Projects</title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body>
<div id="header">
<? php include "layout.php" ?>
</div>
</body>
</html>
```
Where layout.php is just a file with a list of links, I have this on each page so the ... | [
0.1240500882267952,
0.13990157842636108,
0.5064221024513245,
-0.011622043326497078,
-0.32150089740753174,
-0.16796599328517914,
0.3895481526851654,
-0.3599841296672821,
0.044894151389598846,
-0.5855133533477783,
-0.30650290846824646,
0.3297743797302246,
-0.37357720732688904,
0.080381080508... | |
HTML5 you should use:
```
<meta charset="utf-8" />
```
or in php
```
header('content-type: text/html; charset=utf-8');
``` | [
0.15791520476341248,
0.18036285042762756,
0.6239982843399048,
-0.10052821040153503,
-0.3905133008956909,
-0.19166938960552216,
0.31711259484291077,
0.10565103590488434,
-0.5992740988731384,
-0.5415463447570801,
-0.46794214844703674,
0.22087664902210236,
-0.2786307632923126,
0.2408744841814... | |
I have developed a custom target, that needs to run **only** if the compilation (csc) was made (the build process takes too long otherwise).
I have found out that `Inputs` and `Outputs` attributes can be used to compare file timestamps and execute the target when there is a newer file in the `Inputs` collection. The pr... | [
0.4055529236793518,
0.14627601206302643,
0.3062000274658203,
0.028977902606129646,
-0.17085789144039154,
0.002409344306215644,
-0.044757939875125885,
-0.32859373092651367,
0.0030038494151085615,
-0.8307252526283264,
0.2656277120113373,
0.6325188875198364,
-0.1333664208650589,
0.12398780882... | |
assembly is actual time and thus my target won't execute).
Any ideas how can I achieve this?
One possible solution is to use `PostBuildEvent`.
In order to get this working, we need to do following:
1. Set value to the `<PostBuildEvent>`. That could be done directly within `<PropertyGroup>`, for example like this: `<... | [
0.2636672258377075,
-0.15223731100559235,
0.21749423444271088,
-0.24610260128974915,
-0.010036771185696125,
0.23726940155029297,
0.5840117335319519,
-0.7147515416145325,
-0.09019957482814789,
-0.8136246204376221,
0.0871049240231514,
0.5421557426452637,
-0.24548421800136566,
-0.118372172117... | |
you want to execute in `<PostBuildEventDependsOn>`
The complete example looks like this:
```
<PropertyGroup>
<PostBuildEvent>echo Post build event completed</PostBuildEvent>
<RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent>
<PostBuildEventDependsOn>$(PostBuildEventDependsOn);MyCustomTarget</PostBuild... | [
0.197363942861557,
0.03412678465247154,
0.23841039836406708,
-0.09293713420629501,
0.026415657252073288,
0.03746166452765465,
0.6333216428756714,
-0.5720435380935669,
0.02256293036043644,
-0.5111903548240662,
-0.32458555698394775,
0.4383123517036438,
0.04446213319897652,
-0.240805640816688... | |
I have a situation where different threads populate a queue (producers) and one consumer retrieve element from this queue. My problem is that when one of these elements are retrieved from the queue some is missed (missing signal?). The producers code is:
```
class Producer implements Runnable {
private Consumer c... | [
0.5262963175773621,
-0.0646972805261612,
0.3688100278377533,
-0.24655362963676453,
0.1822080910205841,
0.5681262612342834,
0.03076903522014618,
-0.2908962666988373,
-0.22351664304733276,
-0.6211766600608826,
-0.13295705616474152,
0.5570157170295715,
-0.2567884027957916,
0.6499505639076233,... | |
Runnable {
private Queue<String> queue = new ConcurrentLinkedQueue<String>();
void send(String message) {
synchronized (queue) {
queue.add(message);
System.out.println("SIZE: " + queue.size());
queue.notify();
}
}
@Override
public void run() {
int counter = 0;
synchronized (qu... | [
0.21375009417533875,
-0.5893527865409851,
0.3579576909542084,
-0.18732689321041107,
0.28714433312416077,
0.12388595193624496,
0.44973108172416687,
0.2862817347049713,
-0.741157591342926,
-0.36377382278442383,
-0.12959422171115875,
0.47187715768814087,
-0.7171480059623718,
0.500146746635437... | |
queue.wait(10);
} catch (InterruptedException e) {
Thread.interrupted();
}
System.out.println(counter);
if (!queue.isEmpty()) {
queue.poll();
counter++; | [
-0.18388260900974274,
-0.670656144618988,
0.5358771085739136,
-0.2929941415786743,
0.2662030756473541,
0.3654968738555908,
0.19461151957511902,
0.18731223046779633,
-0.5184684991836548,
-0.40548083186149597,
-0.15625520050525665,
0.4314994812011719,
-0.459105908870697,
0.5611513257026672,
... | |
}
}
}
}
}
```
When the code is run I get sometimes 20 elements added and 20 retrieved, but in other cases the elements retrieved are less than 20. Any idea how to fix that?
I'd suggest you use a BlockingQueue instead of a Queue. A LinkedBlockingDeque might be a good candidate for you.
Your code would look l... | [
0.15014003217220306,
-0.24891650676727295,
0.15092189610004425,
-0.13336022198200226,
0.08215419203042984,
-0.04352830722928047,
0.20632201433181763,
-0.13428516685962677,
-0.5531384944915771,
-0.6324203610420227,
0.040178656578063965,
0.37757378816604614,
-0.5654930472373962,
0.1111669465... | |
to just
```
queue.take()
```
on your consumer thread
The idea is that .take() will block until an item is available in the queue and then return exactly *one* (which is where I think your implementation suffers: missing notification while polling). .put() is responsible for doing all the notifications for you. No w... | [
0.4621025323867798,
-0.451809287071228,
0.11630144715309143,
0.049084413796663284,
-0.11380284279584885,
0.09632723033428192,
0.03367290273308754,
0.023820623755455017,
-0.022014345973730087,
-0.6706791520118713,
0.11424533277750015,
0.4260937571525574,
-0.4819008409976959,
0.2810572087764... | |
If I don't do any map/reduce jobs, still JobTracker/TaskTrackers need to be running for some HBase internal dependency?
No you don't need both for running solely HBase.
Just a tip: there are always scripts that just start the HDFS, `bin/start-dfs.sh` for example. | [
0.7319671511650085,
0.05307251960039139,
0.07126406580209732,
0.10437153279781342,
-0.16451378166675568,
-0.4858585000038147,
0.26453426480293274,
0.10838541388511658,
-0.04597291722893715,
-0.8904545903205872,
0.07555489987134933,
0.6581969261169434,
-0.11997799575328827,
0.05646783858537... | |
I have a php script that randomly generates an image. Something like this:
```
<?php
$image = imagecreatetruecolor(400,200);
// process image
// rendering image
header("Content-type: image/jpeg");
imagejpeg($image);
?>
```
My html looks like this:
```
<img id="image" src="/models/plugins/image.php"/>
<button id="... | [
0.1837455779314041,
-0.026272570714354515,
0.4324240982532501,
-0.06529368460178375,
-0.23664401471614838,
0.03706039488315582,
0.013048949651420116,
-0.28087154030799866,
-0.10987686365842819,
-0.6890920996665955,
0.19897811114788055,
0.33564305305480957,
-0.2913566827774048,
0.0610244385... | |
$('#image').html('<img src="' + data + '">')
}
})
})
})
```
I use firebug, I can see that request is actually sent and that the response is received successfully, but the image does not change.
What am I doing wrong and how can I fix this?
I added another answer because I think that none of t... | [
0.35827693343162537,
0.2507096827030182,
0.4992887079715729,
0.02817166969180107,
-0.018027251586318016,
0.024884486570954323,
0.5745444893836975,
-0.3002389371395111,
-0.26128825545310974,
-0.38096883893013,
0.017022311687469482,
0.6355414986610413,
-0.4746890962123871,
-0.006816653069108... | |
button is clicked. So there is no need for an Ajax request, just reload the image. And you can enforce that by appending a random query string to the image's src attribute.
```
$('#button').click(function() {
var $image = $('#image');
var plainSrc = $image.attr('src').split("?")[0]; // disregard previous quer... | [
0.00520436093211174,
-0.27430596947669983,
0.7541171908378601,
0.05585156008601189,
-0.00778506463393569,
-0.030130092054605484,
0.22539450228214264,
-0.24520887434482574,
-0.37312108278274536,
-0.6780730485916138,
-0.09184949100017548,
0.4754086434841156,
-0.3958757221698761,
0.0693423897... | |
I am working with embedded device, with 32K of memory, writing in plain C using IAR EWARM v6.30.
To make code more readable I would like to define some enum types, for example, something like
```
{RIGHT_BUTTON, CENTER_BUTTON, LEFT_BUTTON}
```
instead of using 0, 1, 2 values, but I am afraid it will take additional... | [
0.20419296622276306,
0.27781280875205994,
0.3202633857727051,
-0.0529126413166523,
-0.08004030585289001,
0.12133486568927765,
-0.016162041574716568,
-0.3725863993167877,
0.1227184385061264,
-0.7341350317001343,
-0.05138690024614334,
0.4214996099472046,
-0.1584007889032364,
0.28679010272026... | |
int`. Some embedded systems compilers deliberately do not comply with that as an optimisation or extension.
In ISO C++ "*The underlying type of an enumeration is an integral type that can represent all the enumerator values defined in the enumeration.*", so a compiler is free to use the smallest possible type, and mos... | [
0.2754344940185547,
0.16786354780197144,
0.3739580810070038,
-0.22205984592437744,
-0.03468530997633934,
-0.14309057593345642,
0.2161332070827484,
-0.30030521750450134,
-0.2531651556491852,
-0.5605809688568115,
-0.44120901823043823,
0.5662691593170166,
-0.5125502347946167,
-0.2369699329137... | |
Such things will normally be defined in the documentation. | [
0.638849139213562,
0.33534523844718933,
0.08998811990022659,
0.0041277133859694,
0.37707892060279846,
-0.28794851899147034,
-0.13764670491218567,
-0.08616134524345398,
-0.1607411801815033,
-0.42376935482025146,
-0.40388810634613037,
0.4372134506702423,
0.24196232855319977,
-0.0269175823777... | |
I am using Translate Animation for moving an `ImageView`. I am using this code:
```
TranslateAnimation set1 = new TranslateAnimation(-4, 10, -110, 0);
set1.setDuration(3000);
TranslateAnimation set2 = new TranslateAnimation(10, -3, 0, 115);
set2.setDuration(3000);
set2.setStartOffset(22... | [
0.471283882856369,
0.008608353324234486,
1.141030192375183,
-0.008759449236094952,
-0.04046129435300827,
0.33320310711860657,
-0.02122245915234089,
-0.32963863015174866,
-0.03178146108984947,
-0.9836068749427795,
-0.24630796909332275,
0.45031797885894775,
-0.1935877948999405,
0.00502381520... | |
= new TranslateAnimation(0, 13, 0, -120);
set4.setDuration(3000);
set4.setStartOffset(6500);
animSet.addAnimation(set1);
animSet.addAnimation(set2);
animSet.addAnimation(set3);
animSet.addAnimation(set4);
animSet.setFillAfter(true);
```
After creating a set of... | [
0.38237977027893066,
-0.04023673012852669,
1.048085331916809,
-0.07863377779722214,
0.14687037467956543,
0.13405314087867737,
0.37343207001686096,
-0.5387565493583679,
-0.10208941996097565,
-0.9240888357162476,
-0.5064204335212708,
0.6728726625442505,
-0.38585150241851807,
-0.1323110312223... | |
I do that?
I tried everything, but didn't succeed. Any idea how to do this?
Please help!
After searching for a time i found this [link](https://stackoverflow.com/a/7840895/1250370) and check is this working for Translate Animation or not and after some modification this is working for your animation too.!
See modif... | [
0.36764785647392273,
-0.19475921988487244,
0.4604027271270752,
0.07473739981651306,
0.1902153491973877,
-0.13341662287712097,
0.17298738658428192,
0.01503155566751957,
-0.011685467325150967,
-0.6088433265686035,
-0.18555419147014618,
0.46376562118530273,
-0.366725355386734,
0.1555789262056... | |
}
private long mElapsedAtPause=0;
private boolean mPaused=false;
@Override
public boolean getTransformation(long currentTime, Transformation outTransformation) {
if(mPaused && mElapsedAtPause==0) {
mElapsedAtPause=currentTime-getStartTime();
}
if(mPaused)
... | [
0.175674706697464,
-0.594159722328186,
0.8024794459342957,
-0.2742083668708801,
0.5554622411727905,
0.3765900135040283,
0.5541799068450928,
-0.3061695694923401,
-0.29669854044914246,
-0.034936875104904175,
-0.3719794750213623,
0.709430992603302,
-0.30315497517585754,
0.5106039643287659,
... | |
{
mElapsedAtPause=0;
mPaused=true;
}
public void resume() {
mPaused=false;
}
}
```
I'll only change class name, extends class name and constructor of this class.
you can use it like:
```
TranslateAnim set1, set2, set3, set4; // objects of TranslateAnim Class
set1 = new Translat... | [
0.3748542070388794,
-0.1229257807135582,
0.9999286532402039,
-0.21241463720798492,
0.1923309713602066,
0.1875157654285431,
0.23264598846435547,
-0.22563275694847107,
-0.3436068594455719,
-0.7192034125328064,
-0.38402360677719116,
0.5885181427001953,
-0.26926344633102417,
-0.124018855392932... | |
and resume methods.
Thanks to Johan for share his code with us.
Hope this solve your problem. :) | [
0.39444223046302795,
0.3616640865802765,
0.22526957094669342,
0.4254378378391266,
0.26134127378463745,
-0.17436522245407104,
0.662798285484314,
-0.07223574817180634,
0.010605938732624054,
-0.5892359614372253,
-0.10135827958583832,
0.5196799039840698,
0.26711517572402954,
-0.596549391746521... | |
I face a problem similar to [void pointer returned from function heap corruption](https://stackoverflow.com/questions/9706960/void-pointer-returned-from-function-heap-corruption)
The similarity is that I get "Heap corruption" message when leaving the scope where unique\_ptr is used.
Here the code:
```
void CMyClass:... | [
0.01583203114569187,
0.2622486650943756,
0.3184819221496582,
-0.09664084017276764,
0.07798953354358673,
-0.26940855383872986,
0.30414411425590515,
-0.1445399522781372,
-0.05716277286410332,
-0.633755624294281,
-0.09997916966676712,
0.4541351795196533,
-0.3227776288986206,
0.529193878173828... | |
goes out of scope.
In your case, you have declared `std::unique_ptr<IMyInterface> spMyInterface;` inside of SomeMethod() so as soon as the execution leaves the scope of SomeMethod() your object gets destroyed.
Take a look at [unique\_ptr](http://en.cppreference.com/w/cpp/memory/unique_ptr) | [
0.17856642603874207,
0.14458590745925903,
0.2332657277584076,
-0.0321490578353405,
0.1837504655122757,
-0.3645367920398712,
0.2797479033470154,
-0.013288112357258797,
-0.5274924635887146,
-0.24909523129463196,
-0.26037123799324036,
0.03842781111598015,
-0.23789247870445251,
0.4457557201385... | |
I've a datatable in primefaces and I want, when I add a row in it, view the last page of the datatable.
My .xhtml page is:
```
<h:form id=...>
...
<p:dataTable var="webTemplate" id="templateTable" widgetVar="tbl1"/>
...
</h:form>
<h:form id=...>
...
<p:inputText id="txt_description" value="#{templateController.templ... | [
0.21957214176654816,
0.14658063650131226,
0.7645900249481201,
-0.09710415452718735,
0.004360649269074202,
-0.12720583379268646,
-0.09113022685050964,
-0.37199774384498596,
-0.0237513966858387,
-0.9427847862243652,
-0.11715298146009445,
0.18389292061328888,
-0.1859641820192337,
0.2656030058... | |
</p:inputText>
...
</h:form>
<script type="text/javascript">
function setTabIndexTT(){
tbl1.getPaginator().setPage(#{calculatePageTable.pageTableTemplate});
}
</script>
```
bean:
```
@ManagedBean
@SessionScoped
public class CalculatePageTable {
private int pageTabl... | [
-0.1260889619588852,
-0.10430656373500824,
0.8763032555580139,
-0.26613274216651917,
-0.1464276909828186,
0.060699909925460815,
0.20139558613300323,
-0.5867061018943787,
-0.015102117322385311,
-0.7155608534812927,
-0.40456297993659973,
0.40305688977241516,
-0.362210214138031,
-0.0838057845... | |
pageTableTemplate = d.getPageCount() - 1;
}
public int getPageTableTemplate() {
return pageTableTemplate;
}
public void setPageTemplateField() {
final DataTable d = (DataTable) FacesContext.getCurrentInstance().getViewRoot()
.findComponent("detailsTable:webTemplateUpdateTable");
... | [
0.013346225954592228,
0.13027435541152954,
0.9896862506866455,
-0.2599080801010132,
-0.14756323397159576,
-0.0242930855602026,
0.11791114509105682,
-0.511879026889801,
0.11186429113149643,
-0.8082155585289001,
-0.3442467153072357,
0.6256767511367798,
-0.21217338740825653,
0.061287883669137... | |
set last page of my datatable when adding a row?
Primefaces version is 3.1.1
In your managed bean you can try this code:
```
public void setPageDataTable() {
final DataTable d = (DataTable) FacesContext.getCurrentInstance().getViewRoot()
.findComponent("form:templateTable");
int first = 1;
if (d.g... | [
0.019652310758829117,
-0.15783065557479858,
1.0935720205307007,
-0.3680709898471832,
-0.163473442196846,
0.08308552950620651,
0.1014861986041069,
-0.2527424693107605,
-0.17518965899944305,
-1.1561399698257446,
-0.21860870718955994,
0.3438051640987396,
-0.49253594875335693,
0.10749299824237... | |
d.setFirst(first);
}
```
Call this method when you add a new row | [
0.15409192442893982,
0.13760176301002502,
0.47095125913619995,
-0.3832133114337921,
0.267442524433136,
-0.10283153504133224,
-0.049654342234134674,
-0.29370373487472534,
-0.1644989550113678,
-0.7731680870056152,
-0.3027918338775635,
0.6694253087043762,
-0.5842617750167847,
0.23780155181884... | |
Suppose I have a class `A`
```
class A
attr_accessor :x, :y
def initialize(x,y)
@x, @y = x, y
end
end
```
How can I get `x` and `y` attributes without knowing how exactly they were named.
E.g.
```
a = A.new(5,10)
a.attributes # => [5, 10]
```
Use introspection, Luke!
```
class A
attr_accessor :x, :... | [
-0.16713307797908783,
0.31925874948501587,
0.3446817398071289,
0.006959380581974983,
0.08546289801597595,
0.12758667767047882,
0.17117621004581451,
-0.10905342549085617,
0.0773254781961441,
-0.39609071612358093,
-0.1925337314605713,
0.5248435139656067,
-0.2684721350669861,
0.14653065800666... | |
Is the following C++ code well-formed:
```
void consumer(char const* p)
{
std::printf("%s", p);
}
std::string random_string_generator()
{
// returns a random std::string object
}
consumer(random_string_generator().c_str());
```
The problem I have with it is, that after creating the temporary std::string object... | [
0.4172886610031128,
0.24690277874469757,
0.3854052424430847,
-0.30298224091529846,
0.07270977646112442,
0.2191765010356903,
-0.00899478979408741,
-0.3054690361022949,
-0.04948730021715164,
-0.33380207419395447,
0.05088641867041588,
0.8133283257484436,
-0.09446965157985687,
0.53508943319320... | |
object is
destructed. The string object you're concerned about is a temporary.
It will be destructed at the end of the full expression, not before and
not after. In your case, the end of the full expression is after the
call to `consumer`, so your code is safe. It wouldn't be if `consumer`
saved the pointer somewhere, ... | [
0.06139160692691803,
0.05524982884526253,
0.6589552760124207,
-0.17708073556423187,
-0.026855744421482086,
-0.10786529630422592,
0.3926703929901123,
-0.19743984937667847,
-0.3310653567314148,
-0.3591313362121582,
-0.06574120372533798,
0.6887881755828857,
-0.23826386034488678,
0.29750660061... | |
either, but the same issues affect
any user written string class.) | [
-0.05957091972231865,
-0.07969929277896881,
-0.019382508471608162,
0.03839670866727829,
0.016924338415265083,
-0.02819765917956829,
0.45464614033699036,
-0.09536170214414597,
-0.13392674922943115,
-0.2531905770301819,
-0.4720997214317322,
0.5046437382698059,
-0.14178338646888733,
0.0320745... | |
Normally we have to do like this to invoke a function from a function pointer:
```
int foo()
{
}
int main()
{
int (*pFoo)() = foo; // pFoo points to function foo()
foo();
return 0;
}
```
In the Linux kernel code, [sched\_class](http://lxr.linux.no/#linux+v3.3.1/include/linux/sched.h#L1101) has many func... | [
-0.22616824507713318,
-0.3065934479236603,
0.4586232006549835,
-0.13286010921001434,
0.08013378083705902,
0.07844789326190948,
0.061220165342092514,
-0.13373686373233795,
-0.08731602877378464,
-0.6839813590049744,
-0.2928386628627777,
0.43784424662590027,
-0.4699419140815735,
0.17810799181... | |
void (*yield_task) (struct rq *rq);
bool (*yield_to_task) (struct rq *rq, struct task_struct *p, bool preempt);
.....
}
```
In [pick\_next\_task](http://lxr.linux.no/#linux+v3.3.1/kernel/sched/core.c#L3122) function, it defines a local instance of `sched_class` named `class`, and directly invoke the f... | [
-0.3391907513141632,
-0.22490645945072174,
0.23464664816856384,
-0.20148113369941711,
0.18292783200740814,
0.25022241473197937,
-0.09119424968957901,
-0.12127701938152313,
0.05766628310084343,
-0.5915265679359436,
-0.3293081521987915,
0.4573439359664917,
-0.37002241611480713,
0.18890105187... | |
know that if all tasks are in
* the fair class we can call that function directly:
*/
if (likely(rq->nr_running == rq->cfs.h_nr_running)) {
p = fair_sched_class.pick_next_task(rq);
if (likely(p))
return p;
}
for_each_class(class) { | [
-0.07750497758388519,
-0.4599691331386566,
0.32232239842414856,
0.029704997316002846,
0.15113498270511627,
0.11790595948696136,
-0.11685675382614136,
-0.3724477291107178,
0.02208695560693741,
-0.6626847386360168,
0.06693848222494125,
0.4344150424003601,
-0.07704009860754013,
-0.06385515630... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.