text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
AudioQueueBufferRef mBuffers[AUDIO_BUFFERS];
unsigned long frameSize;
BOOL *run;
} AQCallbackStruct;
// In some method
AQCallbackStruct out;
out.mDataFormat
out.mDataFormat.mFormatID = kAudioFormatLinearPCM;
out.mDataFormat.mSampleRate = 44100.0;
out.mDataFormat.mChannelsPerFrame = 2;
out.mDataFormat.mBitsPerChan... | [
-0.11960078030824661,
0.033104199916124344,
0.6978113651275635,
0.00762649392709136,
0.07777001708745956,
0.17639194428920746,
0.686095118522644,
-0.5567983388900757,
-0.0491681732237339,
-0.313199907541275,
-0.5463642477989197,
0.7868679761886597,
-0.23775631189346313,
0.427938312292099,
... | |
&out,
CFRunLoopGetCurrent(),
kCFRunLoopCommonModes,
0, | [
-0.15516698360443115,
-0.0775245949625969,
0.8609269857406616,
-0.016312511637806892,
-0.3247259259223938,
0.1283649057149887,
-0.2504194378852844,
-0.36225154995918274,
-0.2962154150009155,
-0.12805688381195068,
-0.11472432315349579,
0.6671925187110901,
-0.43254292011260986,
0.12076347321... | |
&out.queue);
if (err != noErr) NSLog(@"AudioQueueNewOutput() error: %d", err);
for (int i=0; i<AUDIO_BUFFERS; i++) {
err = AudioQueueAllocateBuffer(out.queue, out.frameSize, &out.mBuffers[i]);
if (err != noErr) NSLog(@"Output AudioQueueAllocateBuffer() error: %d", err);
out.mBuffers[i]->mAudioDataByteS... | [
-0.09004615992307663,
0.23678219318389893,
0.7747461795806885,
-0.3529345691204071,
0.3158908486366272,
-0.18227724730968475,
0.7885077595710754,
-0.32668736577033997,
-0.0880490392446518,
-0.217174232006073,
-0.6567651629447937,
1.0010466575622559,
-0.24850846827030182,
0.4052994549274444... | |
is reached, and the value of the
> function call is used by the caller, the behavior is undefined.
(AFAIR previous version of the standard had similar wording)
So it would be a good idea to transform all the functions of that sort that you have to `void` functions, so no user of such a function could be tempted to u... | [
-0.18759237229824066,
-0.35900944471359253,
0.6126489639282227,
-0.14326126873493195,
0.16405543684959412,
-0.19258569180965424,
0.6865426301956177,
-0.08815399557352066,
0.1636197715997696,
-0.5426992774009705,
-0.30611953139305115,
0.5727019309997559,
-0.09131629019975662,
0.227244317531... | |
I have a problem that comes up when I was developing an app on Android. However, the problem is:
There are `x` boxes and `y` balls where `x <= y`, and I want to distribute the balls to put them inside the boxes **in order**. For example: 3 boxes; `box A`, `box B` and `box C` - and 5 balls; `ball 1`, `ball 2`, `ball 3`... | [
0.16859248280525208,
0.07804429531097412,
0.21485495567321777,
0.26331719756126404,
0.07199074327945709,
0.4196191132068634,
-0.12469302862882614,
-0.19924961030483246,
-0.4054746925830841,
-0.8233852386474609,
0.00321740610525012,
-0.026882721111178398,
-0.5164215564727783,
0.312532663345... | |
if one box has more balls than the others). Here is a loop (missing an increment value) that simulates the problem:
```
int boxCount = 0; // first box is 0 and last box is x
int numOfBalls = y;
for(int i = 0; i < numOfBalls; i++, boxCount += ???)
{
boxes.get(boxCount).add(balls.get(i));
}
```
What equation shoul... | [
-0.11951475590467453,
-0.1511436253786087,
0.21582002937793732,
-0.03352148458361626,
0.09852784126996994,
0.3364117443561554,
0.13846683502197266,
-0.5369974374771118,
-0.30634379386901855,
-0.4056366980075836,
-0.26588401198387146,
0.3996983468532562,
-0.5375862717628479,
-0.000101326899... | |
3 5
2 4
```
not
```
A B C
---------
1 2 3
4 5
```
```
int flag;
int lastBallAdded = 0;
int k = numOfBalls/numOfBoxes;
int m = numOfBalls%numOfBoxes;
for(int i = 0; i < numOfBoxes; i++, lastBallAdded+=k+flag) {
flag = i<m;
for(int j=lastBallAdded;j<lastBallAdded + k + flag;j++)
boxes... | [
-0.288622111082077,
-0.07272064685821533,
0.1954513043165207,
-0.1781722754240036,
0.12254181504249573,
0.23408442735671997,
0.22408676147460938,
-0.5906052589416504,
-0.32337212562561035,
-0.6303844451904297,
-0.5342938303947449,
0.27675703167915344,
-0.2685978412628174,
0.190103098750114... | |
can alternatively write it as
```
int i;
for(i = 0; i < m; i++) {
//add k+1 balls
}
for(;i<numOfBoxes; i++) {
//add k balls
}
``` | [
-0.26878663897514343,
-0.08479045331478119,
0.22957098484039307,
-0.2846829295158386,
-0.14087188243865967,
0.25939255952835083,
0.08982989192008972,
-0.22828003764152527,
-0.2147049754858017,
-0.440309077501297,
-0.29092031717300415,
0.12641339004039764,
-0.3529298007488251,
0.13292479515... | |
Currently I have the following:
`$config['upload_path'] = 'this/path/location/';`
What I would like to do is create the following controller but I am not sure how to attack it!!
```
$data['folderName'] = $this->model->functionName()->tableName;
$config['upload_path'] = 'this/'.$folderName.'/';
```
How would I cre... | [
0.009859573096036911,
-0.11014775931835175,
0.7655792236328125,
0.030455710366368294,
0.06405279040336609,
-0.31625646352767944,
0.10186252743005753,
-0.3282865881919861,
-0.13872583210468292,
-0.7308151125907898,
-0.01700986735522747,
0.6579770445823669,
-0.28214237093925476,
0.4698344171... | |
can upload files to it.
2. i have removed the `else` since its not useful here ( as @mischa noted ).. | [
0.3277529180049896,
0.0832497701048851,
0.17265629768371582,
0.2164054960012436,
0.053078778088092804,
-0.42585209012031555,
0.244424507021904,
0.29376038908958435,
-0.09937715530395508,
-0.6947616934776306,
-0.2129639834165573,
0.3620166778564453,
-0.04211558401584625,
0.1432783007621765,... | |
I have html page with many lines and one of the line is:
```
var premium_download_link = 'http://www.someurl.com/';
```
how can I find that line inside html page and extract <http://www.someurl.com> from the line?
Using `sed`:
```
sed -n -e "s/.*var premium_download_link = '\([^']*\)';.*/\1/p"
```
The `-n` flag s... | [
0.3657837212085724,
-0.17277660965919495,
0.9019145965576172,
-0.1302836388349533,
-0.13060034811496735,
0.11258788406848907,
0.006823661271482706,
-0.12640967965126038,
0.07517606765031815,
-0.6201350688934326,
-0.012437190860509872,
0.5320400595664978,
-0.06575734168291092,
-0.0494408197... | |
variable named `url`. | [
-0.23464946448802948,
0.007429376244544983,
0.3971671164035797,
0.09416937083005905,
-0.16686807572841644,
0.06536561995744705,
0.022405335679650307,
0.27369600534439087,
-0.15535874664783478,
0.08141365647315979,
-0.28324028849601746,
0.16704729199409485,
-0.2876567542552948,
0.6810238957... | |
Can somebody please point me to a reference for the syntax of the expression language used in csproj / vbproj files within Visual Studio ? I've been seeing usages like the following :
```
<FilesForPackagingFromProject Include="%(CustomFiles.Identity)">
```
... and I'm trying to understand the '.Identity' bit.
The ... | [
0.34182167053222656,
-0.13693782687187195,
0.15435828268527985,
0.3339945673942566,
0.1429477035999298,
-0.15650300681591034,
-0.03967863321304321,
-0.12310146540403366,
-0.21016860008239746,
-0.7496070861816406,
-0.13272351026535034,
0.5569940209388733,
0.004587936215102673,
0.08027896285... | |
I have three fields for date input - day, month, year.
Once it is input, I should verify it. The following code is used:
```
$('#test').click(function(event) {
var daySelector = "#dd",
monthSelector = "#mm",
yearSelector = "#yyyy";
var day = $(daySelector).val() == "" ? 1 : parseInt($(daySelect... | [
0.17672795057296753,
0.11113878339529037,
0.7976029515266418,
-0.034907951951026917,
0.16937433183193207,
0.37716713547706604,
0.13928192853927612,
-0.15834833681583405,
-0.02437012456357479,
-0.5020442008972168,
-0.22832313179969788,
0.3214896619319916,
0.10261306911706924,
0.463337600231... | |
var result = !isNaN(date.getTime());
});
```
But it accepts (i.e. returns `true`) wrong values like 33/55/2000. Where is my mistake?
[Demo](http://jsfiddle.net/and7ey/43BpT/1/)
I've tried [another approach](http://jsfiddle.net/43BpT/3/) - it doesn't work well also.
Date object automaticly converts overflows.
So... | [
-0.018344206735491753,
-0.1519039422273636,
0.5422969460487366,
-0.27894335985183716,
-0.2899423837661743,
0.03482253849506378,
0.4200435280799866,
-0.37618154287338257,
-0.26386693120002747,
-0.21824976801872253,
0.013367142528295517,
0.37933191657066345,
0.05052075907588005,
0.3400300443... | |
Date constructor. | [
-0.08965219557285309,
0.06647936999797821,
0.30092594027519226,
0.12391193211078644,
0.4690375328063965,
0.5300260186195374,
-0.5569133162498474,
-0.020556924864649773,
-0.33087098598480225,
-0.31438949704170227,
-0.15357737243175507,
0.2698459327220917,
0.13405799865722656,
0.335986912250... | |
I am trying to pass a JavaScript function with an onclick event in php. The problem I am facing is that the function that I need to pass has a parameter that needs to be in double quotes as follows:
```
onclick="removeElement("div8")"
```
Now when I use JavaScript to generate the parameter it comes out fine, but whe... | [
0.2830570936203003,
0.3291696310043335,
0.3922753632068634,
-0.2646283805370331,
-0.2684284746646881,
-0.12203424423933029,
0.4363866448402405,
-0.3255942463874817,
-0.011817012913525105,
-0.4312988519668579,
0.06375755369663239,
0.27015793323516846,
-0.6166732311248779,
0.1071267053484916... | |
that the function is returned as a whole and not get the space in between?
This is happening because you have quotes inside quotes. This will not work, and breaks the HTML parser. It is seeing the onclick as `removeElement(`, and then it sees an attribute called `div8")"`.
Try this:
```
echo '.....onclick="removeElem... | [
0.23264239728450775,
0.20495332777500153,
0.4133605360984802,
-0.2867733836174011,
-0.05538228526711464,
-0.05250244215130806,
0.4415074586868286,
-0.34625619649887085,
-0.1127573624253273,
-0.08043419569730759,
-0.29586729407310486,
0.5997537970542908,
-0.5459787845611572,
0.0920728817582... | |
Suppose I have the following values:-
```
xyz12@abc
xyz1@abc
xyz15@abc
xyz2@abc
xyz22@abc
```
I want the sorted output to be in form:-
```
xyz1@abc
xyz2@abc
xyz12@abc
xyz15@abc
xyz22@abc
```
If I use strcmp, then it will compare by each character and will give xyz1@ > xyz12 as @ > 2 which I don't want. What diffe... | [
-0.2207566499710083,
-0.03653883934020996,
0.316721111536026,
-0.04655411094427109,
-0.13079141080379486,
0.17798995971679688,
0.03546494245529175,
-0.1270999014377594,
0.004284652881324291,
-0.8740420341491699,
-0.1703893393278122,
0.14461897313594818,
-0.37742602825164795,
0.010186940431... | |
I am wondering if there is a way that you can get am/pm from the users set time on iOS.
I am currently using this method to get time:
```
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"HH"];
hours.text = [formatter stringFromDate:[NSDate date]];
[formatter setDateFormat:@"m"]... | [
0.5132580399513245,
0.24043160676956177,
0.8319532871246338,
-0.0021115408744663,
0.41402357816696167,
-0.1845986247062683,
0.11430013179779053,
-0.3503590226173401,
-0.4138355851173401,
-0.4870556592941284,
-0.010382278822362423,
0.3903444707393646,
0.17674888670444489,
0.2133941799402237... | |
with am/pm formatting.
```
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"hh:mm:ss a"];
NSLog(@"Today's Date and Time: %@", [formatter stringFromDate:[NSDate date]]);
[formatter release];
``` | [
0.12132762372493744,
0.11809167265892029,
0.8605250120162964,
0.003954543732106686,
0.4318542778491974,
-0.1541193425655365,
-0.04186224192380905,
-0.46933820843696594,
-0.19688095152378082,
-0.3484765887260437,
-0.6331844329833984,
0.3515264689922333,
0.20645369589328766,
0.31560489535331... | |
I have a jQuery event for all `<a>` tags set up like this
```
$('a').live('click', function(event)
```
and I am getting the href of the tag using this
```
var href = event.target.href;
```
Here is my HTML:
```
<a href="/test/path/">
<p>My Link</p>
</a>
```
I can successfully log `var href` in the console ... | [
-0.026467766612768173,
-0.051521774381399155,
0.4158012866973877,
-0.04889889433979988,
-0.18289099633693695,
-0.15294775366783142,
0.20942066609859467,
-0.1719980537891388,
-0.09643015265464783,
-0.8406488299369812,
-0.00003088384255534038,
0.5035791397094727,
-0.12016851454973221,
0.0160... | |
it is child of?
Get your href value like this
```
$('a').live('click', function(){
var target=$(this).attr("href");
alert(target);
});
```
JsFiddle Sample <http://jsfiddle.net/Gz6mT/7/>
If you are using jQuery 1.7+, Use `.on()` to attach event handlers insted of live. live() is deprecated as of jQuery 1.7
<htt... | [
-0.016209688037633896,
-0.3237713575363159,
0.5739795565605164,
-0.13943566381931305,
0.052476707845926285,
0.09644395112991333,
-0.0017050174064934254,
-0.26547449827194214,
0.014420862309634686,
-0.2947819232940674,
-0.31306740641593933,
0.39795607328414917,
-0.437797486782074,
0.2090633... | |
I am unable to use mqueue.h in mac. When I try to include this header file in my C++ program it says Cannot find include file . Is there a way to use this in mac ? Or are there any universal alternatives to this.
I want to use the O\_NOBLOCK flag which is present in mqueue.h ?
I found out that the IPC message queues... | [
-0.09639022499322891,
0.06051474064588547,
0.45042893290519714,
-0.08673260360956192,
0.2432645708322525,
-0.07369957119226456,
0.26520806550979614,
0.15812350809574127,
-0.5109105706214905,
-0.7540327310562134,
-0.2628042697906494,
0.39590340852737427,
-0.5292466282844543,
0.2496826797723... | |
16384
```
`mqueueh.h` is for POSIX messaging queues, and is not available on OS X.
`O_NONBLOCK` has nothing to do with that, and is defined in `fcntl.h`.
`#include <sys/fcntl.h>`
should do the trick. | [
-0.47485116124153137,
0.026237597689032555,
0.5135602355003357,
-0.13970644772052765,
0.051235225051641464,
0.0908515527844429,
0.2599576711654663,
0.43610575795173645,
-0.31069624423980713,
-0.0692339837551117,
-0.3329883813858032,
0.4011973440647125,
-0.9372630715370178,
-0.0715281814336... | |
In my current project, I am attempting to add some syntax to my project globally by performing a dofile() at the very top of my `main.lua`. I am then requiring a third file that uses what I'm attempting to add as a global in my project; however I receive an error `attempting to index the global value` upon doing so.
F... | [
-0.13255101442337036,
0.09403040260076523,
0.20063751935958862,
-0.12742693722248077,
0.22530899941921234,
0.06007816269993782,
0.4074710011482239,
0.4021212160587311,
-0.12022045999765396,
-0.9375059008598328,
-0.21833540499210358,
0.29389962553977966,
-0.4394426941871643,
0.0351391062140... | |
index global 'test1' (a nil value))
```
Shouldn't test1 already exist as a global in this case? How can I get around this?
main.lua:
```lua
dofile('test1.lua')
require('test2')
```
test1.lua
```lua
test1 = {}
function test1:hello()
print("hello")
end
```
test2.lua
```lua
module('test2')
test1:hello()
```... | [
-0.21108590066432953,
-0.07094588130712509,
0.2065536379814148,
-0.024408183991909027,
0.051954079419374466,
-0.1390763223171234,
0.24820736050605774,
-0.22412927448749542,
-0.05328948423266411,
-0.4890124499797821,
-0.30139264464378357,
0.5269759893417358,
-0.3294382095336914,
-0.04498893... | |
I'm interested in using [pugixml](http://pugixml.org/) to parse HTML documents, but HTML has some [optional closing tags](http://www.w3.org/TR/REC-html40/index/elements.html). Here is an example: `<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">`
Pugixml stops reading the HTML as soon as it encou... | [
0.1521405428647995,
0.07722482085227966,
0.5583036541938782,
-0.22708749771118164,
-0.15341751277446747,
0.09103931486606598,
-0.053825993090867996,
-0.008581654168665409,
-0.07532583177089691,
-0.8048993945121765,
-0.19412511587142944,
0.27964648604393005,
-0.28576698899269104,
-0.0381314... | |
HTML documents in the wild would fail if I try to parse them with pugixml. Is there a way to avoid that? If there is no way to "fix" that, then is there another HTML parsing tool that's as about as fast as pugixml?
Update
------
It would also be great if the HTML parser also supports XPATH.
I ended up taking pugixml,... | [
0.28397607803344727,
-0.18821609020233154,
0.35623615980148315,
0.16083799302577972,
-0.3102700412273407,
-0.1638021618127823,
0.24648500978946686,
-0.21978718042373657,
-0.15709513425827026,
-0.4588642418384552,
0.27436763048171997,
0.5461999177932739,
-0.4407121539115906,
-0.357283085584... | |
on making it compliant with the HTML specifications. | [
0.322701632976532,
0.30114829540252686,
-0.05349362641572952,
0.059172533452510834,
-0.03789966553449631,
-0.21463295817375183,
-0.10058354586362839,
0.21006764471530914,
0.05662643909454346,
-0.3859451115131378,
-0.24245838820934296,
0.6153988838195801,
0.0003005032194778323,
-0.469816982... | |
so this was working perfect up until an hour ago and since then i have racked my brain to fix it and got nothing, maybe im missing the obvious (thats usually the case).
The code prints out a list of users and a button to ban them in a table, however the problem is if you click ban on say.. the 34th user it bans the fi... | [
0.17611286044120789,
0.2287730723619461,
0.31139591336250305,
-0.22161607444286346,
-0.2906753420829773,
-0.3981889486312866,
0.5317538380622864,
-0.006042653229087591,
-0.5213391184806824,
-0.3687281608581543,
0.11761707812547684,
0.11685959249734879,
-0.735745906829834,
0.270046532154083... | |
right except for the uID):
```
$query = mysql_query("SELECT id, full_name, banned, username from `tblUsers`");
while($row = mysql_fetch_array($query)){
$uID = $row['id'];
if($row['banned'] == '0'){
$banBool = '<form id="ban" method="post" action="ban.php?uid='.$uID.'... | [
-0.23837730288505554,
-0.02537544071674347,
0.6273911595344543,
-0.24721823632717133,
0.1347142457962036,
-0.20474274456501007,
0.05331701040267944,
-0.26327213644981384,
-0.28599363565444946,
-0.1345071941614151,
-0.5866928100585938,
0.3293191194534302,
-0.3798746168613434,
-0.01958938315... | |
<a onclick="document.getElementById(\'ban\').submit();">Ban</a>
</form>'; }else{
$banBool = '<form id="unban" method="post" action="unban.php?uid='.$uID.'">
<input type="hidden" name="name" value="" />
<a onclick="document.getElementById(\'unban\').submit();">UnBan</a>
... | [
-0.11771178990602493,
-0.18265827000141144,
0.2501581907272339,
-0.21525031328201294,
-0.033900186419487,
-0.0415162555873394,
0.46108192205429077,
-0.34835290908813477,
-0.29984477162361145,
-0.24370795488357544,
-0.5602273941040039,
0.20500817894935608,
-0.5491875410079956,
0.10621963441... | |
$status = 'Banned';
}else{
$status = 'Active';
}
echo "<tr><td>" . $row['username'] . " " . $uID . "</td><td>" . $banBool . "</td><td>" . $status . "</td><td>" . $row['full_name'] . "</td></tr>"; | [
0.22077669203281403,
-0.299336314201355,
0.24146971106529236,
-0.5628991723060608,
0.11991152167320251,
-0.2577286660671234,
0.3930620849132538,
-0.2461017519235611,
-0.43811556696891785,
-0.03437059745192528,
-0.5613975524902344,
0.36163759231567383,
-0.6974528431892395,
0.171231001615524... | |
}
```
The issue is in the action="unban.php?uid='.$uID.' as when i trace the path the id is always the lowest number (top result)
ban.php
```
<?php
include '../../includes/dataBase.class.php';
sql::connect();
if(!sql::checkAdmin() == 1){
header("Location: ../myaccount.php");
}
if(!isset($_GET['uid'])){
head... | [
-0.09625076502561569,
0.188262939453125,
0.20643718540668488,
-0.1627568006515503,
0.04242543876171112,
-0.09885544329881668,
0.35628634691238403,
-0.37838107347488403,
-0.4194076359272003,
-0.325915664434433,
-0.39017143845558167,
0.2001844197511673,
-0.5499448180198669,
0.283392578363418... | |
that one.
The solution is very easy:
```
$query = mysql_query("SELECT id, full_name, banned, username from `tblUsers`");
while($row = mysql_fetch_array($query)){
$uID = $row['id'];
if($row['banned'] == '0'){
$banBool = '<form id="ban' . $uID . '" method="post" actio... | [
-0.13176800310611725,
-0.27726030349731445,
0.5344834327697754,
-0.2090030014514923,
0.04531459882855415,
-0.3434793949127197,
0.2816932499408722,
-0.29375606775283813,
-0.20717735588550568,
-0.3205360770225525,
-0.3611123263835907,
0.45020657777786255,
-0.5456029772758484,
0.1287915259599... | |
<a onclick="document.getElementById(\'ban' . $uID . '\').submit();">Ban</a>
</form>'; }else{
$banBool = '<form id="unban' . $uID . '" method="post" action="unban.php?uid='.$uID.'">
<input type="hidden" name="unban" value="" />
<a onclick="document.getElementById(\'unban' ... | [
-0.18619032204151154,
-0.2268524169921875,
0.21209190785884857,
-0.24239064753055573,
0.001017600647173822,
0.053322773426771164,
0.49911195039749146,
-0.3081739842891693,
-0.12565048038959503,
-0.2569514811038971,
-0.6717459559440613,
0.2769843339920044,
-0.5004128217697144,
0.05898965522... | |
}
if($row['banned'] == '1'){
$status = 'Banned';
}else{
$status = 'Active';
}
echo "<tr><td>" . $row['username'] . " " . $uID . "</td><td>" . | [
0.1371951401233673,
-0.2778189778327942,
-0.031603261828422546,
-0.38777685165405273,
0.1318873018026352,
-0.14151501655578613,
0.42141592502593994,
-0.5209077596664429,
-0.2586146295070648,
-0.1071304902434349,
-0.5158050060272217,
0.4485405385494232,
-0.5417036414146423,
0.02085788175463... | |
$banBool . "</td><td>" . $status . "</td><td>" . $row['full_name'] . "</td></tr>";
}
```
I just included the User ID on every form and JS call so that they are unique. (Also, your second hidden field had the name as `name`) | [
0.21769745647907257,
-0.06768520921468735,
0.22629228234291077,
-0.3484434485435486,
-0.0734204575419426,
-0.16854365170001984,
0.18803057074546814,
-0.07685395330190659,
-0.16444139182567596,
-0.1688208132982254,
-0.2541159391403198,
0.34425875544548035,
-0.5930637121200562,
-0.0436814278... | |
Filter function returns a sublist of elements which return true for a given function. Is it possible to get the list of elements which return false in a different list without going over the entire list again.
Example:
`trueList,falseList = someFunc(trueOrFalseFunc,list)`
PS : I know it can be done by initializing t... | [
0.24235694110393524,
-0.464033842086792,
0.10136842727661133,
-0.05213132128119469,
0.06470678746700287,
-0.15303640067577362,
0.36527112126350403,
-0.39395901560783386,
0.02429887093603611,
-0.8774181008338928,
0.1517176330089569,
0.5782213807106018,
-0.540400505065918,
-0.176052272319793... | |
iterators:
```
from itertools import tee
def partition(lst, pred):
l1, l2 = tee((pred(e), e) for e in lst)
return (x for cond, x in l1 if cond), (x for cond, x in l2 if not cond)
```
Use it like this, and remember that the values returned are *iterators*:
```
lst = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
evens, odd... | [
-0.22483401000499725,
-0.0806945264339447,
0.18413054943084717,
-0.4168606102466583,
0.017317483201622963,
0.3056902587413788,
-0.13597936928272247,
-0.6304886341094971,
-0.17943885922431946,
-0.5668760538101196,
-0.16552980244159698,
0.762561559677124,
-0.1929813176393509,
-0.416247069835... | |
In this little program:
```
#include <unistd.h>
#include <stdint.h>
#include <stdio.h>
int main() {
uint8_t a = 0;
uint8_t b = 255;
if (a == (b + 1)) {
printf("Equal\n");
} else {
printf("Not equal\n");
}
if (a == ((b + 1) & 0xFF)) {
printf("Equal\n");
} else {
... | [
-0.13172146677970886,
-0.015990637242794037,
0.28611159324645996,
-0.32317912578582764,
-0.10847626626491547,
0.1972605288028717,
0.35565656423568726,
-0.5439389944076538,
-0.15158693492412567,
-0.49141326546669006,
-0.15048791468143463,
0.5003613233566284,
-0.5446861982345581,
0.070211879... | |
}
```
I get:
```
Not Equal
Equal
```
Why doesn't the comparison work unless I forcibly take the last 8 bits? I'm guessing I'm missing some nuance of unsigned arithmetic here...
I'm using gcc 4.4.5 if that makes a difference.
Because of integer promotions, both operands of the `==` and `+` operator are promoted to... | [
-0.04191914573311806,
0.1849079579114914,
0.2201811522245407,
-0.24374184012413025,
0.0014294014545157552,
-0.01956961862742901,
0.18191301822662354,
-0.6147029995918274,
-0.04643424600362778,
-0.34079402685165405,
-0.09202707558870316,
0.7541229724884033,
-0.26058006286621094,
0.066537857... | |
Does someone know if Guava or Java8 in the future will provide persistent collection-implementations inspired by more functional implementations as for instance in Clojure or Scala (providing snapshots, efficient modifications due to sharing of tree-structures and so on)?
With regards to Guava, there is a discussion on... | [
-0.29505518078804016,
0.21686172485351562,
-0.07419206202030182,
0.07271018624305725,
0.0011123467702418566,
-0.10836533457040787,
-0.01107388362288475,
0.09737645834684372,
-0.6019641757011414,
-0.2088293582201004,
0.043304380029439926,
0.377204030752182,
-0.26059284806251526,
0.122180834... | |
and Lambda. There will be other inclusions, but no mention of persistent collections. | [
0.1853083074092865,
-0.08675120025873184,
-0.17659246921539307,
0.215803861618042,
0.1744835525751114,
0.1443086713552475,
-0.2653042674064636,
0.27868393063545227,
-0.351112425327301,
-0.2933380603790283,
-0.2089270055294037,
0.3075808882713318,
-0.47026675939559937,
0.008428430184721947,... | |
I have a main class in Android java project where all functions are defined. Then I have 2 other classes that extend the main class and implement `Runnable`.
* main class: All main functions
* class 2: I use all main functions and have a static variable `X` which I modify in file 2.
* class 3: I use all main functions... | [
0.008808713406324387,
0.07099049538373947,
0.37279409170150757,
-0.3199872672557831,
-0.19970428943634033,
0.24828755855560303,
0.4681694209575653,
-0.01879090629518032,
-0.020588168874382973,
-0.7578237652778625,
-0.21930280327796936,
0.21994765102863312,
-0.4596635103225708,
0.1395702809... | |
what. I have tried `volatile`, `synchronized(thread)`, `getvalue()`, etc. but it is not working.
What should I do to read the values of `Class2.X` such that it is not null from the main class?
Here is the code:
```
Thread t = new Thread(new Functionss(mRgbImage));
t.start();
Thread t2 = new Thread(new Functionss_2(m... | [
0.41370710730552673,
-0.3549541234970093,
0.43538910150527954,
-0.4692510962486267,
0.40158623456954956,
-0.008422854356467724,
0.30799809098243713,
-0.19241394102573395,
-0.3715818524360657,
-0.6734302043914795,
-0.20526079833507538,
0.6473930478096008,
-0.42694640159606934,
0.34886530041... | |
mImageView.setImageBitmap(final_added);
```
`mRgbImage2` and `mRgbImage3` are the `static volatile` variables.
In fact, I think it is not a problem of variables because when i use an image in the main class and modify it, and then execute `mImageView.setImageBitmap(initial_image)` i am still getting a black screen o... | [
0.14125801622867584,
-0.0526110902428627,
0.3179404139518738,
-0.30725526809692383,
-0.03306867182254791,
0.02172950655221939,
0.5144064426422119,
0.0694189965724945,
-0.2004578411579132,
-0.9194095134735107,
-0.05607515573501587,
0.6328089237213135,
-0.4383067488670349,
0.2114876657724380... | |
debugging your application and putting a break point at the assignment would help.
If you had something like:
```
public class MainClass {
Class2 class2 = new Thread(new Class2());
class2.start();
class2.join();
// Class2.value will == 10 here
}
```
and then:
```
public class Class2 implements Runn... | [
-0.09218118339776993,
-0.17535746097564697,
0.25074324011802673,
-0.11817152053117752,
0.38735494017601013,
-0.5109853148460388,
0.5902647376060486,
0.1627766340970993,
-0.23365041613578796,
-0.49272674322128296,
-0.4276576042175293,
0.7111064195632935,
-0.643180251121521,
0.43277627229690... | |
then the `value` *will* have been updated. This is obviously a simple example and I suspect the `Class2` thread has not actually finished in your code, but as long as the assignment has been reached then `value` *will* have been changed. Again, log messages or debugger would help here.
It would be better to have somet... | [
0.024979595094919205,
-0.18057774007320404,
0.1121106967329979,
-0.22287657856941223,
0.32691970467567444,
-0.4528101086616516,
0.3574273884296417,
0.05560627952218056,
-0.20889782905578613,
-0.6604211926460266,
-0.38013508915901184,
0.8684325218200684,
-0.3495142459869385,
0.1584125906229... | |
...
}
public int getValue() {
return this.value;
}
}
```
So then `MainClass` can access the value from `Class2` and `Class3` without confusion. Notice that you still need the `volatile` keyword there because the value is being get/set from different threads.
Hope something here helps. If you edit... | [
0.13625630736351013,
-0.2651604115962982,
0.10547538101673126,
0.2691957950592041,
0.25704869627952576,
-0.3300449252128601,
0.29471680521965027,
0.1324581801891327,
-0.1782587468624115,
-0.679274320602417,
-0.2540540099143982,
0.6995701193809509,
-0.11155911535024643,
0.08464672416448593,... | |
My application will debug and run perfectly fine on my target device (HTC Desire HD) when the application is installed via USB from Eclipse.
However, when I export to .APK and then install this .APK on my Desire HD (having first manually uninstalled the previous installation of my application), it crashes.
Having i... | [
0.03482404351234436,
0.229895681142807,
0.745914101600647,
0.0028778838459402323,
0.12559308111667633,
-0.08106134831905365,
0.6416045427322388,
0.05496286228299141,
0.23502913117408752,
-0.9189843535423279,
-0.16572287678718567,
0.8160390853881836,
-0.289218544960022,
0.1902531385421753,
... | |
E/AndroidRuntime(2157): Caused by: android.view.InflateException: Binary XML file line #12: Error inflating class com.trevp.myAppName.DashboardLayout`
And further below:
`04-09 21:29:01.101: E/AndroidRuntime(2157): Caused by: java.lang.ClassNotFoundException: com.trevp.myAppName.DashboardLayout in loader dalvik.syste... | [
-0.3624967038631439,
-0.04583926126360893,
0.5466856956481934,
-0.30335307121276855,
0.06503347307443619,
0.03642769157886505,
0.8972928524017334,
0.013705751858651638,
-0.3954315185546875,
-0.765730619430542,
-0.21009139716625214,
0.8298606872558594,
-0.5339460968971252,
0.143386438488960... | |
android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService
-keepclasseswithmembernames class * {
native <methods>;
}
-keepclasseswithmembernames clas... | [
0.26435214281082153,
-0.05759997293353081,
0.7372692823410034,
-0.13683119416236877,
0.23164720833301544,
0.23451249301433563,
0.029763588681817055,
-0.5817738771438599,
-0.19760480523109436,
-0.5933350920677185,
-0.3472841680049896,
0.5952132344245911,
-0.25760024785995483,
0.202912703156... | |
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="top|left"
android:scaleType="centerCrop"
android:id="@+id/dashLayoutImage"
android:src="@drawable/background2" android:drawingCacheQuality="high"/>
<com.trevp.myAppName.DashboardLayout
android:cli... | [
-0.3894996643066406,
-0.06353812664747238,
0.6163104772567749,
0.026533745229244232,
0.05991876497864723,
0.4022073745727539,
-0.039054710417985916,
-0.23595423996448517,
0.01882675476372242,
-0.5624585747718811,
0.08016102761030197,
0.5072963237762451,
0.2486334890127182,
-0.1258262842893... | |
any tips on this. Please shout if there are any other extracts or configuration information required.
This problem has been now fixed by using a completely standard and default `proguard.cfg` file taken from a freshly created test project.
The configuration file I was previously using, as quoted in my original questi... | [
0.3581404387950897,
0.028506942093372345,
0.2639043629169464,
0.07932543009519577,
0.33224111795425415,
-0.301224023103714,
0.25956904888153076,
0.14342759549617767,
-0.2275199145078659,
-0.4834960699081421,
0.08596981316804886,
0.6422439813613892,
-0.2883259356021881,
-0.19459709525108337... | |
Eclipse put into the new project for me, and that enabled a working .APK.
```
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-keep public class * extends android.app.Activity
-keep pub... | [
0.31514543294906616,
0.017499761655926704,
0.4286799430847168,
-0.17188262939453125,
-0.34591779112815857,
0.032615356147289276,
0.243009552359581,
-0.4309929609298706,
-0.18925222754478455,
-0.6596773862838745,
-0.18491868674755096,
0.7875221371650696,
-0.27400264143943787,
-0.21774366497... | |
**[] values();
public static ** valueOf(java.lang.String);
}
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
```
I can see that the differences are in the `-keepclass*` type instructions.
I will now make more of an effort to actually understand how to c... | [
0.32405367493629456,
-0.0906909853219986,
0.5692824721336365,
-0.16778527200222015,
0.2956959009170532,
0.04802526906132698,
0.2813440263271332,
-0.33958542346954346,
-0.2821289002895355,
-0.5214940905570984,
-0.28689247369766235,
0.6053638458251953,
-0.35025542974472046,
0.218320176005363... | |
XML. | [
0.02053937129676342,
-0.04845394566655159,
0.115278460085392,
0.19508099555969238,
-0.07070600986480713,
-0.10780894011259079,
-0.3832699954509735,
0.1629513055086136,
-0.11587657034397125,
-0.5116685628890991,
-0.6091061234474182,
0.23095332086086273,
-0.1721402406692505,
-0.0246626622974... | |
I have a test program that programmatically renders a texture and then renders a simple quad that is skinned with the previously drawn texture. The program is extremely simple and everything is done in 2D. This program works great under linux and everything looks like it should: ;
glGenTextures(1, &textureId);
glBindTexture(GL_TEXTURE_2D, textureId);
glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE); // automatic mipmap generation included in OpenGL v1.4
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, textureSize, textureSize, 0, GL_RGBA, GL_... | [
-0.38547420501708984,
-0.16597479581832886,
0.9619287252426147,
-0.3397223949432373,
-0.21747133135795593,
0.2557580769062042,
0.4240068793296814,
-0.44259515404701233,
0.0881098136305809,
-0.8268027305603027,
-0.6067014336585999,
0.6876663565635681,
-0.3044501543045044,
0.0728394985198974... | |
0);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, textureId, 0);
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, rboId);
bool status = checkFramebufferStatus();
if(!status){
cout<<"FrameBufferObject not cr... | [
-0.2431596964597702,
-0.1055867001414299,
1.0589287281036377,
-0.4042742848396301,
0.037929583340883255,
0.22418899834156036,
0.3666614890098572,
-0.38387081027030945,
0.107174351811409,
-0.6525334119796753,
-0.6738309860229492,
0.806423544883728,
-0.31017282605171204,
0.04578322544693947,... | |
destination to FBO
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fboId);
// clear buffer
glClearColor(0, 0, 0, 1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// draw to the texture
glColor3f(0.0, 1.0, 0.0);
for (int i=1; i<=5; i++){
glBegin(GL_LINE_LOOP);
glVertex2f... | [
-0.5154340863227844,
-0.27700453996658325,
1.1461796760559082,
-0.33914968371391296,
0.1741940677165985,
0.25654855370521545,
0.09506191313266754,
0.009853502735495567,
-0.06065019965171814,
-0.6213759183883667,
-0.40491777658462524,
0.25045034289360046,
-0.25469842553138733,
0.25192025303... | |
glVertex2f( 1 * i/5.0f, 1 * i/5.0f);
glVertex2f(-1 * i/5.0f, 1 * i/5.0f);
glEnd();
}
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
}
```
Rendering the textured quad:
```
void drawTexturedQuad(){
glViewport(50, 50, textureSize, textureSize);
glLoadIdentity();
glClearColor(0.2... | [
-0.1910121738910675,
-0.33445918560028076,
1.1853141784667969,
-0.30363377928733826,
-0.178114116191864,
0.07326119393110275,
0.42818278074264526,
-0.47246259450912476,
-0.053881675004959106,
-0.7024255990982056,
-0.41270142793655396,
0.7090897560119629,
-0.15179942548274994,
0.33688303828... | |
glColor4f(1, 1, 1, 1);
glTexCoord2f(texS, texS); glVertex3f(size, size,0);
glTexCoord2f(0, texS); glVertex3f(-1 * size , size,0);
glTexCoord2f(0, 0); glVertex3f(-1 * size, -1 * size,0);
glTexCoord2f(texS, 0); glVertex3f(size, -1 * size,0); | [
-0.09232808649539948,
-0.256049782037735,
0.590490460395813,
-0.5664793252944946,
-0.27466660737991333,
0.37385058403015137,
0.25865545868873596,
-0.48748141527175903,
0.06018690764904022,
-0.45656538009643555,
-0.6427788138389587,
0.641410231590271,
-0.4968377947807312,
0.4199769198894501... | |
glEnd();
glBindTexture(GL_TEXTURE_2D, 0);
}
```
I'm using GLUT and my display call back is simply:
```
void displayCB(){
drawToTexture();
drawTexturedQuad();
glutSwapBuffers();
}
```
Additionally I have other methods check to see if FrameBufferObjects are supported by OpenGL and if they are not th... | [
0.05302426218986511,
-0.09214603155851364,
0.7205235958099365,
-0.3207976222038269,
-0.25400155782699585,
0.10499505698680878,
0.2677263617515564,
-0.03836582973599434,
0.0318264402449131,
-0.8427932858467102,
-0.036208633333444595,
0.882703423500061,
-0.28656935691833496,
0.15170480310916... | |
So the GL\_EXT\_framebuffer\_object (and core versions too) introduced glGenerateMipmapEXT, which you call exactly in the point where you want mipmaps generated (usually after rendering to the texture).
So, remove the GL\_GENERATE\_MIPMAP stuff and use glGenerateMipmap manually when needed. You can read more about thi... | [
-0.17645488679409027,
0.04592803865671158,
0.80190110206604,
-0.11288737505674362,
-0.013302434235811234,
-0.12833057343959808,
0.02166092023253441,
-0.21097597479820251,
-0.2551461160182953,
-0.6880049705505371,
-0.2949148118495941,
0.4613684117794037,
-0.3942749798297882,
-0.025415368378... | |
I am trying to figure out how to ensure that a user enters an int into a text field with JavaScript. Currently, I have the following:
```
var myVal = $("#myField").val();
if (isInt(myVal)) {
alert("Awesome!");
} else {
alert("No Good");
}
function isInt(i) {
if ((i != null) && (i != undefined) && (i.length > 0... | [
0.44499486684799194,
0.20686222612857819,
0.3109455406665802,
-0.42374780774116516,
0.035224080085754395,
-0.23223024606704712,
0.611739456653595,
-0.3434038758277893,
-0.0028731911443173885,
-0.7765460014343262,
-0.07670283317565918,
0.6004865765571594,
-0.17986881732940674,
-0.0580500923... | |
the `typeof i` is "string". I'm not sure how to perform this kind of validation. Can someone please let me know? I was suprised I didn't have any success when I Googled this.
```
βfunction isInt(myVal) {
return /^[+-]?\d+$/.test(myVal);
}
``` | [
0.034471295773983,
0.19040316343307495,
0.40106090903282166,
-0.23027437925338745,
-0.13469198346138,
-0.12118527293205261,
0.5081397294998169,
-0.057328496128320694,
0.20909616351127625,
-0.6426921486854553,
0.2040875256061554,
0.399255633354187,
-0.1907913237810135,
0.3687770664691925,
... | |
I would like to Bind() a TextBox in an EditItemTemplate but I need to pass the original value of the textbox to a function before it's displayed. My goal is to format the value before displaying it. It's a complex formatting rule so I can't use any of the built-in formatters. It's easy to do when working with Eval() bu... | [
0.18247635662555695,
0.13448384404182434,
0.3840155005455017,
-0.26612389087677,
-0.27521228790283203,
-0.18856653571128845,
0.13288933038711548,
-0.5375452637672424,
0.027792202308773994,
-0.9495953321456909,
-0.013317120261490345,
0.3390246033668518,
-0.43062376976013184,
-0.023885151371... | |
%> MaxLength="255" runat="server" />
</EditItemTemplate>
```
Thanks...
Something like this should be pretty close to what you're looking for:
```
<asp:TextBox Id="TextBox1" runat="server" Text='<%# FormatValue(Eval("Name"), Container.DisplayItemIndex) %>' />
```
And in the code-behind:
```
public object FormatVal... | [
-0.12797585129737854,
0.11654830724000931,
0.8780794739723206,
-0.2179187685251236,
0.00028413283871486783,
0.09287955611944199,
0.26528608798980713,
-0.43630436062812805,
-0.11245277523994446,
-0.7250238060951233,
-0.3161536753177643,
0.5880285501480103,
-0.03526439890265465,
-0.015792800... | |
If I am to inherit from a class, would I have to define all of its virtual and pure virtual functions?
For example, I have a derived class that is inheriting from `QAbstractItemModel`. `QAbstractItemModel` has the following pure virtual functions. If my derived class is not going to use the `index()` and `parent()` me... | [
0.010953104123473167,
-0.05082298815250397,
0.2744603753089905,
0.06271244585514069,
0.2477603256702423,
-0.03550465777516365,
0.16640764474868774,
-0.3089504837989807,
0.21661710739135742,
-0.5103826522827148,
-0.04340463876724243,
0.6256073713302612,
-0.35231953859329224,
0.4125547409057... | |
0;
virtual QModelIndex parent(const QModelIndex &child) const = 0;
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const = 0;
virtual int columnCount(const QModelIndex &parent = QModelIndex()) const = 0;
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const = 0;
```
Yes. Dec... | [
-0.3915168344974518,
-0.09620755910873413,
0.4989754259586334,
-0.17122364044189453,
0.1279490888118744,
0.3988146185874939,
0.2964743971824646,
-0.09145116806030273,
0.12548382580280304,
-0.47487685084342957,
-0.19251656532287598,
0.4156043529510498,
-0.18363113701343536,
0.30246117711067... | |
I know default c# Random() is a pseudo-random number sequence.
I just need one like this, I am not looking for real-random at this question.
Allow me ask questions:
I tried: `new Random(100000000).Next(999999999)`, I got 145156561, just like some [other people said](https://stackoverflow.com/questions/5264412/why-doe... | [
0.07144475728273392,
-0.22470511496067047,
0.119423046708107,
0.03969403728842735,
-0.038930099457502365,
-0.019111379981040955,
0.07835137099027634,
0.06592158228158951,
-0.2202381193637848,
-0.53924959897995,
0.19729332625865936,
0.22011682391166687,
-0.29691004753112793,
0.5464469194412... | |
future?
Not reliably. In general, the way to figure out this kind of thing is to look at the documentation (MSDN for .NET). If the algorithm is not described and isn't an implementation of an otherwise-published algorithm, it should be considered an implementation detail and subject to change.
You need to read these d... | [
0.25425946712493896,
-0.2671174108982086,
0.12726111710071564,
0.39869749546051025,
0.63286954164505,
-0.13710398972034454,
-0.2555599510669708,
-0.10272318124771118,
-0.2997417449951172,
-0.8448002338409424,
-0.0798465833067894,
0.4478040039539337,
-0.2666020393371582,
-0.0790189430117607... | |
4, 3.5, 3.0, 2.0, 1.1, 1.0 .NET Framework Client Profile
>
>
> Supported in: 4, 3.5 SP1 Portable Class Library
>
>
> Supported in: Portable Class Library
Nothing about that says whether it is guaranteed to work the same way across any future versions, or even whether you'll get the same outcome from the various su... | [
0.28679198026657104,
-0.28390371799468994,
0.48189014196395874,
0.07268833369016647,
-0.04967539384961128,
-0.17140638828277588,
0.28774964809417725,
-0.2741888761520386,
-0.25399279594421387,
-0.7171474099159241,
-0.11970998346805573,
0.37409260869026184,
-0.26038187742233276,
-0.01570560... | |
the same seed will result in the same
> pseudo-random sequence in different versions of the .NET Framework. | [
0.20880338549613953,
-0.22728446125984192,
-0.17216213047504425,
0.2414972335100174,
0.15990759432315826,
0.011985097080469131,
0.17550812661647797,
-0.2751293480396271,
0.2726621627807617,
-0.7890322804450989,
0.19311992824077606,
0.06732790172100067,
-0.4326108396053314,
0.39873656630516... | |
I am trying to use another third party application into my application. Basically using some of the services from third party app. But these services need custom permissions defined in the third party application. So I have added those permission in my applications manifest file.
Suppose if my application is installe... | [
0.5232082605361938,
0.06075335666537285,
0.3078038692474365,
0.1238289624452591,
0.2223019301891327,
0.0669102594256401,
0.29950419068336487,
-0.12243254482746124,
-0.46074941754341125,
-0.5457351803779602,
-0.0324094332754612,
0.4346219003200531,
-0.20641349256038666,
0.2858131527900696,
... | |
permissions. Even if both apps where yours, the one that defines the custom permission needs to be installed first, otherwise you will get an exception. If you control both apps, you need to define it in both apps. Otherwise, there is really no workaround: a permission needs to be know to the system to be granted.
BT... | [
0.49746617674827576,
0.0026641052681952715,
0.41601988673210144,
0.1932084709405899,
0.31735220551490784,
-0.25012725591659546,
0.26000624895095825,
-0.21588121354579926,
-0.4926501512527466,
-0.5882534980773926,
-0.3743632733821869,
0.44631874561309814,
-0.21654629707336426,
0.01454000268... | |
I would like to use the COPY function in PostgreSQL to import a CSV file into a PostgreSQL database.
Where it says the filename in the [documentation](http://www.postgresql.org/docs/8.1/static/sql-copy.html), does the CSV file have to be stored in a specific location or can it be stored in any location.
For example,... | [
0.6156173944473267,
0.10194805264472961,
0.09998361021280289,
0.17740049958229065,
0.08562863618135452,
-0.30750027298927307,
-0.27025699615478516,
0.2141280472278595,
-0.2910267114639282,
-0.6491657495498657,
-0.006802648305892944,
0.30853673815727234,
-0.31927207112312317,
0.368805080652... | |
path anchored to root. Windows uses drive letters, which you can specify just as well when you are running on Windows.
If you use Windows notation, take care that you have to *escape backslashes* if you are not using [`standard_conforming_strings = on`](https://www.postgresql.org/docs/current/runtime-config-compatible... | [
0.03157069906592369,
-0.158584326505661,
0.6582565307617188,
0.13943226635456085,
-0.09453567862510681,
-0.21232198178768158,
0.269453763961792,
0.03359603509306908,
-0.4327494204044342,
-0.7266824245452881,
-0.24095474183559418,
0.5648588538169861,
-0.4400552213191986,
0.18053017556667328... | |
the owner of server process (`postgres` by default) has permission to read / write.
For the [`\copy`](https://www.postgresql.org/docs/current/app-psql.html) meta command of the psql client the permissions of current local user apply. | [
-0.07951871305704117,
0.17047710716724396,
0.8408546447753906,
-0.07675664126873016,
0.052069634199142456,
-0.03022247739136219,
0.13810546696186066,
0.21182434260845184,
-0.14102648198604584,
-0.5599234104156494,
-0.654351532459259,
0.30955252051353455,
-0.2773475646972656,
0.397477298974... | |
Is there a secure password hashing library (e.g. phpass) or hashing method that I can easily use in both PHP and Java?
If you want do the easy thing, you can use sha-N with salt. (N being 1, 256 or 512)
---
Jeff Atwood did a nice blog post on that recently, saying that `bcrypt` and `PBKDF2` are the best options.
In ... | [
0.32914963364601135,
0.3144209682941437,
-0.0002959670964628458,
0.277551531791687,
-0.04955599457025528,
-0.41582030057907104,
0.0013472071150317788,
-0.14247477054595947,
-0.18009105324745178,
-0.36372309923171997,
-0.012258716858923435,
0.47602373361587524,
-0.21684664487838745,
-0.1486... | |
I have a photo app where you can add stickers in one section. When you're finished I want to save the image. Here is the code that I have to do that.
```
if(UIGraphicsBeginImageContextWithOptions != NULL)
{
UIGraphicsBeginImageContextWithOptions(self.view.frame.size, YES, 2.5);
} else {
UIGraphicsBeginImageCo... | [
0.31345993280410767,
0.10582777857780457,
0.9204862713813782,
-0.13914677500724792,
-0.10763272643089294,
0.2187206894159317,
0.2870505750179291,
-0.4255375862121582,
-0.36162251234054565,
-0.8272478580474854,
0.06606081128120422,
0.6827609539031982,
0.0020116830710321665,
-0.0559604279696... | |
help would be greatly appreciated. If I haven't explained things clearly, please let me know and I'll do my best to re-explain.
How about something like this
```
CGRect clippedRect = CGRectMake(self.view.frame.origin.x+91, self.view.frame.origin.y, self.view.frame.size.width-91*2, self.view.frame.size.height-220);
CG... | [
0.07941226661205292,
-0.1150398999452591,
0.7430525422096252,
0.02457897737622261,
-0.25432443618774414,
0.23095852136611938,
0.10104376822710037,
-0.3197072148323059,
-0.07810720056295395,
-0.7737802267074585,
-0.16844052076339722,
0.568166196346283,
-0.11939263343811035,
-0.0223656725138... | |
I started to create in Django sample project, first command:
`django-admin.py startproject test`
gives me:
```
- root
- test
- __init__.py
- settings.py
- urls.py
- wsgi.py
- manage.py
```
Now I create first app:
`python manage.py startapp foo`
it created for me folder `root/foo`
so ho... | [
0.22518625855445862,
0.40094828605651855,
0.012273854576051235,
-0.2308199256658554,
-0.157123863697052,
0.027045004069805145,
0.013292878866195679,
-0.15603657066822052,
-0.0700104683637619,
-0.43513068556785583,
0.08417247980833054,
0.538069486618042,
-0.2194991558790207,
-0.179982393980... | |
project
but `manage.py startapp foo` create app under root, not under `root/test` (mysite equivalent)
**[EDIT]**
Two commands:
```
python manage.py startapp app
```
and:
```
django-admin.py startapp app
```
gives me app inside project root, not under `root/name_of_generated_project`
Django 1.4
**[EDIT] 2**
... | [
0.20023393630981445,
0.37648361921310425,
0.3271745443344116,
-0.12435844540596008,
-0.04708224907517433,
-0.07132744044065475,
0.18583601713180542,
-0.35214853286743164,
-0.25340041518211365,
-0.4601817727088928,
-0.0992528423666954,
0.7736265063285828,
-0.3552769422531128,
-0.23629787564... | |
creates a new project with the following minimal set of files:
```
testproject/
βββ __init__.py
βββ manage.py
βββ settings.py
βββ urls.py
```
To create a new app for your first site `mysite1` go into `testproject` directory and run:
> python manage.py startapp mysite1
which results in a new directory `mysite1` for... | [
0.40397489070892334,
0.43816789984703064,
0.12083543092012405,
0.1064966544508934,
-0.07469208538532257,
0.03578942269086838,
0.086733378469944,
-0.3361276686191559,
-0.2202964872121811,
-0.36393001675605774,
-0.2804371118545532,
0.3664640188217163,
-0.037580523639917374,
-0.14686462283134... | |
a project is an organisation of several apps and can power many different sites. That's why you get the [sites framework](https://docs.djangoproject.com/en/dev/ref/contrib/sites/). In practice, one project usually serves one website, but with Django `sites` app with one project you can serve as many websites as you lik... | [
0.8663144707679749,
0.28411200642585754,
-0.21035689115524292,
0.03463178500533104,
-0.21607168018817902,
-0.23124246299266815,
0.1276409775018692,
-0.36898642778396606,
-0.24600182473659515,
-0.6185747981071472,
-0.2724611461162567,
0.33372676372528076,
-0.2516133487224579,
-0.32313367724... | |
[Per the docs](https://docs.djangoproject.com/en/dev/releases/1.4/#updated-default-project-layout-and-manage-py), beginning in 1.4, base
> configuration files (including settings.py, urls.py, and wsgi.py) are
> abstracted into a subdirectory titled the same name as the project. | [
0.2979726195335388,
0.17514856159687042,
0.42175760865211487,
-0.33409953117370605,
0.10052618384361267,
-0.11379332840442657,
-0.16152110695838928,
0.03917505964636803,
-0.40642982721328735,
-0.44356152415275574,
-0.6785019636154175,
0.08880174905061722,
-0.19010882079601288,
-0.216188430... | |
I am running Mathematica 7, and I am trying to run a simple `Do` loop in parallel, using `ParallelDo`. The following standard, sequential code works fine:
```
len = 10;
A = Table[0, {len}];
Do[
A[[i]] = i*10;
, {i, 1, len}]
```
However, if I use `ParallelDo` instead of the standard `Do`, this code gives error me... | [
-0.4660489857196808,
-0.22026604413986206,
0.327627956867218,
0.12326738983392715,
0.016053998842835426,
0.18804024159908295,
0.5441445112228394,
0.06638678163290024,
-0.4805278182029724,
-0.24842111766338348,
-0.05258018150925636,
0.4075351059436798,
-0.5850650072097778,
0.011180609464645... | |
an immediate value.
Set::noval: Symbol A in part assignment does not have an immediate value.
Set::noval: Symbol A in part assignment does not have an immediate value.
Set::noval: Symbol A in part assignment does not have an immediate value.
General::stop: Further output of Set::noval will be suppressed during this cal... | [
-0.6099573969841003,
-0.2692534327507019,
0.48484691977500916,
-0.013398120179772377,
0.0362887904047966,
0.27110210061073303,
0.2541263699531555,
-0.22390083968639374,
-0.5166851282119751,
-0.35926875472068787,
-0.6707806587219238,
0.26729896664619446,
-0.6146361827850342,
0.1861292868852... | |
there anything I can do to run this **Do** loop in parallel?
Thank you!
Andrew DeYoung
Carnegie Mellon University
You need to unbind the click handlers as the focus changes. This should do the trick - <http://jsfiddle.net/WPjgc/> | [
0.494562566280365,
0.10832703113555908,
-0.039900511503219604,
0.5523335337638855,
-0.020448340103030205,
-0.569844126701355,
0.45576024055480957,
0.5313747525215149,
-0.2232377678155899,
-0.734121561050415,
-0.2517779469490051,
0.06267842650413513,
-0.03356828913092613,
0.0415447019040584... | |
Is there any compelling reason, beyond backwards compatibility, for:
```
(null as string) == null; //true
```
Your question is vague and essentially not answerable, so I'm not going to attempt to answer it. If what you really want is an essay on design considerations that went into the `as` operator, see:
<http://bl... | [
0.27259019017219543,
0.1072375699877739,
0.1714034229516983,
-0.18509384989738464,
-0.3329705595970154,
-0.1270671784877777,
0.18014703691005707,
-0.37089744210243225,
-0.21241149306297302,
-0.18764087557792664,
-0.3370091915130615,
0.44927144050598145,
-0.3609318137168884,
-0.066945783793... | |
If I have a method, for instance
```
public INode getNode(final int offset);
```
I assume it doesn't add something to make the method return type generic, for instance:
```
public <T extends INode> T getNode(final int offset);
```
Or did I miss something? I think generic return types are only of value if one of t... | [
0.27305057644844055,
-0.10565053671598434,
0.21217083930969238,
-0.04725243151187897,
-0.028230590745806694,
-0.5618510842323303,
0.41813182830810547,
-0.2817317247390747,
-0.07275941967964172,
-0.3508114516735077,
-0.24253615736961365,
0.4308614134788513,
-0.34720414876937866,
0.341915875... | |
not be type safe, because a method's type parameters are specified by its caller (explicitly or implictly through type inference), and the type parameters aren't available to this method's implementation. For instance, consider the following program:
```
class NodeCollection {
private INode[] nodes = new INode[42]... | [
0.1207643672823906,
-0.3409024477005005,
0.02818155474960804,
-0.0968916043639183,
0.22102084755897522,
-0.43149614334106445,
0.3816201686859131,
-0.4439007341861725,
0.08974461257457733,
-0.29632237553596497,
-0.09456975013017654,
0.6400942206382751,
-0.667070209980011,
-0.020037265494465... | |
ANode implements INode {}
class BNode implements INode {
void foo();
}
public class Test {
public static void main(String[] args) {
NodeCollection nc = new NodeCollection();
nc.setNode(0,new ANode());
BNode b = nc.getNode(0); // throws ClassCastException (sic!)
}
}
```
Best practi... | [
0.17416997253894806,
-0.026364604011178017,
-0.016685348004102707,
-0.3362424671649933,
-0.022058773785829544,
-0.0482584647834301,
0.5172672867774963,
-0.2578367590904236,
-0.04580618813633919,
-0.2963089644908905,
0.02741875685751438,
0.2921915352344513,
-0.6610347628593445,
0.1585054844... | |
type (or a super/subtype)?
There are more cases, for instance:
```
public <T> T getFavorite(Class<T> clazz) {
return clazz.cast(favorites.get(clazz));
}
```
or
```
interface List<E> {
E get(int index);
}
```
or the examples in Colin's answer, where the type variable merely appears *as type parameter* in ... | [
0.10012207925319672,
-0.26844462752342224,
0.5418854355812073,
-0.0358818955719471,
-0.13474048674106598,
-0.1482359617948532,
0.264828622341156,
0.017360864207148552,
-0.2294505387544632,
-0.6764416098594666,
-0.06131110340356827,
0.2876526117324829,
-0.46341684460639954,
0.26133805513381... | |
I need a way to share my app to allow people to download it for free with a coupon code or promo code or checkout code. I would like to post the code to a board, and invalidate it after some time. My app uses licensing and in-app billing, so mailing the APK may not be appropriate. The last question I saw regarding this... | [
0.6002027988433838,
0.2476203590631485,
0.4692328870296478,
0.2560199201107025,
0.18448126316070557,
-0.2882201373577118,
0.20558838546276093,
-0.07414563000202179,
0.0213306937366724,
-0.37923353910446167,
0.03800737485289574,
0.3485443890094757,
0.02871391922235489,
-0.15285828709602356,... | |
a promotion through your Google play store developer console:
<https://support.google.com/googleplay/android-developer/answer/6321495>
Or add support for in app purchase codes through in app promotions:
<https://developer.android.com/google/play/billing/billing_promotions.html>
Note however that there are limits to... | [
0.3264215588569641,
0.04646827653050423,
0.4044390618801117,
0.35805389285087585,
-0.014604217372834682,
-0.11949139833450317,
0.3466554284095764,
-0.29717186093330383,
-0.057164017111063004,
-0.36799320578575134,
-0.13043466210365295,
0.787591814994812,
-0.07725995033979416,
-0.1199009418... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.