Posts

Showing posts from March, 2013

Python MFC: Updating static text in response to events -

i have following python mfc code. have listbox fill values, , when user clicks on values want static text control updated current selection. there 2 problems code. first value in text control updated first time click on listbox. second value lags behind real selected value in listbox, presumably because control handles click after handler code gets called. i'd appreciate either of these issues. an odd thing, (perhaps clue) when mouse-down on 'ok' button move away mouse-up static text updated expect. i've tried redrawwindow(), updatewindow(), showwindow() on both control , dialog, , nothing seems make difference. import win32con pywin.mfc import dialog idc_list = 9000 idc_text = 9001 class chooserdialog(dialog.dialog): def __init__(self): dialogtemplate = [ ["test", (0, 0, 254, 199), win32con.ws_caption | win32con.ds_modalframe, none, (8, "ms sansserif")], [128, "ok", win32con.idok, (197,178,50,14), win3

Convert a MongoDB with two collections in a neo4j graph -

i finished create mongo database. made on 2 collections: 1. team 2. coach i give example of documents contained in these collections: here team document: { "_id" : "mil.74", "official_name" : "associazione calcio milan s.p.a", "common_name" : "milan", "country" : "italy", "started_by" : { "day" : 16, "month" : 12, "year" : 1899 }, "stadium" : { "name" : "giuseppe meazza", "capacity" : 81277 }, "palmarès" : { "serie a" : 18, "serie b" : 2, "coppa italia" : 5, "supercoppa italiana" : 6, "uefa champions league" : 7, "uefa super cup" : 5, "cup winners cup" : 2, "uefa intercontinental cup" : 4

winforms - Clicking/Selecting Check box(s) in CodedUI Testing -

i'm trying create automation codedui testing script (using visual studio premium 2013) i'm trying click/select check box(s) . have procedure codes names few nodes in procedure codes. how make vs click check boxes ? thanks :) check on calling getchildren() on identified wintreeitem . if in list wincheckbox need define. var checkbox = new wincheckbox(yourtreeitem); checkbox.tryfind(); mouse.click(checkbox); now worth mentioning codedui provides wincheckboxtreeitem type of control. might bind desired check box well. var treecheckitem = new wincheckboxtreeitem(yourwintree); // add search properties display text treecheckitem.tryfind(); treecheckitem.checked = true;

jQuery Print elements pushed into array -

i have following code: var $element1 = $('#selector'), $element2...; var $elements = [ $element1, $element2, $element3 ], $classes = ['class1','class2','class3'], $newelements = []; $.each($elements, function($i, $element){ $newelements.push('<li class="'+ $classes[$i]+'">' + $element +'</li>'); }); $(body).append( $newelements ); the output being: <li class="class1">[object object]</li> <li class="class2">[object object]</li> <li class="class3">[object object]</li> how can print actual elements? use outerhtml of element being appended: $.each($elements, function($i, $element){ $newelements.push('<li class="'+ $classes[$i]+'">' + $element[0].outerhtml +'</li>'); });

javascript - node.js obfuscate tool for client-side files -

i looking tool or similiar: http://javascriptobfuscator.com/javascript-obfuscator.aspx but module node.js, can obfuscate client-side js file before sending them. the tool url above few things important changes strings between quotes , variable names unreadable form. i've tried write code encoding strings, makes code broken: var output = str.replace(/(")(([^"\\]|\\.)+)(")/gi, function(match, p1, p2, p3, p4) { return p1 + someencodingfunc(p2) + p4; }); edit: thanks robertklep i've found confusion module. job. maybe can me issue? https://github.com/uxebu/confusion/issues/1 you can see problem in code output project page: (function(_x24139) { a[_x24139[0]](called[_x24139[1]](_x24139[2])); an[_x24139[3]](_x24139[4], _x24139[5], _x24139[6]); }).call( this, ["property", "with", "a string literal", "other", "call", "is", "here"] ); all need obfuscate these strings in

nest - Programmatic PUT mapping for a type isn't being used? -

i've defined programmatic mapping type following example in fluent api unit test (fluentmappingfullexampletests) so: _client.map<sometype>(m => m .type("mytype") ... i add instance of sometype index via call like _client.index<sometype>(instance) however, when go searching instance, don't find instances of 'mytype'; instead, there's instance of 'sometype', , new type mapping has been created 'sometype'. have expected put mapping honored when performed insertion. am not using put mappings way should used? unfortunately, unit test doesn't demonstrate round-tripping, i'm unsure if there's else should doing. edit: bears mentioning i'm trying achieve 100% programmatic mapping, here; no next attributes on type. i able handle use case in example: //request url: http://localhost:9200/indexname var indicesoperationresponse = client.createindex(indexname); //request ur

Facebook comments plugin data-href -

we have problem facebook comments plugin. problem occured 3 or 4 days ago. plugin url: developers.facebook.com/docs/plugins/comments in our plugin using "data-href" custom url different current url. working fine 3 or 4 days ago. but today realised there bug usage data-href. seems plugin ignores custom url, use current url default behaviour. page url : http://www.supplementler.com/urun/optimum-gold-standard-whey-2273-gr-608 custom comment url : http://www.supplementler.com/urun/yorum-608 in fact custom url has 782 comments: graph.facebook.com/comments?id= {custom comment url} but in page can see show 1 comment. can seen on graph api this: graph.facebook.com/comments?id= {page url} our current usage of plugin in our page {page url} : could know changes facebook comments plugin lately? or have mistake script or else?

python - ignore certain mercurial commands in mercurial hook -

i have mercurial hook so: [hooks] pretxncommit.myhook = python:path/to/file:myhook with code looking this: def myhook(ui, repo, **kwargs): #do stuff but hook runs on commands use commit logic else, in case hg shelve . there way command user has input avoid running hook on command? perhaps this: def myhook(ui, repo, command, **kwargs): if command "hg shelve" return 0 #do stuff unfortunately answer seems no. debugged hook mechanism of hg 3.1, , information command issued not propagated hook function. way can think of hack ugly debugger api extract informations call stack. another hack inspect sys.argv , fear unreliable (as can't detect if executed via command server ). btw used snippet attach debugger: def myhook(ui, repo, **kwargs): print kwargs pdb import set_trace set_trace()

HTML input range slider call function when stop sliding -

i have slider implemented in html: <input type="range" onchange="app.setspeed()" name="slider1" id="slider1" value="0" min="0" max="255" /> it incrementally calls function app.setspeed() . how can call function @ release of slider? saw there should exist on-handle-up, not work in html version. it's possible jquery .click() or .change() functions: $('#range').change(function() { $('div').html( $(this).val() ); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <input type="range" id="range"> <div></div> fiddle you can pure **javascript*: function addevent(el, name, func, bool) { if (el.addeventlistener) el.addeventlistener(name, func, bool); else if (el.attachevent) el.attachevent('on' + name, dunc); else el['on' + name

Is it legal to compare date / datetime / time / timestamp / etc using comparison operators ( greater than / less than / equals ) in MySQL? -

can point me official mysql documentation stated can comparisons this: declare mydate date; ... if mydate > '2015-04-01' ... end if; excerpt mysql reference when compare date, time, datetime, or timestamp constant string <, <=, =, >=, >, or between operators , mysql converts string internal long integer faster comparison (and bit more “relaxed” string checking). however, conversion subject following exceptions: when compare 2 columns when compare date, time, datetime, or timestamp column expression when use comparison method other listed, such in or strcmp(). for exceptions, comparison done converting objects strings , performing string comparison. on safe side, assume strings compared strings , use appropriate string functions if want compare temporal value string. special “zero” date '0000-00-00' can stored , retrieved '0000-00-00'. when '0000-00-00' date used through connector/odbc, automatically converted n

ios - How would I align an image to the bottom right of the view using Size Classes in Xcode? -

Image
i have image want align bottom right corner of view , want rest of image scale fill available space without falling off screen. my image square, don't want width of image greater device's shortest side (portrait or landscape). i'm new size classes, no matter constraints apply, image grows bigger view , seems have gap between bottom , right had edges of screen, though i've set constraints 0. your specifications little unclear, may account difficulty you're having; need clear on want. had no trouble making square image square , fill shorter dimension in both orientations: so if that's want, it's achieved constraints (no size classes involved).

android - Swiperefresh listview, updates but not how you would expect -

i have listview using swipefresh feature, , i've encountered weird problem. when swipe down, see animation , information (updates behind scenes.) however, can't see updated information, until physically scroll down , again. moment scroll towards top old data replaced new data. swipe// swipelayout = (swiperefreshlayout) findviewbyid(r.id.swipe_container); swipelayout.setcolorschemeresources(android.r.color.holo_blue_light, android.r.color.holo_green_light); final textview rndnum = (textview) findviewbyid(r.id.timestamp); swipelayout.setonrefreshlistener(new swiperefreshlayout.onrefreshlistener() { @override public void onrefresh() { log.i("refreshing", " onrefresh called swiperefreshlayout"); initiaterefresh(); } }); asynctask// private void initiaterefresh() { log.i("irefreshing", "initiaterefresh"); /** * ex

c# - Clean a DataTable in a loop moving used items to two other DataTables -

this question exact duplicate of: collection modified; enumeration operation might not execute on except operation 1 answer i have main datatable called dtmain , 2 child datatables dtsuccess , dtfail . in while loop has 10 second delay in each iteration items in dtmain added dtsuccess , dtfail . in each iteration dtmain clean in other 2 lists. i put code have tried here unfortunately not work. while (dtmain.rows.count > 0) { var query = dt.asenumerable().except(dtsuccess.asenumerable(), datarowcomparer.default) .asenumerable().except(dtfail.asenumerable(), datarowcomparer.default); if (dtmain.asenumerable().any()) dtmain = query.copytodatatable(); thread.sleep(10000); } i have received exceptions such as: collection modified; enumeration operation might not execute and invalidoperationexception the source

sonar runner - Sonarqube ghost projects in issues -

i configuring sonarqube instance version of 5.1 , after several analyzes there ghost projects appearing in issues tab on main page. there 1 project being analyzed same identifier , when check database projects there 1 project , issues in corresponding table has same project_uuid. problem arises when want list issues related every project on server. on left side when choose project filter there should 1 project there unnamed projects appear , when choose issue within ghost project sonarqube gives error message " parameter 'uuid' missing ". when check url uuid of ghost project, not find trace uuid in database either. there way remove these ghost projects or running sonar-runner wrong configuration? edit - config: sonar.projectkey=x sonar.projectname=x sonar.projectversion=1.0 sonar.modules=a,b,c a.sonar.projectbasedir=modules/a b.sonar.projectbasedir=modules/b c.sonar.projectbasedir=modules/c sonar.sources=src sonar.tests=test sonar.java.binaries=../**/classes

javascript - calling internal method for each object in an array -

i have "class" properties , methods. , have instances of class in array in other place in code. want iterate through of them , each call method. this: arr.foreach(draw()); but of course looks global function draw() not there. how access object's methods in situation? i new javascript, assume might stupid question, can't find answer reason. foreach takes callback accepts 3 arguments, array element, index, , array. need first. wrap call draw() in anonymous function , invoke on element function call. arr.foreach(function(elem) { elem.draw(); });

Are connection specific variables in Oracle SQL Developer possible? -

i using oracle sql developer. i have 2 connections use lot have 2 schemas same named different, foo , bar foo , bar connection respectively. queries looks basically... select stuff foo.cooltable; -- foo connection select stuff bar.cooltable; -- bar connection what end doing writing both , pressing ctrl + enter on 1 need after switching connections (or switching , forth manually). what want know if there way have kind of variable specific connection can write 1 , when run query chooses right schema based on connection. something this: select stuff <my_var>.cooltable; where <mr_var> read text " foo " foo connection , " bar " bar connection. similar idea of environment variables if helps clarify. i don't think there in sqldeveloper need. however use logon trigger on database set default schema login. way can fire queries without using qualifying schema name, just: select stuff cooltable to setup logon trigger: oracl

objective c - How to make an NSWindow appear in front of other apps? -

sorry if obvious question, i'm new objective-c. i'm making menu bar app (doesn't show in dock, in menu bar), , reason when open window, appears @ back, behind other apps. thought makekeyandorderfront: enough, doesn't seem trick. so how make window appear in front of other apps? you need activate well. [nsapp activateignoringotherapps:yes]; [window makekeyandorderfront:nil]; if doesn't work, window title-less or that? if so, need follow cocoa/osx - nstextfield not responding click text editing begin when titlebar hidden

Using loop EIP to solve a Usecase in Apache Camel -

i have usecase in have route takes m number of rest urls' input , hits each of these urls's n number of times each until response code comes out 204. so hit url until 204 response code , if returns 204 move on next url , apply same procedure. i tried use loop eip did not work.please suggest. if understood requirement correctly, should trick: <from uri="bean:cxf...." /> <setexchangepattern pattern="inout"/> <to uri="jetty...." /> //hit url <choice> <when> <simple>check_if_http_response_code_header_is_204</simple> <to uri="mock:result" /> </when> <otherwise> <to uri="bean:cxf...." /> //send exchange route again </otherwise> </choice>

html - I want to change the select icon/dropdown icon to (fa-chevron-down). How can I? -

i want use form in code bootstrap want change select icon/dropdown icon fa-chevron-down . <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css" rel="stylesheet"/> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet"/> <div class="container"> <div class="row"> <div class="col-sm-6"> <h2>heading</h2> <div class="form-group"> <label for="exampleinputemail1">some-text</label> <select class="form-control input-lg">...</select> <label for="exampleinputemail1">some-text</label> <select class="form-control input-lg">...<

c++ - Should I be attempting to return an array, or is there a better solution? -

a problem set people learning c++ write short program simulate ball being dropped off of tower. start, user should asked initial height of tower in meters. assume normal gravity (9.8 m/s2), , ball has no initial velocity. have program output height of ball above ground after 0, 1, 2, 3, 4, , 5 seconds. ball should not go underneath ground (height 0). before starting c++ had reasonable, self taught, knowledge of java. looking @ problem seems ought split into input class output class calculations class physical constants class (recommended question setter) controller ('main') class the input class ask user starting height, passed controller. controller give , number of seconds (5) calculations class, create array of results , return controller. controller hand array of results output class print them console. i put actual code @ bottom, it's possibly not needed. you can see problem, attempting return array. i'm not asking how round problem, the

objective c - Not able to make Call on iOS 7.1.2 -

i want make call application. have used following code: nsstring *phonenumber = [@"tel://" stringbyappendingstring:strcareproviderphone]; [[uiapplication sharedapplication] openurl:[nsurl urlwithstring:phonenumber]]; for ios 7.1.1 , ios 8.0 working fine. ios 7.1.2, not working. ios 7.1.2 phone number formatting (999) 9900000. ps: have tried using string formatting stringbyreplacingoccurrencesofstring bracket , space. no success. can 1 please me this. thanks in advance, akshay

vbscript - Get a process path with VBS -

i want kill process vbs, know command : oshell.run "taskkill /im software.exe", , true how software.exe path before kill ? because want launch software.exe again. wmi (can teminate well): dim wmi, list, process, path, shell set wmi = getobject("winmgmts:{impersonationlevel=impersonate}!\\.\root\cimv2") set list = wmi.execquery("select * win32_process") '// or "select * win32_process name = 'xxxxxxx.exe'" allowing removal of if block each process in list if (lcase(process.name) = "xxxxxxx.exe") path = process.executablepath process.terminate() exit end if next wscript.echo path set shell = createobject("wscript.shell") shell.run path

c# - Cannot update InfluenceScore on Social Profiles programmatically -

we have newly set-up crm 2015 on-premise environment; , we're doing fiddling the social care framework . we wanted update social profile record's influencescore parameter within our custom application using web service call, appears have no effect on field. oddly enough, does not throw exceptions , , service call does not complain @ all. seems normal, except the field not being updated . here regarding bits of our code; // retrieving social profile record it's columns entity socialprofile = getsocialprofilebyname(socialprofilename); double score = 0; string scorefield = "influencescore"; // if socialprofile contains our attribute, set appropriately, otherwise add attribute if(socialprofile.contains(scorefield)) { score = socialprofile.getattributevalue<float?>(scorefield).getvalueordefault(0) + 10; // add 10 existing score. socialprofile[scorefield] = score; } else { socialprofile.attributes.add(scorefield, 10); } // update rec

batch file - relative path to .Exe -

i need create batch file has relative path c# application executable. when run batch file program needs start regardless on pc is. appreciated. kind regards let's try this. on local machine, create file. need know machine name program resides , provide first parameter. if sharename different c$, needs part of parameter or parameter. === runit.bat @echo off setlocal set exitcode=0 pushd \\%1\c$\theprogdir dir rem replace starting c# program call thisistheprog.bat set exitcode=%errorlevel% popd exit /b %exitcode%

php - Guzzle ~6.0 multipart and form_params -

i trying upload file , send post parameters @ same time this: $response = $client->post('http://example.com/api', [ 'form_params' => [ 'name' => 'example name', ], 'multipart' => [ [ 'name' => 'image', 'contents' => fopen('/path/to/image', 'r') ] ] ]); however form_params fields ignored , multipart fields present in post body. can send both @ guzzle 6.0 ? i ran same problem. need add form_params multipart array. 'name' form element name , 'contents' value. example code supplied become: $response = $client->post('http://example.com/api', [ 'multipart' => [ [ 'name' => 'image', 'contents' => fopen('/path/to/image', 'r') ], [ 'name' => 'n

php - MongoDB server-side aggregate queries shared between multiple scripts -

we have mongodb database pull data different sources, using aggregate framework. a python script generates pdf reports, our dashboard plots graphs of data pulled php backend. these scripts use same aggregate pipelines, code replicated in python , php. we make queries framework-independent, because plan move backend php python, , in general avoid code replication. i thought 1 solution have queries in js file, or somehow store them (on mongo) server side, i'm not sure whether possible or not. for refer mysql, want mysql views on mongodb. suggestion? edit1: i'm experimenting server-side javascript doesn't seem option apparently allows $where , ``mapreduce``` operations. loading external javascript may option too. i'd recommend storing aggregation pipelines in json files , loading them scripts. e.g. in python: import json import pymongo pipeline = json.load(open('filename.json')) collection = pymongo.mongoclient().db.collection doc i

jquery - How to use CORS to access Flipkart API? -

i'm trying access below url using jquery ajax call.. ajax call $.ajax({ type:"get", url: 'https://affiliate-api.flipkart.net/affiliate/report/orders/detail/xml?startdate=2015-05-01&amp;enddate=2015-05-30&amp;status=pending&amp;offset=0', beforesend: function(xhr) { xhr.setrequestheader("fk-affiliate-id", "xxxxxx"); xhr.setrequestheader("fk-affiliate-token", "yyyyyyyyyyyyy"); }, success: function(data){ $('#response').html(data); } }); i'm getting below error.. cross-origin request blocked: same origin policy disallows reading remote resource @ https://affiliate-api.flipkart.net/affiliate/report/orders/detail/xml?startdate=2015-05-01&enddate=

jquery - Calculate a total from autocomplete suggestion.data -

i'm trying write small jquery program autocomplete searchform. user able add items autocomplete form sort of shopping list. have difficulties finding way calculate , update total price of added products, tried store prices, in suggestion.data , tot add recusively total in total = total + suggestion.data, seems not way. me produce , display total? jquery code follows: var price = {}; var name = {}; var totaal = {}; $(function () { var currencies = [ {value:'text-string',data:'5.50)'}, {value:'text-string2',data:'3.10)'}, ]; $('#autocomplete').autocomplete({ lookup: currencies, onselect: function (suggestion) { price.fff = suggestion.data; name.fff = suggestion.value; }, }); }); function addlistitem() { var write2 = price.fff; var write = $('#autocomplete').val(); var list = $('#itemlist'); var item = $('<li><

ajax - REST Service, access not allowed on POST -

i created rest service , i'm connecting using jquery ajax , i'm passing , receiving data json. when i'm using works fine when i'm doing post it's not working, it's not entering debug(service). it's giving me error: xmlhttprequest cannot load http://localhost:23262/getalldrawsshort . no 'access-control-allow-origin' header present on requested resource. origin ' http://localhost:40464 ' therefore not allowed access. and i'm using access-control-allow-origin: * should allow domains i found similar issues , tried them didn't work me. code in global.asax (service): private void enablecrossdmainajaxcall() { httpcontext.current.response.addheader("access-control-allow-origin", "*"); if (httpcontext.current.request.httpmethod == "options") { httpcontext.current.response.addheader("access-control-allow-methods", "post, get, options");

How to count color pages in a PDF/Word doc using Java -

i looking develop desktop application using java count number of colored pages in pdf or word file. used part of overall system calculate cost of printing document in terms of how many pages there (color/b&w). ideally, user of application use file dialog select desired prf/word file, application count , output number of colored pages, allowing system automatically calculate document cost accordingly. i.e if a4 colored pages cost 50c per page print, , b&w cost 10c per page, calculate total cost of document per colored/b&w pages. i aware of existing software rapid pdf count http://www.traction-software.co.uk/rapidpdfcount/ , unsuitable part on integration new system. have tried using ghostscript/python per solution: http://root42.blogspot.de/2012/10/counting-color-pages-in-pdf-files.html , takes long (5mins count 100 page pdf), , difficult implement desktop app. is there method of counting number of colored pages in pdf or word file using java (or alternat

c - Is calling atoi without stdlib undefined behaviour? -

is calling atoi without including stdlib.h undefined behaviour? can't find have included stdlib.h in project, though have used atoi . thing atoi has been working fine - it has been parsing integers correctly every time software has been used . embedded device. there case can defined? btw. in line: #ifdef __cplusplus #if __cplusplus extern "c"{ #endif #endif /* __cplusplus */ #include "sdkglob.h" #ifdef __cplusplus #if __cplusplus } #endif #endif /* __cplusplus */ that header includes stdlib.h can't understand in case included. , not sure if cplusplus defined anywhere. c project anyway. prior c99 acceptable use functions hadn't been declared. compiler might generate warning there no error until linker either didn't find function or found function of same name signature other 1 compiler had guessed. luckily you, compiler guesses return type of int . in c99 became necessary function declarations visible not compilers strict

How to initialize a structure pointer with another structure pointer inside by C? -

i try initialize structure pointer structure pointer inside c programming, otherwise segmentation fault. structure defined below: `struct gfcontext_t{ char *filecontent; size_t filelength; char *response; int socket_hd; }; struct gfserver_t{ char *servername; int serverport; int maxconnection; ssize_t (*handler)(struct gfcontext_t *, char *, void * ); struct gfcontext_t *ctx; int status; }; the initialization give inside function: gfserver_t * gfserver_create(){ struct gfserver_t *gfs; gfs=(gfserver_t*) malloc(sizeof(struct gfserver_t)); ......//how initialization? return gfs; }` use: gfs->ctx = malloc(sizeof(struct gfcontext_t)); or if want initialize gfcontext_t members null gfs->ctx = calloc(1, sizeof(struct gfcontext_t));

distributed system - kafka log.retention.hours inconsistency in multiple brokers -

i trying run multiple kafka brokers. there file named server.properties , there field "log.retention.hours" set 168 in server.properties file. if change kafka brokers properties file , set different values of "log.retention.hours" in each properties file how act in distributed environment. mean kafka brokers in single cluster replicates partitions, happen if log.retention.hours in broker-1 differs log.retention.hours in broker-2. how replication of partitions take place. data has been deleted in server-1 replicated again other brokers(assuming (server-1 log.retention.period) < (server-2 log.retention.period)). one of basic assumptions in design of kafka brokers in cluster will, few exceptions (e.g. port), have same configuration described in kafka improvement proposal . result, scenario inconsistent configurations have described in question should avoided.

c++ - Allow for variable to be used in local scope -

Image
i'm looking @ large legacy project variables declared in for statements used outside scope. vs2013 doesn't , give compiler errors. how can tell vstudio allow that? for (cbookmarks::iterator = m_listbookmarks.begin(); !(it==m_listbookmarks.end()) && hselected!=it->hparent; it++); cstring hierarchy = lookuphierarchy(it->hparent); it's large project not maintain. i'm reading source code , trying run reference new project. not want "fix" code base. edit for reason still compile errors despite configuring: i tried changing https://msdn.microsoft.com/en-us/library/84wcsx8x.aspx?f=255&mspperror=-2147217396 still compilation errors. use: /zc:forscope- as documented: https://msdn.microsoft.com/en-us/library/84wcsx8x.aspx but hate idea of using such switch. suggest using following change have same effect: cbookmarks::iterator = m_listbookmarks.begin(); (; !(it==m_listbookmarks.end()) && hselecte

video - access youtube api using keyword in python -

i want access youtube api next project not getting how use python code available: the code using #!/usr/bin/python apiclient.discovery import build apiclient.errors import httperror oauth2client.tools import argparser # set developer_key api key value apis & auth > registered apps # tab of # https://cloud.google.com/console # please ensure have enabled youtube data api project. developer_key = "replaced_my_api_key" youtube_api_service_name = "youtube" youtube_api_version = "v3" def youtube_search(options): youtube = build(youtube_api_service_name, youtube_api_version, developerkey=developer_key) # call search.list method retrieve results matching specified # query term. search_response = youtube.search().list( q=options.q, part="id,snippet", maxresults=options.max_results ).execute() videos = [] channels = [] playlists = [] # add each result appropriate list, , display lists of # matchin

ios - Google Maps Info window's resizing based on the internal content -

Image
i'm creating custom info window using method - (uiview *)mapview:(gmsmapview *)mapview markerinfowindow:(gmsmarker *)marker based on uistoryboard using autolayout. expect of internal views resized due actual text information received , final size of info window different view of ib. actually, result infowindow view tries full screen sized, , nothing helps fix this. playing autoresizingmask doesn't change anything, same result setting hugging priority . way set fixed size constraint, i've done width. height need dynamically calculated size based on real size of internal content. update: added screenshots storyboard update 2 : sample test 2 scroll views, overridden method intrinsiccontentsize : - (cgsize)intrinsiccontentsize { [self layoutifneeded]; return self.contentsize; } internal uiscrollview attached via 4 sides base scrollview internal uiscrollview attached top , left sample test view hierarchy as can see full screen root uiscrollvie

Android 5.0 incoming call does not invoke Activity.onPause() call any more? -

i have app has code handle incoming call part of function. depends on fact incoming calls invoke activity.onpause(). however, on samsung s6 android v5.0.2, incoming call event not seem call method anymore. have missed anything? if not, there work around? i've tested android 5.1, , incoming call not invoke onpause. call answered, onpause being invoked. what don't understand why onstop not being called, if activity not visible when call answered.

livecode - How to find out the rarkey value for delete key -

how find out rarkey value delete key. if use rarkey can't use other key alternative method "on rawkeydown thekey" if capture rawkey value in rawkeydown handler, must pass message if want of key presses handled engine. case of key messages want handle (e.g., rawkeyup, keydown, keyup); if not pass message, it's normal functionality preempted. on rawkeydown pcode if pcode 65535 # want handle delete key here else pass rawkeydown end if end rawkeydown

php - header() method doesn't work -

i want make redirect doesn't come back. know before header() method shouldn't call output result don't know have written methods returns output. source: <?php include 'database.php'; $message = mysqli_real_escape_string($con, $_post['message']); date_default_timezone_set('iran'); $time = date('h:i:s a',time()); if(!isset($message) || $message == ''){ $error = "fill textbox"; header("location: harf.php?error=".urlencode($error));//changed exit(); } else { $query = "insert main (user,message,time) values('robot','$message','$time')"; if (!mysqli_query($con,$query)) { die('error: '.mysqli_error($con));//changed } else { header("location: harf.php"); exit(); } }?> thanks you have spelling mistake here header("locaton: harf.php?error=".urlencode($error)); change this

c# - asp.net-mvc-6 active menu item by page -

<a asp-action="index" class="active" asp-controller="user">blah</a> <a asp-action="tarif" asp-controller="home">blah</a> <a asp-action="account" asp-controller="home">blah</a> with new asp-helpers cant insert @if () < text> class="active" < / text> in tag . how make correctly , easier? i know there lot of solutions, want know - how solve correctly in new asp. to use complete statement inside element, need wrap {} . <a asp-action="index" @{ if (isactive) { <text> class="active" </text> } } asp-controller="user">blah</a> to use expression when isn't detecting end properly, you'll want wrap () . <a asp-action="index" class="@((isactive) ? "active" : "")" asp-controller="user">blah</a>

android - How to remove ic_launcher.png from activity_main? -

Image
just started learn basic android programming. trying create navigation drawer (which has been done), drawer icon out of place , want remove little green android icon @ top left. don't wanna delete image drawable folder in case decide add 1 after all. how can hide/remove icon through xml/java files, , how shift drawer icon place? if want hide icon set transparent color instead this: getactionbar().seticon(android.r.color.transparent); and if want replace icon: getactionbar().seticon(r.drawable.my_icon);

excel - Errors when nesting IF() formulas -

i'm putting simple spreadsheet calculates tax owed based on few different bands. have 'invoiced amount' cell takes yearly invoicing , applies tax rate based on following conditions: if 'invoiced amount' below 10, 600 tax owed = 0 if 'invoiced amount' above 10, 600 less 42, 386 tax owed = ((invoiced amount - tax allowance)/100) * 20 if 'invoiced amount' equal or greater 42, 386 tax owed = ((42, 386 - tax allowance)*20)+((invoicedamount - 42, 386)*40) i overlooking basic here, sure - tax allowance 10, 600 - on 42, 386 worked out @ 20% tax, , earn above 42, 386 charged @ 40% on top... the more type out more confused am. anyway, here excel formula: invoicedtotal = p5 taxallowance (10600) ='uk tax figures'!c3 taxallowanceupperband (42386) ='uk tax figures'!g5 taxallowance upper band - tax allowance (31784) = h5 uppertaxallownace band (42386.01) = ='uk tax figures'!f5 =if ((p5)<’uk tax figures’!c3, 0, if(p5&

artificial intelligence - AI in javascript -

i'm developping simple game , i'm trying program ai using javascript. function ai() { ammotrue = 0; ammofalse = 0; if (round == 1) { aiammunition(); } if (aiammo == "true" && round > 1) { //or gun or shield ammotrue = math.floor((math.random() * 2) + 1); if (ammotrue == 1) { aishoot(); } if (ammotrue == 2) { aiprotect(); } } if (aiammo == "false" && round > 1) { //or ammo or shield ammofalse = math.floor((math.random() * 2) + 1); if (ammofalse == 1) { aiammunition(); } if (ammofalse == 2) { aiprotect(); } } } explanation : in first round, want function aiammunition() executed. works. after rounds after first one, want test if aiammo true or false. if aiammo true, want randomly execute aishoot or aiprotect . if aiammo false, want randomly execute aiammunition or aiprotect . i later have reset function resetting aishoot , aiprotect after each round, there can 1 of bei

Android support Toolbar not displaying custom drawable properly -

Image
i'm trying update apps actionbar toolbar encountered problem on customizing toolbar display custom drawable. what tried far set xml drawable toolbar destroys whole toolbar , moved menu button down cannot see it: here's drawable first: bg_actionbar.xml <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item android:drawable="@drawable/bg_gradient" /> <item android:drawable="@drawable/icon_logo" /> </layer-list> bg_gradient 9patch image gradient , same icon_logo. and toolbar: <android.support.v7.widget.toolbar xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/actionbar" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize"

c# - Does CopyTo store the whole thing in memory? -

i have following code snippet, designed add files .zip file, while @ same time calculating sha1 checksum. however, it's running out of memory on large files. which part of causing whole file in memory? surely should streamed? using (ziparchive archive = zipfile.open(buildfile, ziparchivemode.update)) { foreach (var filename in namelist) { ziparchiveentry entry = archive.createentry(source.filename); using (stream zipdata = entry.open()) using (sha1managed shaforfile = new sha1managed()) using (stream sourcefilestream = file.openread(filename)) using (stream sourcedata = new cryptostream(sourcefilestream, shaforfile, cryptostreammode.read)) { sourcedata.copyto(zipdata); print filename + ':' + shaforfile.hash; } } } (copied comment - answers question) the problem ziparchivemode.update, can require significant alterations file on disk. can ever directly stream dis

php - Revoke User Creation, write to DB -

this small school project. new php & sql. have form, in user enters desired username & password. thereafter, trying check database see whether account same username exists. here code: $sqlvalidate = "select id useraccounnts username='$username'"; $resultvalidate = $conn->query($sqlvalidate); $sql = "insert useraccounts values($id, '$username', '$password')"; if ($resultvalidate != 0) { $date = new datetime(); //this returns current date time $time = $date->format('d-m-y-h-i-s'); $sqlerrorlog = "insert errorlog (errortype, errortime) values ('failed create new user, username exists', '$time')"; $result = $conn->query($sqlerrorlog); echo '<script type="text/javascript">' , 'alert("sorry,an account username exists. please choose one."); window.location.href = "user.php";' , '</script>'

reflection - Correctly distinguish between bool? and bool in C# -

i trying find out if variable either simple bool or nullable<bool> . it seems that if(val nullable<bool>) returns true both bool , nullable<bool> variables and if(val bool) also returns true both bool , nullable<bool> . basically, interesting in finding out if simple bool variable true or if nullable<bool> variable not null . what's way this? here full code: list<string> values = typeof(instviewmodel).getproperties() .where(prop => prop != "subcollection" && prop != "id" && prop != "name" && prop != "level") .select(prop => prop.getvalue(ivm, null)) .where(val => val != null && (val.gettype() != typeof(bool) || (bool)val == true)) //here i'm trying check if val bool , true or if bool? , not null .select(val => val.tostring(

resize - Angularjs resizing overlayed on div's on img-responsive -

http://plnkr.co/edit/mqb85ejjxzhol5vkv4ua?p=preview i have bootstrap img-responsive element overlayed div elements. how can resize these divs binding width , height attributes. not want use jquery, correct angular way. i have tried directive app.directive('onsizechanged', ['$window', function ($window) { return { restrict: 'a', scope: { onsizechanged: '&' }, link: function (scope, $element, attr) { var element = $element[0]; cacheelementsize(scope, element); $window.addeventlistener('resize', onwindowresize); function cacheelementsize(scope, element) { scope.cachedelementwidth = element.offsetwidth; scope.cachedelementheight = element.offsetheight;

linux - Javascript Date object returns wrong date -

i have trouble js date object. i working on timezone settings. creating zic file (like /usr/share/zoneinfo/europe/paris) i'm able manual set local date time parameters. tests, i'm doing offet of 1 year. works fine on system side : date -u ==> thu jun 4 10:18:27 utc 2015 date ==> sat jun 4 12:18:29 bst 2016 but console.debug(new date()) ==> sun may 10 2015 13:50:27 gmt-k631 (bst) does have seen such strange behavior , date object ? thanks thom the browser date object using clock determine time. if set location ( +2 hours, -5 hours etc ) there going difference between system side , client side. you can "normalize" date greenwich time ( +0 ) , set time object based on current offset , desired offset.

excel - VBA Calculate a range of cells after copying and pasting formulas -

i have working vba function copies formulas range of cells , requests user wants paste. once function has pasted specified row(s), have included .calculate function update formulas. however, when .calculate runs, updates range user has inputted, , not entire row. code below, assume a2 forename, b2 surname , c2:e2 formulas. when input box comes requesting paste, user select c3:e3 , calculate everything. if lazily click c3, , formulas pasted in, update c3. how amend this? sub pastemacro() ' ' pastemacro macro ' ' keyboard shortcut: ctrl+m ' on error resume next set ret = application.inputbox(prompt:="please select range want paste", type:=8) on error goto 0 if not ret nothing selection.copy range("c2:e2").copy destination:=ret ret.calculate application.cutcopymode = false end if end sub -------------a ------- b ----------------- c --------------------