Posts

Showing posts from September, 2014

java - GcmListenerService.onMessageReceived() not called -

i'm working on implementing gcm notifications app. the problem i'm having onmessagereceived() method gcmlistenerservice implementation isn't called. receive data gcm servers fine, since automatically generates notification (i wish replace own notification using onmessagereceived() method) after none of log calls printed in log. json sent server gcm server { "notification" : { "title" : "title", "text" : "message", "icon" : "@drawable\/ic_notification", "click_action" : "open_main_activity" }, "registration_ids":[ "xxxx", "xxxx", "xxxx", "etc" ] } androidmanifest.xml (gcm part only) <!-- gcm start --> <receiver android:name="com.google.android.gms.gcm.gcmreceiver" android:exported="true" android:permission=&qu

java - FreeMarker : Displaying a custom 404 page without redirection -

i have static 404 page fancy stuff in it. in case user enters wrong url of page not exist, him see 404 page , keep url in order user see mistake s/he has done typing url . the page entered , not exist : http://localhost:10039/my.website/my/halp.html the 404 page : http://localhost:10039/my.website/my/notfound.html briefly, instead of using "sendredirect" here, "get content" of pagenotfoundurl , show while url still http://localhost:10039/my.website/my/halp.html instead of redirect, tried "forward" kayaman suggested in case " cannot forward. response committed." testservlet defined in web.xml , , class extends utilfreemarkerservlet extends freemarkerservlet. utilfreemarkerservlet public abstract class utilfreemarkerservlet extends freemarkerservlet { private static final long serialversionuid = 1l; public static final string request_object_name = "requestobject"; private logger logger = loggerfactor

android - G.Maps javascript Multiple directions from my position. Reload page -

then have code geolocation of position , number of places want go .i used service driving directions google have problem , read first target while others work if select , reload page . have solutions ? there quite few issues in code. start not defined when call calcroute() function. want use mylocation instead. you should use 1 infowindow object , use setcontent() method change content (in click event listener).

python - PyScripter can`t import PyQt4.uic.Loader -

Image
i import uic , qtgui pyqt4 , can`t compile project because have message: i have __init__.py file in uic\loader, how fix problem? update i think pyscripter can`t see folder 'loader' in uic. why?

android studio : linux, windows, and poor performances -

i starting android application. comfortable .net/mono/visual-studio, , development environment runs under windows. installed android studio on laptop (windows 8.1). when opening project template, android studio took fews minutes indexing files (with lags), , gradle took 3 minutes build "empty" project. now, android studio "scanning files index" (it seems task related file system ?)... disabled "security center" service things same. emulator first start occurs within minutes... (i have acceptable perfs visual-studio) do think android studio have better performances under linux (which distro ?), seems commits lot of operations related file system ? have read ramdisk improve situation. could please advise me readings start android development (blogs, books...) ? android studio best u..there android studio setup available linux,mac , windows.and preparation download androidcookbook pdf.

Python keep asking for raw_input in "while True" -

this question has answer here: asking user input until give valid response 9 answers i need python keep asking raw_input if answer different 1 or 2. here example: print """what want me do? 1) press 1 if want ..... 2) press 2 if want .....""" while true: answer1 = raw_input(" => ") if (answer1 == 1): .... .... elif (answer1 == 2): .... .... elif (answer1 != 1 or 2) or answer1.isalpha(): print "i need 1 or 2" the problem python keeping asking raw_input if user enter 1 or 2. wrong? you should put break statement in if , elif block if answer 1 or 2 break out of while loop. example - if (answer1 == 1): .... .... break elif (answer1 == 2): .... .... break

Print JSON output into table - PHP -

i need print json output in table { "response_code":200, "pnr":"6642876935", "train_num":"12792", "train_name":"pnbe sc exp", "doj":" 6- 7-2015", "from_station": { "code":"pnbe" }, "to_station": { "code":"sc" }, "reservation_upto": { "code":"sc" }, "boarding_point": { "code":"pnbe" }, "class":"sl", "no_of_passengers":"1", "chart_prepared":"n", "passengers":[ { "sr":"1", "booking_status":"w\/l 43, gnwl","current_status": "rac 19" } ], "noms":1, "error":null

reporting services - Limit the displayed data on first page of Report then continue to next page -

can me achieve this. have report displays monthly attendance of employees.(the columns employeename, monday, tuesday, wednesday, thursday, friday, saturday, sunday , totalworkhours sum of hours monday sunday). want display these columns in first page, continue on next page. report displays wide page depends on given date range.let me know if explanation unclear

HDIO_GETGEO and HDIO_GET_IDENTITY in Linux using C++ -

can explain core difference between hdio_getgeo , hdio_get_identity . linux documentation know former getting device geometry , latter getting ide identification info . which hdio_ ioctl call should use no. of sectors , bytes per sector of hard disk in linux??

javascript - CasperJS/PhantomJS - Browsing one page and send HTTP request to other resource -

i need browse 1 page, retrieve data , send data service via http requests. far know, casperjs/phantomjs can work simultaneously 1 web resource. how bypass limitation? upd: need make request casperjs/phantomjs side, not page context through evaluate() . @interloper - able perform integration, need 2 basic requirements: 1 - page requested, must habilidada receive information via http access control (cors). depend on type of application! example, if using c # in project, you'll have add following code in web.config in system.webserver : <httpprotocol> <customheaders> <add name="access-control-allow-origin" value="*" />     <add name="access-control-allow-headers" value="content-type" /> </customheaders> </httpprotocol> with this, project / page enabled can make access / exchange of information other domain ... 2 - can call url domain, , in our case, code casperjs, can

Excel Formula To Count Sum of the Cells -

i have sheet in have hours devoted particular task summed @ end. want count number of cell in sum of hours specific number(e.g. 9. unable apply countif function exact results. unable attach screenshot, overview this task1 task2 task3 task4 total and want calculate how many time particular hours repeated in "total" in next preceding sheet. =countif(c:c,9) should work column c contains sum of hours

javascript - Mean.js Stack - export.read with findOne and find functions, call in Angularjs -

i new mean.js, , little confused on how use export.read , call findone function find function added in. have customers module , customer-users module in app. have customers.server.controller, customer-users.server.controller, , client controllers. customer organization. , there users fall under customer. can display customer-users list export.list in customer-users module. can display list of customers in customers module, , of course have customer view when select customer. want when select customer, list of customer-users display underneath customer name on customer view. have tried edit customers.server , customers.client controllers done, unsure of right way go this. here customers.server.controller.js : 'use strict'; /** * module dependencies. */ var mongoose = require('mongoose'), errorhandler = require('./errors.server.controller'), customer = mongoose.model('customer'), passport = require('passport'), user = mongoose.mo

Ubuntu automatically pull from Github repo -

i installed git on server want pull github repo whenever push changes made locally. i've looked hooks it's confusing , can't find tutorials. know how that? i want server pull repo after each commit that looks webhook : server listen pull event ( json payload ) emitted github. you find many example of listener, zenhacks/github-webhook-listener in coffeescript.

python - Get 'subscriptions driven', Youtube API not returning all data available in UI -

Image
when @ statistics under youtube videos this i interested in third tab. have spent day reading youtube documentation cannot seem find way it. queries this https://www.googleapis.com/youtube/v3/videos?part=statistics&id=videoid&key=mykey and statistics part returns following parameters "statistics": { "viewcount": "559064", "likecount": "5319", "dislikecount": "150", "favoritecount": "0", "commentcount": "628" } is there way number, subscriptions driven? looks need use youtube analytics api. there subscribersgained metric in reports use either video dimension or filter parameter restrict response include data particular video, subscribersgained metric include statistics specified video's watch page.

I want to specify the linux memory size using menu.lst -

i have server 128g memory,and hope linux use memory space this: the space offset 0 size 18g,the space form offset 66g size 16g. so add 2 parameters in /boot/grub/menu.lst: mem=18g mem=16g@66g but when reboot machine found memory size 14g,it means latter parameter works,so how can 2 parameters work together?

c++ - Incorrect time calculation with mktime to get UTC+8 -

i want current time in hong kong (utc+8), , local time utc-5. using , running following in vs2012: #pragma warning(disable : 4996) char buffer[10]; time_t rawtime; time(&rawtime); strftime(buffer, 10, "%h:%m:%s", localtime(&rawtime)); cout << "localtime=" << buffer << endl; strftime(buffer, 10, "%h:%m:%s", gmtime(&rawtime)); cout << "gmtime=" << buffer << endl; tm* r = gmtime(&rawtime); r->tm_hour += 8; // hong kong time mktime(r); // normalize struct strftime(buffer, 10, "%h:%m:%s", r); cout << "hongkongtime=" << buffer << endl; produces following output: localtime=22:51:47 gmtime=02:51:47 hongkongtime=11:51:47 so it's computing utc correctly, adding 8 hours producing time utc +9 . what's going wrong? and there more elegant/reliable way of getting utc+8 kludge? you use localtime after changing tz environment variable

osx - Google App Engine Launcher is not running my hello world for Python Mac -

i have tried existing resources no avail. here app.yaml code: version: 1 runtime: python27 api_version: 1 threadsafe: true handlers: - url: /.* script: helloworld.app here webapp2 code: import webapp2 class mainpage(webapp2.requesthandler): def get(self): self.response.headers['content-type'] = 'text/plain' self.response.write('hello, world!') app = webapp2.wsgiapplication([ ('/', mainpage), ], debug=true) all in hello_world directory. proceed add existing application , point hello_world directory helloworld.py (webapp2) script , app.yaml code living. hit run on google app engine , stays loading, never completes. therefore, http://localhost:8080/ page never loads. you're missing application: line in app.yaml . you're gonna need list 3rd party webapp2 in libraries section, this: libraries: - name: webapp2 version: "2.5.2"

c# - Class instance being shared by multiple users -

i have web app hosted on azure shares messages among users table called message located in sql azure database. project contains class keep track of current user information called currentuser.cs . contains properties username , roomid , jointime , etc. i'm having difficulty understanding happens class when user logs in. thought every user have own instance of currentuser not accessible others. here's i'm seeing: if usera logs in, able post messages , messages display username. when userb logs in, able post messages username. if usera posts message after userb has logged in, messages display userb 's username. leads me believe usera 's currentuser.cs file being overwritten when userb signs in. how can be? thought every time visited site, new instance of currentuser.cs exist. not case? of users share same currentuser class have it? edit i have constructor inside currentuser sets properties when app loads. never call currentuser user = new currentu

javascript - How to display multiples of imported html copies? -

i make attempt multiple html imports through javascript/ jquery. however, don't find there examples on internet. possibly because html import technology emerging. in fact, made attempt. however, not have guidelines. <link rel="import" class="note-import" href="blah.html" /> <div id="notes"> <!-- put in here --> </div> <script> var links = document.getelementsbyclassname('note-import'); (var = 0; < links.length; i++) { var cont = document.head.importnode(links, true); document.getelementbyid('notes').appendchild(cont); } </script> the code means want display html(s) (whom divs styles , on) div id notes. simply use jquery load html specified divs: <div id="page1"></div> <div id="page2"></div> and load content them. can trigger function @ time , ever overwrite content

Migrations in Identity with Multiple Data Access Layers -

i have application consists of console app runs in background , web app interface data. because many database functions used 2 applications have data access layer (dal) used access database , data model layer (dml) created database. using code-first solution , have enabled migrations on dml. however, beginning implement user logins using identity framework , on web app side of things. can enable migrations in app - identity models/data located in same database other data. wondering if i’m going screw things trying enable migrations on same database different application? tia. so, appears can add migrations same database different projects. pleased. i’d still appreciate guidance or “don’t this” comments.

How to extract the location of shorter sequence based on longer sequence using Python? -

i have file sequence id , information of binding site location. extract location information without a,t,c,g information. shorter sequence above longer sequence shows location , every number on left example in file value 451 location value on left. location of short sequence on longer sequence start 453 (start site) , obtain length of shorter sequence size 21 , add 453 end site 474. can me? file a.txt chr1:152806601-152807450 ttcagcaccatggacagcgcc 451 ggcttcagcaccacggacagcgccccacccgcggccctccccccggcggcgcgctccagccggtgtaggcgaggc ttcagcaccatggacagcgcc 751 agagccccccgggactgcagagagcacctgggaggctggactgggaacgagacatactcgaaggagtaagtgaag chr10:125364276-125364825 ttcagcaccatggacagcgcc 301 cagtaatgtggggttgtggtcagcaccatggacagctcccctgttgcttcatattgaggaataggaaagcgccgc ttcagcaccatggacagcgcc 376 tatctccggatcctggctagctccagccactgcaggtaactgtcttgaatgggcttagaaacatggtgatgtctg desired output chr1:152806601-152807450 4

html - adding a text below an image after clicking on it -

i beginner html have given task add text below image after clicking on it i trying this <a href="hh.jpg"> <img src="hh.jpg" width="100" figcaption="has"> </a> but requires 2 pages task completed. , have in 1 page. in order complete assignment. can 1 guide me how it...? here's approach html requested. href of a should target anchor, add css style show targeted location if target pseudo-class selected. <style> #display { display: none; } #display:target { display: block; } </style> <a href="#display"> <img src="hh.jpg" width="100" figcaption="has" /> </a> <div id="#display">show text</div>

How to avoid hard coding in if condition of python script -

i new python. have query regarding un-hardcoding object names(if condition) in python script. have fruit = [ apple, mango, pineapple, banana, oranges] , size = [ small, medium , big] write code below: if (fruit == apple, size == small): statement 1 statement 2 elif (fruit == apple, size == medium): statement 1 statement 2 elif (fruit == apple, size == big): statement 1 statement 2 elif (fruit == mango, size == small): statement 1 statement 2 elif (fruit == mango, size = medium): statement 1 statement 2 how can avoid writing multiple if...else conditions? statement 1: pulling dot file related fruit , size directory path structure main-directory/fruit/collateral/fruit_size.dot statement 2: pulling txt file related fruit , size directory path structure main-directory/source/readparamters/readparam/fruit_size.txt i want execute statements each condition 1 @ time. take inputs fruit , size user. there way in python script can automatically take

php - How do I use Parent page to get attributes for wp_nav_menu buttons? -

i have wordpress page working on have had change aid in optimising seo of page. part of optimisation, changed page titles, has caused issue menu's in header used page titles menu items. i made custom menu , used wp_nav_menu have populate in header works well, however, original wp_list_pages menu had function if hovered on button, button colour change background colour of linked parent page. the header file code is: (note original code commented out @ ul id="state-nav") <div id="slideshow" <?php if (is_page_template("page-state.php") or is_page_template("page-state-2col.php")) { echo "class=\"subnav\"";} ?>> <div class="image"> <?php // featured image get_the_image( array( 'link_to_post' => 0, 'the_post_thumbnail' => 'true', 'size' => 'full', 'default_image' => ''.get_bloginfo('

ruby - Rails 4 : Issue when searching using Sunspot and Solr -

i set sunspot , solr give rails app powerful search functionnality. the install process straight-forward , did basic stuff required : add gems gem 'sunspot_rails' gem 'sunspot_solr' gem 'progress_bar' run commands bundle rails generate sunspot_rails:install bundle exec rake sunspot:solr:start rake sunspot:solr:run rake sunspot:solr:reindex everything fine on level , documents created correctly. now search, doesn't work well. here did on model , controller : domain.rb class domain < activerecord::base searchable text :name, stored: true end end homecontroller.rb class homecontroller < applicationcontroller def index @domains = domain.search fulltext params[:q], fields: [:name], highlight: true paginate page: params[:page], per_page: 12 end end end my actual datas list of domain names (e,g, google.com, facebook.com...etc...) when searching goo , returns nothing. when searching google.com

python - Matplotlib trouble plotting x-labels -

Image
having issues using set_xlim . (possibly because of datetime objects??) here's code (doing in ipython notebook): %matplotlib inline import matplotlib.pyplot plt import numpy np import datetime date_list = [datetime.datetime(2015, 6, 20, 0, 0), datetime.datetime(2015, 6, 21, 0, 0), datetime.datetime(2015, 6, 22, 0, 0), datetime.datetime(2015, 6, 23, 0, 0), datetime.datetime(2015, 6, 24, 0, 0), datetime.datetime(2015, 6, 25, 0, 0), datetime.datetime(2015, 6, 26, 0, 0)] count_list = [11590, 10743, 27369, 31023, 30569, 31937, 30205] fig=plt.figure(figsize=(10,3.5)) ax=fig.add_subplot(111) width = 0.8 ticklocations = np.arange(7) ax.set_title("turnstiles totals lexington station c/a a002 unit r051 6/20/15-6/26-15") ax.bar(date_list, count_list, width, color='wheat', edgecolor='#8b7e66', linewidth=4.0) ax.set_xticklabels(date_list, rotation = 315, horizontalalignment = 'left') this gives me: but when try make space on leftmost , rightm

jquery - what's the difference between a boiler plate and a template? -

what's difference between boiler plate , template? thought same thing. why wouldn't "template"? to put simply, a template provides structure , layout document. a boilerplate provides actual text , images. boilerplate copy , paste , adapt freely. template rather handled in organised fashion, never adapted parameterized.

php - Silex SecurityServiceProvider is storing AnonymousToken on HHVM when trying to authenticate -

i'm using silex framework on hhvm , running issues when trying implement securityserviceprovider login. when trying perform login action (with correct username & password), i'm redirected login page instead of / page. because of following access rule: $app['security.access_rules'] = array( array('^/$', 'role_user') ); i've tried dumping $app['security.token_storage']->gettoken() , $app['security.token_storage']->gettoken()->getuser() @ top of login page: object(symfony\component\security\core\authentication\token\anonymoustoken)#350 (5) { ["key":"symfony\component\security\core\authentication\token\anonymoustoken":private]=> string(3) "all" ["user":"symfony\component\security\core\authentication\token\abstracttoken":private]=> string(5) "anon." ["roles":"symfony\component\security\core\authentication\token\ab

javascript - List all global variables in Node.js -

i'm trying list of global variables, including refering built-in objects . in chrome's console can type this , keys, including things string , number , etc. however when in node.js less: > object.keys(this) [ 'global', 'process', 'global', 'root', 'buffer', 'settimeout', 'setinterval', 'cleartimeout', 'clearinterval', 'setimmediate', 'clearimmediate', 'console', 'module', 'require', '_' ] > this.eval [function: eval] where this.eval coming from? the built-in properties of global object non-enumerable, object.keys doesn't return them. can use object.getownpropertynames instead.

numeric - Numerical Accuracy: to scale or not? -

i working on n-body gravitational simulator takes input , produces output in metric mks units. involves dealing large numbers (like solar masses expressed in kilograms, semimajor axes of planetary orbits expressed in meters, , timescales of years expressed in seconds), multiplied small numbers (notably, gravitational constant, 6.67384e-11 in mks units), , occasional small number getting added or subtracted large number (mainly when summing pairwise accelerations), gets me concerned effects of rounding errors. i've taken step of replacing masses m gm (premultiplying gravitational constant), reduces total number of multiplies, , makes mass numbers smaller, , seems have had positive effect on both efficiency , accuracy, judged how simulator conserves energy. i wondering, however: potentially worth trying internal re-scaling different units further minimize floating point errors? , if so, kind of range (for double-precision floats) should trying numbers centered on maximum ac

javascript - jQuery Link Navigation Function -

hi i've been trying work while. basically we've rebuilt mobile/desktop version of our site. trying create quick jquery script make pages , links contain our url load using .load() jquery feature. don't want go on 97 pages, , 10 scripts. using... <a href=<?php echo protocol."secure3.idsma.".url."/secure/user/authentication/sso/login/initiate?returnurl=$return"; ?>"> and trying script do. <a onclick="$('html').load('<?php echo protocol."secure3.idsma.".url."/secure/user/authentication/sso/login/initiate?returnurl=$return"; ?>')"> but i'm trying make more effiecent making script can detect link our site , add class triggers jquery function load pages. also when link clicked how .scrolltotop() jquery function work? thanks help. sorry english sentence structure isn't great. please if can. in advanced again help. i'd think you'd have this

php - Permalinks in Wordpress - Error 404 -

i running wordpress locally using xampp. have been trying permalinks work on wordpress site keep getting 404 error when set permalinks other default. when set permalinks default links work. change them example post name 404 error. things i've tried: i have removed # #loadmodule rewrite_module modules/mod_rewrite.so set allowoverride all in section bellow # can "all", "none", or combination of keywords: # allowoverride fileinfo authconfig limit # allowoverride the .htaccess file being generated. contains following content: # begin wordpress <ifmodule mod_rewrite.c> rewriteengine on rewritebase /4.0%20wordpress%20theme%20development/ rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /4.0%20wordpress%20theme%20development/index.php [l] </ifmodule> i tried deleting .htaccess file , have wordpress remake it any awesome!

ios - swift typecasting performance cost -

i trying keep func update:currenttime fast possible. function overridden skscene class , gets called around 2000 4000 times second. want loop through scene's children , optional typecast see if child implements observer interface , call update on that. note: make reference 2 separate func update methods here. will performance shot if typecast 4000 times second? more importantly, how expensive typecast in swift? code context: // called inside func update:currenttime let children = self.children child in children { if let observer = child as? timerobserver { observer.update() } } thanks! it depends. casting e.g. int float cost compiler create real code convert 1 other. in contrast object type cast @ no cost. it's method call fail cast type not tell should be. it's pretend object pointer point legal object. pointer not changed.

Load jQuery UI tabs in same page using AJAX -

i using cakephp(2.5.4) jquery ui tabs(jquery-ui.1.8.20) create tabs , populate contents via ajax on view page. my problem when navigate through tabs, new contents placed in same page(one below other). how can make each content appear under own tab? here script: <script> var st_id = <?php echo $data1['town']['municipality'];?>; //console.log(st_id); $(function(){ $("#mytabs").tabs({ ajaxoptions : { type :"post", data:{postdata:st_id}, error:function(xhr,status,index,anchor){ $(anchor.hash).html("could not load tab"); }, success:function(response){ console.log(response); } } }); }); </script> and div structure <div id='mytabs'> <ul> <li><a href='#content_1' title='cont

javascript - JSONSerializer to render a Java String Array -

i have java array containing 5 strings. want plot data using flot charts , want transfer using render(array) java file html file need javascript. have tried many things, , users suggested me pass json in java file , render make easy "digest" javascript. one of methods i've used following one: jsonserializer testserializer = new jsonserializer(); string test = testserializer.serialize(array); render(test); i've tried store in string test[] element (as array), recognises result serialization unique variable... however, result obtain when later on assign variable ${test} in html file i've done render following one: [&quot;hello&quot;,&quot;bye&quot;,&quot;hi&quot;] with strings "hello", "bye" , "hi" placed that, absolute garbage , not useful treat javascript. furthermore, if instead of render(array) type renderjson(array), html page goes blank array shows want it, thing displayed in content.

Mongodb's geoNear In Flask and Mongoengine -

i using flask , mongoengine. how use mongodb's geonear query? i trying use pymongo using link : db.command(son([('geonear', 'content'), ('near', coordinate)])) if on right way. how create pymongo's db object flask , mongoengine? after reading sourcecode of mongoengine in connection.py get_db return db object need def get_db(alias=default_connection_name, reconnect=false): so can run geonear in mongoengine this: from mongoengine.connection import get_db get_db().command(son([('geonear', 'content'), ('near', coordinate)]))

expressionengine - How to compare 2 dates in different format (javascript) -

i using expression engine , put date field in javascript variable, parses : 1435269960 so want check if date earlier today or not. when create date object , console.log(date) shows me kind of date : wed jul 01 2015 18:14:33 gmt-0400 (eastern daylight time) how change format first one? thx! you so: var datenumber = 1435269960; var converteddate = new date(1000*datenumber); var today = new date(); if(converteddate < today) $(".date").html("the date in past<br/><br/>" + converteddate + "<br/>vs<br/>" + today); else $(".date").html("the date today or in future<br/> (" + converteddate + ") vs (" + today + ")"); demo: http://jsfiddle.net/db9ms49z/

winapi - GetAddressByName and Windows 7 -

i've taken on maintenance of windows service written many years ago. first task service running on windows 7. windbg shows service erroring out on call getaddressbyname. (getaddressbyname returns 0 , service shuts down.) according msdn ( https://msdn.microsoft.com/en-us/library/windows/desktop/ms738517%28v=vs.85%29.aspx ), getaddressbyname not available use winsock v. 2. does above mean getaddressbyname not work windows 7? (does winsock 1.x work on windows 7?) (any recommendations function use instead of getaddressbyname? ) i'm looking see if else has done before. alternatively (getaddressbyname supported on win 7), suggestions debugging call getaddressbyname that's returning 0? best regards, mitch getaddressbyname() legacy function winsock 1.x. removed in winsock 2.0. apps using winsock 2.x should use getaddrinfo() , if not gethostbyname() (which still available). in case, documentation getaddressbyname() says: if function succeeds, the

winforms - VB.NET 2010 DataGridView Handling Keypress via EditingControlShowing Event -

i working datagridview first time , while have many questions, latest issue vexing me. summary of issue: have datagridview (dgv) have set of columns defined. readonly editable. editable columns need 4 things occur. 1) allow numeric entry 2) allow maximum of 2 digits 3) 0 pad entries <2 digits 4) issue: if user types in 2 digit number, want detect , tab next column. cannot work. sample code (with known working items left out): private sub dgvdiary_editingcontrolshowing(sender object, e system.windows.forms.datagridvieweditingcontrolshowingeventargs) handles dgvdiary.editingcontrolshowing dim txtedit textbox = e.control txtedit.maxlength = 2 'remove existing handler removehandler txtedit.keypress, addressof txtdgvdiaryedit_keypress addhandler txtedit.keypress, addressof txtdgvdiaryedit_keypress end sub private sub txtdgvdiaryedit_keypress(byval sender object, byval e system.windows.forms.keypresseventargs) 'test numeric value or ba

ios - Prolem with converting point from table cell -

i have following hierarchy: controller.view [tableview, overlayview]. table view has top inset of 16 points parent view via constraint, overlay view - not. inside table cell content view have view responder , want show it's image on view overlayview . if use code (inside overlay view): cgrect frame; cgpoint origin = [responder convertpoint:responder.frame.origin toview:self]; // fixme origin.y -= 16; frame.origin = origin; frame.size = responder.frame.size; _imageview.frame = frame; uigraphicsbeginimagecontextwithoptions(responder.bounds.size, no, 0); [responder drawviewhierarchyinrect:responder.bounds afterscreenupdates:yes]; _imageview.image = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); i imageview 16 points offset responder origin , image not fit original view. have use line fixme mark have origin points equal. why converting don't work? you should converting point responder 's superview , not responder itself. chan

vba - Compile error Expected: end of statment -

i've got code works fine, wanted add it. made 1 of functions return value. but, no matter return, "compile error expected: end of statment" msgbox appearing. i did code, , still error. can please explain this? public function addresses() integer return 1 end function duplicate of this post , need assign function name value, example: addresses = 1 instead of return 1

python - Pandas Optimized Way to Create Dummy-Variable? -

i creating new dummy variable based off of given column , criteria. below code working with. works slow do. there faster, maybe vectorized way create dummies in pandas? specifically, according example? i have looked get_dummies function in pandas seems little different doing here. wrong though if has way make get_dummies work example, acceptable answer too. def flagger(row, criteria, col): if row[col] <= criteria: return 1 if row[col] > criteria: return 0 dstk['dropflag'] = dstk.apply(lambda row: flagger(row, criteria, col), axis=1) edit: there 2 answers here. @ glance both equally fast (at least same order of magnitude) accepted one. if wants more serious profiling happy revise answer choice. why not try np.where . it's column-wise vectorized operation , faster row-wise apply. dstk['dropflag'] = np.where(dstk.col <= criteria, 1, 0)

What is the difference between OpenSSL s_server and an http server? -

the background question trying rid of http/s server component our code base, our needs limited. (we're not looking support full fledged web browsing). in order not reinvent wheel, searched open source https server component of permissive license able perform correct ssl termination. that's when came across openssl's s_server , s_client. can me understand if above s_server & s_client enough building blocks https server, assuming right certs in place? sample code or tutorial awesome. thanks! this answer job of getting , running. basically crux of problem passing either -http or -www openssl s_server call: openssl s_server -key key.pem -cert cert.pem -www all -http/-www serve "./" in response requests: -www - respond 'get /<path> http/1.0' file./<path> -http - respond 'get /<path> http/1.0' file ./<path> assumption contains complete http response. you'

elasticsearch - Cannot load search template registered with REST API -

i have problem when loading search template has been registrered through rest api. if search template placed in /config/scrips/ folder there no problem. the template has been registrered via post to: /_search/template/templatename , , can see template has been succesfully registered when to: /_search/template/templatename . however, when try send request utilizes search template error. if have tried following endpoints: post: /_search/template (the 1 documentation) post: [index]/_search/template post: [index]/[type]/_search/template with body: { "template": { "file": "templatename" }, "params": { "userid" : "au43nsotzoszwq_2zua4", etc... } } but keeps returning error: { "error": "searchphaseexecutionexception[failed execute phase [query_fetch], shards failed; shardfailures {[udbajwkqq5gpzedzlctrfg][.scripts][0]: elasticsearchillegalargumentexception[unable find on disk script templatename]

Excel Vlookup Changing location -

i have project need mapping data (male=m female=f) when copying information 1 sheet current sheet. code: =vlookup('data'!l2,'mapping data'!b2:'mapping data'!c3,2,false) however, issue when copy , paste cell bellow !b2 , !c3 change next cell. want stay @ b2 , c3. new excel formulas i'm not sure how work or if possible. thank ahead of time. when moves b2 , c3 shows "#n/a" | | b | c |1| |2| field name | code1 | code2 |3| gender | female | f |3| | male | m try this, $ anchor... =vlookup('data'!l2,'mapping data'!$b$2:'mapping data'!$c$3,2,false)

python - CSV Problems and Help Needed with Code -

so trying create python script sort specified column of excel sheet. far code is... import csv import operator open('case_name.csv') infile: data = list(csv.reader(infile, dialect=csv.excel_tab)) data.sort(key=operator.itemgetter(2)) open('case_name_sorted.csv', 'w') outfile: writer = csv.writer(outfile, dialect='excel') writer.writerows(data) however, when run code continue error says... data = list(csv.reader(infile, dialect=csv.excel_tab)) _csv.error: new-line character seen in unquoted field - need open file in universal-newline mode? i did research , found out .csv files not work on mac. should change file keep working excel sheet? also, if has pointers on how else sort column, appreciate tips. thanks! try opening file mode open('case_name.csv', mode='ru') compare with: https://docs.python.org/2/library/functions.html#open

c - Verify if an undirected graph has cycles -

i know question has been asked times. can't understand yet , questions old reply... i read kahn's algorithm dfs plus tarjan's connected components algorithm can't understand process make work. i've done far initialized , feed graph. , found shortest path vertéx b. a simple dfs little modification do. hint: dfs traversal of given graph. every visited vertex ‘v’, if there adjacent ‘u’ such u visited , u not parent of v, there cycle in graph. also note: cycles detection in undirected graphs follow algorithm totally different directed graphs. cycle in directed graphs diffent. (hope comfortable dfs).

css - Inline width not working in IE when bound with AngularJS -

i created jsfiddle illustrate problem. if have following html: <div id="div1"> <div id="div2">test</div> <div id="div3" style="width:{{progress}}%;"></div> </div> where eg. $scope.progress = 50; , displays width in ff , chrome, in ie, width 100%; try use ng-style: <div id="div3" ng-style="{'width': progress + '%' }"></div>

android - Splachscreen in Fragment -

can explain me how make splash screen in fragment using android studio. want make homefragment appear after splash. information, using navigation drawer in apps. make splashscreen activity. here similar problem resolved: how make splash screen?

iot - I am trying to update data on Thingspeak,but it updates only at once using Edison -

i trying update thingspeak using edison, updates data once. here code: #include <wifi.h> #include <spi.h> // thingspeak settings char thingspeakaddress[] = "api.thingspeak.com"; //ts string writeapikey = "**************"; //ts const int updatethingspeakinterval = 10 * 1000; // time interval in milliseconds update thingspeak (number of seconds * 1000 = interval) char ssid[] = "*******"; // network ssid (name) char pass[] = "********"; // network password int status = wl_idle_status; // wifi radio's status // initialize library instance: wificlient client; string stringval = ""; // variable setup long lastconnectiontime = 0; boolean lastconnected = false; int failedcounter = 0; int a; //char dtostrfbuffer[20]; float tempc; float temp =3; void setup() { //initialize serial , wait port open: serial.begin(115200); while (!serial) { ; // wait serial port connect. needed leonardo