Posts

Showing posts from July, 2015

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 | ...

c# - Handle the close event via task bar -

Image
i developing wpf application. close applications via task bar. when put mouse on task bar, show preview of application. press center mouse button on preview, application close. this scenario not working in wpf applications. send application background (gui exit, application still run on background). option have handle onclosing() event. there other method? i had came across same issue when tried same thing(closing of application) when on window not mainwindow(or startup uri) object.so advice please handle on closing event of secondary window(other mainwindow) , tried shutdown or exit application below code private void datawindow_closing(object sender, canceleventargs e) { application.current.shutdown(); // environment.exit(); } wpf automatically shut downs application when on mainwindow , tried exit application.

iphone - Intigration With Facebook in iOS using facebook sdk -

i trying post image in imageview(display_image) on user's profile using facebook sdk.code below. fblinkshareparams *params = [[fblinkshareparams alloc] init]; params.link = [nsurl urlwithstring:@"https://developers.facebook.com/docs/ios/share/"]; // if facebook app installed , can present share dialog if ([fbdialogs canpresentsharedialogwithparams:params]) { // present share dialog [fbdialogs presentsharedialogwithlink:params.link handler:^(fbappcall *call, nsdictionary *results, nserror *error) { if(error) { // error occurred, need handle error // see: https://developers.facebook.com/docs/ios/errors nslog(@"error publishing story: %@", error.description); } else { // su...

javascript - JS overlay without direct access to html -

i attempting add javascript overlay onload, without direct access html. i'm able upload .js , .css files. how go doing this, i've searched over, no expert @ i'm seeking simple solution allow me maybe call html , insert overlay, using javascript only . i unsure of coding of .js file contain of overlay code , html code combined. i've been looking @ document.getelementbyid , document.write this, correct in trying way? any suggestions? there no way can add overlay existing html file without importing new js , css files in html file. how ever, if there other js files used or imported html file, edit , add code in js file. it'll run since js file imported in html.

css - How to style an asp control without using a separate CSSClass? -

i'm beginner in css , need set style asp:labels got in page. can html label control: label { color:red; } <label id="mylabel" runat="server">my text</label> but doesn't work asp:label control. i find online can adding cssclass attribute each asp:label control , set attributes of cssclass @ top of page. .myclass { color:red; } <asp:label id="mylabel" runat="server" cssclass="myclass">test</asp:label> but way i'll have go through asp:label controls , give them cssclass="myclass" . there way style asp:labels in same way styled html labels above? the asp label renders span tag. try give style span tag. label, span { color:red; } see here more information

xml - Styling PHP very proving difficult -

i have form user type in there reference number check status of in enquiry: example: user navigate webpage: http://www.cdreporting.co.uk/ajax/search2.html they type in reference: " 1 " or "2" , "3" etc...whatever number allocated displays brief record. but i'm unable format data displayed. wish have reference number diferrent colour, wish create line breaks, underline emails addresses. i'm unsure how current .php code how edit each field such email? can change font etc..? "reference" field stated in php code: <?php $q=$_get["q"]; $xmldoc = new domdocument(); $xmldoc->load("cd_catalog.xml"); $x=$xmldoc->getelementsbytagname('reference'); ($i=0; $i<=$x->length-1; $i++) { //process element nodes if ($x->item($i)->nodetype==1) { if ($x->item($i)->childnodes->item(0)->nodevalue == $q) { $y=($x->item($i)->parentnode); } } } $cd=($y-...

c# - StyleCop+ SignalR naming -

in our application using stylecop+ , signalr. did name our entities signalruser , signalrconnection , stylecop+ not this. suppress message these entities, our variables named signalruser or else. i added signalr list of abbreviations , recognized words, stylecop+ still says sp0100 : stylecopplus.stylecopplus : local variable name signalruser doesn't conform specified style: samplename. how can tell stylecop+ ignore "misspelling"? if add signalr compound words (or abbreviations) list should allow signalruser , signalrconnection or mysignalrwhatever . however, singalruser not still allowed, suppose, since it's lowercase. alternatively, add r list. in case, name myrfeature , signalr or rtype should allowed well.

c# - WPF Dynamic Data Binding in Image source -

what m doing wrong? xaml: <grid> <grid.rowdefinitions> <rowdefinition height="26*"/> <rowdefinition height="63*"/> <rowdefinition height="67*"/> </grid.rowdefinitions> <textblock name ="title" text="" textwrapping="nowrap" grid.row="0" margin="25,10,25,0"/> <image source="{binding path=bindimgurl}" horizontalalignment="left" height="164" grid.row="1" verticalalignment="top" width="306" margin="152,0,0,0"/> </grid> c# code: private string id; private string imgurl; public videodetails(string id) { initializecomponent(); this.id = id; detailsgenerator dg = new detailsgenerator(id); this.imgurl = "dynamic source"; this.datacontext = bindimgurl; messagebox.show(bindimgu...

hadoop - How to pass string as value in mapper? -

i trying pass string value in mapper, getting error not writable. how resolve? public void map(longwritable key, text value, context context) throws ioexception, interruptedexception { string tempstring = value.tostring(); string[] singlerecord = tempstring.split("\t"); //using integer.parseint calculate profit int amount = integer.parseint(singlerecord[7]); int asset = integer.parseint(singlerecord[8]); int salesprice = integer.parseint(singlerecord[9]); int profit = amount*(salesprice-asset); string valueprofit = string.valueof(profit); string valueone = string.valueof(one); custid.set(singlerecord[2]); data.set(valueone + valueprofit); context.write(custid, data); } yahoo's tutorial says : objects can marshaled or files , across network must obey particular interface, called writable, allows hadoop read , write data in serialized form transmission. from cloudera site : the key , value classes must...

cmd - Setting variable based on IF - Batch Scripting -

i have script i'm working on i'm pretty stuck on... may syntax error i'm not sure. the script checks how old each file is hardcoded in script (this script subscript being generated another). checkage2.bat script outputs %age% variable if file on 20 minutes old age=1 otherwise age=0 set filepath="c:\pathtofile\filename1.slf" call c:\pathtoscript\checkage2.bat %filepath% if %age% equ 1 output=%output% %filepath% set filepath="c:\pathtofile\filename2.slf" call c:\pathtoscript\checkage2.bat %filepath% if %age% equ 1 output=%output% %filepath% set filepath="c:\pathtofile\filename3.slf" call c:\pathtoscript\checkage2.bat %filepath% if %age% equ 1 output=%output% %filepath% if (%output%) == () goto ok echo critical: %output% pause :ok echo ok: files within 20 minute time range pause i'm trying output full list of files on 20 minutes old can't seem right! appreciated, all! if %age% equ 1 output=%output% %fil...

javascript - trouble with ng-modal while calling it in controller -

here steps took: 1) downloaded script file from: https://github.com/doodeec/dcom-angular-dialog 2) included in webpage , in application: var summariesapp = angular.module('summariesapp', ['ui.bootstrap', 'ngckeditor', 'dcmodal']); 3) tried use in controller: summariesapp.controller("singlesnpcontroller", function ($scope, $http) { $scope.stoplightmodal = dialogservice.create('../templates/test.html'); i error dialogservice resource not found. know question little simplistic have been stuck on while now. in advance. try injecting dialogservice controller this: summariesapp.controller("singlesnpcontroller", function ($scope, $http, dialogservice) { $scope.stoplightmodal = dialogservice.create('../templates/test.html'); take @ example here , see how injecting dialogservice controller.

c# - How do you change the endpoint of a service reference without regenerating the client code? -

we have 3rd party soap api we're integrating with. we've done development against development version of api. want switch on production version. how without regenerating entire service reference against new endpoint url? in perfect world, able change path in config file point new endpoint doesn't seem work due namespaces issues. when changing endpoint address in config (or programmatically), error occurs @ runtime: system.web.services.protocols.soapexception: server did not recognize value of http header soapaction: http://foo.bar.com/devwebservice/authenticateuser. @ system.web.services.protocols.soap11serverprotocolhelper.routerequest() @ system.web.services.protocols.soapserverprotocol.routerequest(soapservermessage message) @ system.web.services.protocols.soapserverprotocol.initialize() @ system.web.services.protocols.serverprotocol.setcontext(type type, httpcontext context, httprequest request, httpresponse response) @ system.web.services.protocols.ser...

twilio - How can I use the C# TwilioRestClient and nextpageuri for paging -

i'm using twiliorestclient in following manner (this in loop obviously): var currentpage = 0; private twiliorestclient mtwilioclient; var listrequest = new messagelistrequest() { = phonenumber, count = mmessagesperpage, datesent = datetime.today.subtract(timespan.fromdays(mdaystosearch)), datesentcomparison = comparisontype.greaterthanorequalto, pagenumber = currentpage++, }; var result = mtwilioclient.listmessages(listrequest); this working fine me, i'm reading section paging through api resources "the page parameter has been deprecated , may removed in future version of api. page parameter slower nextpageuri, , if new resources created while paging page parameter, consecutive pages may contain duplicate data." and i'd start utilizing nextpageuri in case page depreciated in near future. my question how can utilize nextp...

c# - Merge Brush and BitmapImage Together -

Image
i'm trying take brush applied button's background , render bitmapimage ontop of it, merging images , setting background. rendertargetbitmap source = new rendertargetbitmap(convert.toint32(button.rendersize.width), convert.toint32(button.rendersize.height), 96, 96, pixelformats.pbgra32); drawingvisual visual = new drawingvisual(); using (drawingcontext drawingcontext = visual.renderopen()) { drawingcontext.drawrectangle(button.background, null, new rect(new point(0, 0), new point(button.rendersize.width, button.rendersize.height))); drawingcontext.close(); source.render(visual); } visual = new drawingvisual(); using (drawingcontext context = visual.renderopen()) { context.drawimage(source, new rect()); context.drawimage(image, new rect()); context.close(); } source.render(visual); however, cannot set rendertargetbitmap background property of button. i'm not sure if best way of doing such thing. if can convert rendertargetbitmap brush, ef...

java - BGS5T RS232 communication with 1-wire sensor -

i have gemalto bgs5t java module , 1-wire temperature sensor. have java midlet uses rs232 port communicate temperature sensor. problem that, no response sensor no matter send. sensor has right voltage on it, connection should fine. tried testing program connected rs232 port computer , watched terminal(termite) if sent data correct , looks should. test connected temperature sensor directly computer , sent data terminal , worked should. got responses on random inputs 9999. checked parameters connection inside terminal , copied them java midlet, no success. there 1 time got responses, when tryed next day continue work had no success. parameters inside terminal: baud rate:9600 data bits : 8 stop bits: 1 parity: none flow control:rts/cts here java code: string strcom = "comm:com0;blocking=on;baudrate=9600"; commconn = (commconnection)connector.open(strcom); system.out.println("commconnection(" + strcom + ") opened"); system.out.println("real baud ...

python - How do I disable Cython? -

i'm trying install lxml in python, seems cython screwing installation (according install instructions). i'm on centos operating system, , tried yum remove cython, apparently can't find package, though it's there when type whereis. is there way temporarily disable cython? can't find information anywhere. edit: tried following: [root@tawfik devin]# rpm -qa |grep cython [root@tawfik devin]# whereis cython cython: /usr/local/bin/cython [root@tawfik devin]# rpm -e /usr/local/bin/cython error: package /usr/local/bin/cython not installed use following command find package rpm -qa |grep cython then if found copy past package name in command remove it. rpm -e <package_name>

objective c - How do I play YouTube videos with iOS-GTLYouTube library? -

i'm trying play youtube videos using ios-gtlyoutube library. finished query code videos , got few gtlyoutubevideo objects. after got them, what? how play it? i've searched web found nothing. you can't play videos gtlyoutube library, can use search api video information. after retrieving video id of video want play, can load id iframe in uiwebview. nsstring *videoid = @"hcduubr70i8"; // video id returned api query // adjust width , height liking, pass in view's frame width , height nsstring *str = [nsstring stringwithformat:@"<html><body style='margin:0px;padding:0px;'><script type='text/javascript' src='http://www.youtube.com/iframe_api'></script><script type='text/javascript'>function onyoutubeiframeapiready(){ytplayer=new yt.player('playerid',{events:{onready:onplayerready}})}function onplayerready(a){a.target.playvideo();}</script><iframe id='playerid...

javascript - select correct redis database on reconnect -

i have node application uses node_redis. upon application start, redis client created, correct database selected once, , client used every request: this.redis = redis.createclient(port, host); this.redis.on('error', function(err) { console.log('redis error: ' + err); }); this.redis.send_command('select', [database]); now problem is: when connection goes away (for example when redis manually restarted), node_redis automatically re-connects, it's on wrong database, since select was not run after re-connecting. cannot find how detect this, since error event doesn't fire in case. should do?

javascript - Necessity of java web-frameworks when using AngularJS -

we developing enterprise web application (java backend + html/js frontend). application shall provide cloud-based data analysis functionality variety of users. now, have decided use angularjs creating web-frontend. communication backend realized rest webservices (implemented in java using jersey, , jetty webserver). some time ago, have developed simple java web apps using apache wicket examplary reasons. since new angularjs, wondering if there reason why still necessary use java web-framework (such wicket, gwt, etc.) additionally angular js? other way around: since use angular developing web-frontend, not need web-framework on java side more, right? i quite new java web applications, appreciated :-) regards angularjs has $http service should able handle get/post requests need make java backend. docs here: https://docs.angularjs.org/api/ng/service/$http as long return data formatted json or whichever format want, javascript should read fine. angularjs should fine p...

flash - Need some Help In wowza media product with Live Streaming -

i've issue planning on how wowza working case.i'm trying video chat working using wowza , aws ec2. i've 2 websites, 1 users share computer's camera , microphone , initiate broadcast second website users. second website has flash player shows live feed obtained first website. meaning whatever user broadcasting using camera , mic. i've use wowza first second websites flash player feed, coming live first website. goal view live feed of user mobile website version. advance thank support. there complete example can start on github. contains wowza configuration application.xml configured mobile streaming well. demo product called wrench, can leave out if don't want user authentication in system.

ios - NSMutableArray data went nil when UITableView loads -

Image
i have problem populating data nsmutablearray uitableview. in viewdidload , did network call gets data parse , return nsmutablearray called ' journalentries ' copied data in array nsmutablearray variable called ' allentries '. set breakpoint here , verified _allentries has 4 objects (not nil). however, when comes numberofrowsinsection method, _allentries.count returns 4 set breakpoint here , objects in _allentries becomes nil . - (void)viewdidload { [super viewdidload]; _allentries = [[nsmutablearray alloc] init]; [mmdatabasehelper getalljournalentries:^(nsmutablearray *journalentries) { (mmjournalentry *entry in journalentries) [_allentries addobject:entry]; // set breakpoint here , verified _allentries has 4 objects [self.tableview reloaddata]; }]; this method below returns 4 objects in allentries array nil. weren't nil in viewdidload. - (nsinteger)tableview:(uitableview *)tableview numberofr...

php - How to convert CURLOPT_FILE for Googel AppEngine? -

since on google appengine curl , file writing not allowed. me out convert following curl request can run on it? $ch = curl_init("http://example.com/external.php"); $fp = fopen("internal.php", "w"); curl_setopt($ch, curlopt_file, $fp); curl_setopt($ch, curlopt_header, 0); curl_exec($ch); curl_close($ch); fclose($fp); header("location:internal.php"); you need write file google cloud storage. like $in = "http://example.com/external.php"; $out = "gs://bucket/internal.php"; file_put_contents($out, file_get_contents($in));

Why does rails scaffold generator is simply ignoring my config/iniatilizers/inflections.rb? -

i'm using rails 3.2 ruby 2.1 i put code config/initializers/inflections.rb : activesupport::inflector.inflections |inflect| inflect.irregular 'pub_type_contributeur', 'pub_types_contributeurs' inflect.irregular 'pubtypecontributeur', 'pubtypescontributeurs' end when test rails console works : rails console [deprecated] i18n.enforce_available_locales default true in future. if want skip validation of locale can set i18n.enforce_available_locales = false avoid message. loading development environment (rails 3.2.16) 2.1.0 :001 > "attendance".pluralize => "attendances" 2.1.0 :002 > "pub_type_contributeur".pluralize => "pub_types_contributeurs" 2.1.0 :003 > exit but when use standard generator, ignore inflection : rails generate scaffold pub_type_contribueur nom:text -p [deprecated] i18n.enforce_available_locales default true in future. if want skip validation of locale...

c++ - glsl - get pixel color [pixel shader] -

is there way drawed pixel color (from backbuffer, not current drawing pixel)? for example: i'm drawing rectangle texture , drawing circle (in blue color) on rectangle. if use pixel shader on circle, there way current pixel color backbuffer (pixel rectangle)? i think want color of pixel frame buffer use glreadpixels() return pixel data frame buffer. https://www.opengl.org/sdk/docs/man2/xhtml/glreadpixels.xml

oracle11g - oracle 11g installation issue -

i trying install oracle 11g enterprise edition. while installing able do open installation wizard. hit next , goto installation option i selected "create , configure database" hit next when select "desktop" , hit next installation wizard closing itself. i tried starting setup wizard administrator didn't work. thank you! last few lines in log. severe: have not provided email address. do wish remain uninformed of critical security issues in configuration? info: completed validating state info: verifying route success info: view named [installoptionsui] info: installoptionsui entering constructor info: installoptionsui exiting constructor info: view [installoptionsui] oracle.install.ivw.db.view.installoptionsui@5c17d6c1 info: initializing view @ state info: completed initializing view @ state info: displaying view @ state info: completed displaying view @ state info: loading view @ state info: completed loading view @ st...

python - How to write a common API client for Tornado and non-Tornado services -

i have web-service exposes api. want use api in 2 applications, 1 command-line tool, , web-server itself. for web-server, using python tornado, able use aynchttpclient , gen.coroutine , etc. cli, can not use tornado since needs ioloop running async work. i looking create kind of library talks api, , re-use library in cli web-service. means should able write (possibly tornado gen) code on top of functions make async. why not use ioloop in cli tool? @gen.coroutine def main(): client = asynchttpclient() response = yield client.fetch('http://www.google.com') if __name__ == '__main__': ioloop.instance().run_sync(main) there's synchronous tornado.httpclient.httpclient uses same request , response objects asynchttpclient . if want http-client-agnostic you'll need follow example of oauthlib. provide base client speaks in terms of http headers , response bodies, , separately provide bindings client various implementations requests-oau...

jquery - Bootstrap popover class not working properly on javascript generated content -

i want create select have fixed height (done) , show popover when hover on options. first created select using plugin : http://silviomoreto.github.io/bootstrap-select/ that's working fine, , here's code far : <select id="selectuse" class="form-control selectpicker" name="selectuse" style="height: auto;"> <optgroup label="optgroup one"> <option value="value">option</option> <option value="value">option</option> <option value="value">option</option> <option value="value">option</option> <option value="value">option</option> <option value="value">option</option> <option value="value">option</option> <option value="value">opt...

javascript - Closure Compiler Serverside Source Map Parsing -

i looking either existing library or guidance on building server side source map parser. can pass errors generated client server since code closure compiled not useful. what able error , using source map file parse error more useful. did preliminary search , not find decent library accomplishing task. update #1: aware there node.js library accomplishing this. looking in particular c# library if exists before rewrite javascript.

jquery - Ajax not working in IE11 error code 0x2f78 -

here ajax setup: $.support.cors = true; $.ajax({ beforesend: function () { }, type: "post", url: "test.cgx", data: hex_str, datatype: "xml", processdata: false, contenttype: "text/xml; charset=utf-8", success: function (msg) { }, error: function (msg) { } }); if data - hexstr smaller 4 chars (for example hex_str = "3a") got following error (after 1 minute of request pending): xmlhttprequest: network error 0x2f78, not complete operation due error 00002f78. this happens in ie, ff , chrome can post data size. data send it's not in xml format it's hex data (i need co...

algorithm - worst case running time of segment tree -

how range sum in segment tree o(logn) worst case?? shouldn't o(n)? if during range sum operation,we traverse down both left , right nodes per algorithm? lets call active node node stores interval neither included in interval nor covered interval. easy spot there @ 2 active nodes on each level traverse. if node not active not need recurse in - if interval covered add value written in node, if interval not intersect 1 interested in skip it. number of operations algorithm perform in order of levels of tree or o(log(n)) .

gcc - Cause link to fail if certain symbol is referenced -

is there way make linking fail if code references symbol library? i seem remember dimly there such directive in linker script language, apparently not gnu ld (maybe it's false memory). i need prevent part of third-party library accidentally linking application. if link, adds static initializers wreak havoc @ runtime (it's embedded project environment bit quirky). cannot change third-party library in question. detect error @ build time. guess can write post-build script parses map file , issues error if finds offending parts, mentioned above [false?] memory prompts me ascertain can't done using linker alone. i'm using gnu gcc toolchain. okay, stepping out lunch helped me find (pretty obvious) solution: /* stubs.c */ void error_do_not_reference_this_symbol( void ); void offending3rdpartyfunction( void ) { error_do_not_reference_this_symbol(); } here, symbol error_do_not_reference_this_symbol never defined. additional source file added project...

c++ - fatal error U1073: don't know how to make 'c:\winddk\7600.16385.0\lib\wxp\i386\msvcrt_winxp.obj' -

i try compile driver winxp x86 release, using these commands: c:\winddk\7600.16385.0\bin\setenv.bat c:\winddk\7600.16385.0\ fre x86 wxp no_oacr cd c:\src build it fails because of these u1073 errors msvcrt_winxp.obj. checked , there no msvcrt_winxp.obj file anywhere in c:\winddk or subdirectories. it looks me problem not in actual code, maybe haven't set ddk right before compiling. why these u1073 errors? i found similar question - driver build failing amd64 via winddk , there op did has not included relevant information such build output, , question unanswered. found thread - http://www.techtalkz.com/microsoft-device-drivers/295015-wdk-linker-error-u1073.html , there no answer there, well. my build output: build: compile , link x86 build: loading c:\winddk\7600.16385.0\build.dat... build: computing include file dependencies: build: start time: thu nov 13 12:04:25 2014 build: examining c:\src directory tree files compile. c:\src c:\src\common c:\src\d...

angularjs - Validate that all of the checkboxes are checked in ionic -

i have form list of checkboxes, shown here: $scope.devicelist = [ { text: "dev 0", checked: false }, { text: "dev 1", checked: false }, { text: "dev 2", checked: false }, { text: "dev 3", checked: false }, { text: "dev 4", checked: false } ]; <form> <ion-checkbox class="checkbox-balanced" ng-repeat="item in devicelist" ng-model="item.checked" ng-required="true"> {{ item.text }} </ion-checkbox> </form> of course have more elements. case show relavent code. now, have validation form cannot sent until checkboxes checked. suggestions of elegant solution that? thanks in advance maybe function following trick: $scope.validate = function(){ var numchecked = $filter($scope.devicelist, function(device) { return device.checked }).length; retu...

php - Foreign Key in web forms -

i creating web forms users enter data database. thinking of way enter/choose foreign keys. example have table has 1:n relation table b. want create form table b. user can enter normal information in input boxes. enter foreign key thought dropdown list, entries of table displayed. unfortuanately, dropdown list of html can display 1 coulmn. cannot display id , name of picked entry. does know smart way display name of entry pass id? now doing this. here id of picked entry displayed user. want display name, pass id. <select name="input_modul"> <?php $sql = "select id, name tablea;"; if($result = $con->query($sql)) { $rows = $result->num_rows; while($row = $result->fetch_array()) { echo "<option>". $row['id'] . "</option>"; } } ?> </select> quite pass $row['id'] value -attriubute of option -elemen...

python 3.x - EnsureDispatch error when using cx_freeze for making exe -

i working python 3.4 on windows 7. setup file follows: from cx_freeze import setup, executable, sys exe=executable( script="xyz.py", base="win32gui", ) includefiles=[] includes=[] excludes=[] packages=[] setup( version = "1.0", description = "xyz", author = "max", name = "at", options = {'build_exe': {'excludes':excludes,'packages':packages,'include_files':includefiles}}, executables = [exe] ) distutils.core import setup import py2exe, sys, os, difflib sys.argv.append('py2exe') setup( options = {'py2exe': {'bundle_files': 1}}, console = [{'script': "xyz.py"}], zipfile = none, ) when obtained exe run, error pops saying: ... file "c:\python34\lib\site-packages\win32com\client\clsidtoclass.py", line 46, in getclass return mapclsidtoclass[clsid] keyerror: '{00020970-0000-0000-c000-000000000046}'...

c# - Using the Android gyroscope in Unity3d, how can I set the initial camera rotation to the initial mobile device rotation? -

i want use android gyroscope perform head tracking on standard first person controller of unity3d. created short script rotates both parent node , camera child node of first person controller. script attached camera. this script works well, rotates first-person view based on movements of mobile device. however, works when hold phone in forward looking position when start app. if phone lies flat on table , start app, both camera , gyroscope rotations off. i script respect initial device rotation. when start app , device has screen up, camera should up. how can modify script set camera rotation initial mobile device rotation? using unityengine; using system.collections; // activate head tracking using gyroscope public class headtracking : monobehaviour { public gameobject player; // first person controller parent node public gameobject head; // first person controller camera // use initialization void start () { // activate gyroscope input.gyro...

battery - Charging an Android Device -

is there possibility change battery level programmatically, mean charge programatically myself or system call(android sees power device connected , charges)? i have following use case: there 1 output(micro usb) connected usb hub possibility connect many usb devices, 1 of devices should power device. i can see programmatically devices connected phone, cant realize @ moment how can programmatically android: please charge usb device. is system call , require source code of android os modified in right way? have downloaded source code https://source.android.com/ , run make on these code, can't eclipse - exceptions raised due lack of resources :-) is possible remove android os device , modified version own on it? thank advices usb devices draw power usb host. when connect peripherals phone acts usb host. in case peripheral device draws power phone , not other way. i don't think usb host can draw power device.

java - Getting error while accessing webservices through apache axis2 -

the following error, can me in fixing error. package missing error? org.apache.jasper.jasperexception: unable compile class jsp: error occurred @ line: 47 in jsp file: /axis2-web/include/httpbase.jsp type java.lang.charsequence cannot resolved. indirectly referenced required .class files 44: public string calculatehttpbase(httpservletrequest arequest) { 45: stringbuffer stringbuffer = new stringbuffer(); 46: if (frontendhosturl != null) { 47: stringbuffer.append(frontendhosturl); 48: } else { 49: string scheme = arequest.getscheme(); 50: stringbuffer.append(scheme); any help?

angularjs - Angular best practices for layouts -

i have admin dashboard application called dashboard.html initiated own angular module. application has consistent layout n header bar @ top, left bar navigation etc. when route changes content container gets updated , rest of layout stays unaffected. my problem login page, different layout, without header bars , navigation. currently i'm solving issue creating login.html file own module, when user login, redirect them dashboard.html app. is general used approach or there clean way of doing in single application, changing routes , not redirecting different apps? you can use angular uirouter doing this. have @ fiddle, http://jsfiddle.net/thardy/ed3mu/ . <div ui-view="main"></div> angular.module('myapp', ['ui.state']) .config(['$stateprovider', '$routeprovider', function ($stateprovider, $routeprovider) { $stateprovider .state('test', { abstract: true, ...

php - unserialize() Error at offset - Caused by Single Quote -

i getting error when trying unserialize data. following error occurs: unserialize(): error @ offset 46 of 151 bytes here serialized data: s:151:"a:1:{i:0;a:4:{s:4:"name";s:15:"chloe o'gorman";s:6:"gender";s:6:"female";s:3:"age";s:3:"3_6";s:7:"present";s:34:"something frozen or jigsaw ";}}"; the error being caused single quote in data. how can alleviate problem when site , database working live? unfortunately cannot rewrite code responsible serializing , inserting data database. highly there multiple occurrences of problem across database. is there function can use escape data? after doing further research have found work around solution. according this blog post : "it turns out if there's ", ', :, or ; in of array values serialization gets corrupted." if working on site hadn't yet been put live, prevention method have been base64_enco...

greenfoot - Java list! How do I get an object to determine if there is another object -

// test rock list rocks = getworld().getobjectsat(x , y, rock.class); /* list class (java.util.list) in java api * , determine method use 'rocks' list * determine if there rock. put correct test * in 'if()' statement below. */ if () { return true; } return false; have fill in "if()" statement above return true; confused how if statement lst. please help! , send knowledge of how do! thank guys! if understand correctly, want check if concrete object rock on list 'rocks'. have use method "contains". public boolean list.contains(object o) checks if object 'o' exists on list. rock myrock = //whatever sentence use create rock you're checking if (rocks.contains(myrock) { return true; } return false;

Regex Mobile Number Validation Code Doesn't Work In PHP -

function pricerrtheme_isvalidnumber($number) { return eregi("^(?:01)?01[0-9]\d{8}$", $number); } hello, add validation code validates mobile numbers following area codes 0100,0101,0106,0109 then 7 digits after looks this 01005555555 or 01015555555 my code doesn't work, gives me validation error doesn't matter if entered right or wrong values this might further. $phone = "01005555555"; if(preg_match("/^010[0|1|6|9][0-9]{7}$/", $phone)) { echo "valid"; } else { echo "invalid"; }

java - crystal report working in viewer not working in application for date ranges -

i have crystal report working in crystal reports preview page. same not working on application. we passing filter(where) parameters java application crystal reports, looks not working when added date range in filter, in date (2014,08,01) date (2014,11,13) report not working. the same filters applied in crystal report test working fine. compared both sql queries generated looks same. report empty when runned using application. any suggestions debugging issue? this issue filter string passing java crystal reports, string length seems have restrictions. i reduced filter string been passing cr made issue fixed.

just like scraping data off the web , either from html or json , can the same be done in pdfs using R? -

Image
i import tables , table-like data in research articles(pdf files) r. example : http://www.bioconductor.org/packages/release/bioc/vignettes/deseq/inst/doc/deseq.pdf thats pdf taken example here. simple tables start with. page 6 of pdf file have taken screenshot understand scenario. how extract table ?