Posts

casting - Java's +=, -=, *=, /= compound assignment operators -

until today, thought example: i += j; is shortcut for: i = + j; but if try this: int = 5; long j = 8; then i = + j; not compile i += j; compile fine. does mean in fact i += j; shortcut i = (type of i) (i + j) ? as these questions, jls holds answer. in case §15.26.2 compound assignment operators . extract: a compound assignment expression of form e1 op= e2 equivalent e1 = (t)((e1) op (e2)) , t type of e1 , except e1 evaluated once. an example cited §15.26.2 [...] following code correct: short x = 3; x += 4.6; and results in x having value 7 because equivalent to: short x = 3; x = (short)(x + 4.6); in other words, assumption correct.

java - InterruptedException : what causes it? -

there interesting questions , answers regarding java's interruptedexception , example the cause of interruptedexception , handling interruptedexception in java . however, none of them tells me possible sources of interruptedexception. what os signals sigterm, sigquit, sigint? pressing ctrl-c on command line produce interruptedexception? else? none of things list produce interruptedexception . the thing can interrupt thread call thread#interrupt() . jls relatively clear on matter, section 17.2.3 : 17.2.3 interruptions interruption actions occur upon invocation of thread.interrupt , methods defined invoke in turn, such threadgroup.interrupt . see the official tutorial on interrupts more info well. specifically: a thread sends interrupt invoking interrupt on thread object thread interrupted. interrupt mechanism work correctly, interrupted thread must support own interruption. ... the interrupt mechanism implemented using internal f...

python - Does the MySQLdb module support prepared statements? -

this question has answer here: does python support mysql prepared statements? 7 answers does mysqldb support server-side prepared statements ? can't figure out manual. check mysqldb package comments : "parameterization" done in mysqldb escaping strings , blindly interpolating them query, instead of using mysql_stmt api. result unicode strings have go through 2 intermediate representations (encoded string, escaped encoded string) before they're received database. so answer is: no, doesn't.

php - Show e-mails from Gmail inbox in SaaS website -

is there way show e-mails gmail inbox in saas website in php? update : op edited question asking php client library. the php gmail google client library available still in beta. code snippets on how use google api in github repository gmail api example not available. gmail api definition file place started. you can use google gmail api . has client libraries in .net , java , python . cite docs: your app can use api add gmail features like: read messages gmail send email messages modify labels applied messages , threads search specific messages , threads an example on how use api per quick start guide: #!/usr/bin/python import httplib2 apiclient.discovery import build oauth2client.client import flow_from_clientsecrets oauth2client.file import storage oauth2client.tools import run # path client_secret.json file downloaded developer console client_secret_file = 'client_secret.json' # check https://developers.google.com/gma...

nsmutablearray - NSArraym was mutated while being enumerated, sqlite3 while loop? -

i error: nsarraym mutated while being enumerated , i've tried find on stackoverflow. keep in mind i'm learning create game :) i'm using sprite kit , uses dispatch_async in didmovetoview load game. dispatch_async(dispatch_get_global_queue( dispatch_queue_priority_default, 0), ^(void){ // loading stuff, causing error: [self buildmap]; dispatch_async(dispatch_get_main_queue(), ^(void){ // done loading }); }); here buildmap causes crash. -(void)buildmap { int intx = 0; int inty = 0; sqlite3_stmt *statement; if (sqlite3_open([_databasepath utf8string], &blockminerdb) == sqlite_ok) { nsstring *sql = [nsstring stringwithformat:@"select blocktype, ladder, blockreachable, walkable, zpos, texture, id, bitmask map order id desc"]; const char *qstmt = [sql utf8string]; if (sqlite3_prepare_v2(blockminerdb, qstmt, -1, &statement, null) == sqlite_ok) { while (sqlite3_step(s...

github - Fix parentless commits after git svn clone -

i have converted subversion repository git 1 with: git svn clone --no-metadata --stdlayout --prefix svn/ it worked well, have holes in repository, think means git svn not able find parents: a----b---c---d (2.0) e --- f --- g (2.1) here, first commit of 2.1 branch has no parent, should have 2.0 branch parent. i tried rebasing, failed conflicts, there way of fixing these links ? i think here not working because e gets commits prior it. content seems correct, history not. yes, 2.1 branch has no parent because git svn not find parent. this caused svn branch not created using svn copy , locally copying files, svn add ing , committing them. in case, svn commit not include information copied from, git svn cannot know use ancestor. bad practice (in svn), it's late now. how fix this: as far can see, git rebase should indeed work in case. like: git checkout 2.1 git rebase 2.0 i tested this: created simple svn repo created branch described above, c...

mysql - How to index a table fields -

i developing large table messages inbox query like explain select * messages (receptor='x1@yahoo.com' , sender='x2@yahoo.com') or (sender='x1@yahoo.com' , receptor='x2@yahoo.com') order id desc limit 10; is slow , cause hang server please, let me know how index table or change query avoid problem thanks table structure mysql> describe messages; +----------+--------------+------+-----+---------+----------------+ | field | type | null | key | default | | +----------+--------------+------+-----+---------+----------------+ | id | bigint(20) | no | pri | null | auto_increment | | sender | varchar(65) | no | mul | null | | | is_sdel | tinyint(1) | no | | null | | | receptor | varchar(65) | no | mul | null | | | is_rdel | tinyint(1) | no | | null | | | dtime | varchar(100) | no | mul | ...