Posts

Showing posts from April, 2015

google search appliance - Retrying URL: Connection reset by peer during fetch -

i'm having trouble 1 of domains google search appliance (version 7.2) crawling. the retrieval error i'm getting is: retrying url: connection reset peer during fetch can tell me can cause such error or have suggestions how solve issue? check if url accessible gsa. there might not network connectivity gsa site. can use "manual fetch request" under content sources > diagnostics > real-time diagnostics, or administration > network settings (at lower level) in admin console debug connectivity issues. ideally in manual fetch request should 200 ok when access url.

c# - How to write a moq test to setup a method to return a count value -

in controller action, whenever new product added check in database product no not present already. code check looks like public actionresult index(productmodel model) { var productcount = _productsservice.getall(true).count(x => x.productnumber == model.productnumber); if (productcount > 0) modelstate.addmodelerror("productnumber", product present in system!"); // more processing } i m new moq testing , trying write unit test setup getall method return 0. have written not seem work var _productsservice = new mock<iproductsservice>(); _productsservice.setup(m => m.getall(true).count()).returns(0); any ideas? thanks this not how use moq -- count not method (it's linq/other 3rd party), don't mock it. need mock getall method, method on mockable dependency. "tell" getall return product model matching parameter, so: [test] public void index_reportsmodelerror_whenproductalreadye

google search appliance - GSA metadata limit? -

we have page metadata field configured in gsa's dynamic configuration. meta value comma-separated , can quite lengthy. it observed whenever meta value length crosses 90 characters, gsa not recognize facet i.e. no <pmt> nodes returned in gsa search response. known restriction? yes, there limitation associated metadata in google search appliance.below url talks limitation. http://www.google.com/support/enterprise/static/gsa/docs/admin/70/gsa_doc_set/xml_reference/request_format.html#1078040 https://support.google.com/gsa/answer/4411411#meta hope helps.

selenium - Is it possible to verify toast in appium, using selendroid mode? -

is possible verify toast in appium, using selendroid mode? if does, can explain how it's done? you can using following code: selendroiddriver.findelementbyid("showtoastbutton").click(); // button shows toast upon clicking webelement toast = testwaiter.waitforelement(by.linktext("hello selendroid toast!"), 3, selendroiddriver); assert.assertnotnull(toast);

protocol buffers - How do we use Python generated protobuf codes in to python code? -

i have installed protobuf in python 3.4 , pushed compiled code pb_x_pb2.py python34 folder. when enter import pb_x_pb2.py shows following error. >>> import pb_interface_pb2 traceback (most recent call last): file "<pyshell#21>", line 1, in <module> import pb_interface_pb2 file "c:\python34\pb_interface_pb2.py", line 5, in <module> google.protobuf import reflection file "c:\python34\lib\site-packages\google\protobuf\reflection.py", line 68, in <module> google.protobuf.internal import python_message file "c:\python34\lib\site-packages\google\protobuf\internal\python_message.py", line 848 except struct.error, e: ^ syntaxerror: invalid syntax protobuf doesn't support python 3.x. imported libraries, try pip install protobuf-py3 , python 3 port of package. can run 2to3.py script pythonxx\tools\scripts folder on generated file. another option downlo

c# - Sharpdx load bitmap fom file Windows 8 apps -

i've found example in sharpdx "bitmapapp" samples: public static bitmap loadfromfile(rendertarget rendertarget, string file) { // loads file using system.drawing.image using (var bitmap = (system.drawing.bitmap)system.drawing.image.fromfile(file)) { var sourcearea = new system.drawing.rectangle(0, 0, bitmap.width, bitmap.height); var bitmapproperties = new bitmapproperties(new pixelformat(format.r8g8b8a8_unorm, alphamode.premultiplied)); var size = new size2(bitmap.width, bitmap.height); // transform pixels bgra rgba int stride = bitmap.width * sizeof(int); using (var tempstream = new datastream(bitmap.height * stride, true, true)) { // lock system.drawing.bitmap var bitmapdata = bitmap.lockbits(sourcearea, imagelockmode.readonly, system.drawing.imaging.pixelformat.format32bpppargb); // convert pixels

sql - Inserting data in another table having different data structure in oracle -

i have table table1 item_code desc month day01 day02 day03 fg0050bcyl0000cd cyl head feb-15 0 204 408 fg00186cyl0000cd power unit feb-15 425 123 202 i want insert data in table table2 table1 in such way. item_code month date quantity fg0050bcyl0000cd feb-15 01-feb-2015 0 fg0050bcyl0000cd feb-15 02-feb-2015 204 fg0050bcyl0000cd feb-15 03-feb-2015 408 fg00186cyl0000cd feb-15 01-feb-2015 425 fg00186cyl0000cd feb-15 02-feb-2015 123 fg00186cyl0000cd feb-15 03-feb-2015 202 please tell me how achieve via pl sql the following should close: begin arow in (select * table1) loop insert table2(item_code, month, "date", quantity) values (arow.item_code, arow.month, to_date(arow.m

Google Search Appliance search in Google Groups -

i want use gsa serve search results google groups. i lot of research in web did not found information gsa , google groups. understood google groups use #! (hashbang) in url , gsa doesn't support crawling ajax applications. i think solutions use integrating google apps method on this, , other similar, article talk google sites , google docs , not google groups. because try solution have involve various departments in company know if used method that. or if give me advices achieve that. since there no api nor existing oob stuff on gsa crawl google groups, best way use google adaptor framework , create on own. should easy tbh.

ios - I am trying to play audio from server using AVAudioPlayer, but file not Playing -

i trying make online audio player. can't paly audio using avaudioplayer object. please me. in advance. here audio player code. ================>> nsurl *url =[[nsurl alloc] initwithstring:@"my url"]; xplayer = [[avaudioplayer alloc] initwithcontentsofurl:url error:nil]; xplayer.numberofloops = 0; xplayer.volume = 1.0f; [xplayer preparetoplay]; [xplayer play]; q: avaudioplayer provide support streaming audio content? a: avaudioplayer class not provide support streaming audio based on http url's. url used initwithcontentsofurl: must file url (file://). is, local path. source: https://developer.apple.com/library/ios/qa/qa1634/_index.html

asp.net web api2 - Get AuthorizeAttribute to work roles with start and expiration date in web api 2 application ? -

i need modify user roles in web api 2 project using identity 2 adding additional properties: datetime startdate , datetime enddate . required able grant users roles limited period of time. what need authorize attribute such [authorize(role="poweruser")] etc. understand role dates? according source ( https://github.com/asp-net-mvc/aspnetwebstack/blob/master/src/system.web.http/authorizeattribute.cs ) filter calls iprincipal.isinrole : protected virtual bool isauthorized(httpactioncontext actioncontext) { ... if (_rolessplit.length > 0 && !_rolessplit.any(user.isinrole)) { return false; } return true; } looks need subclass implementation of iprincipal in httpactioncontext.controllercontext.requestcontext.principal , somehow inject somewhere in life cycle instead of default implementation. how do this? just create custom implementation of of authorizeattribute userauthorize , instead of using [authorize(role

java - Is it possible to have space between cells in iTextPdf? -

Image
does itextpdf allow set spacing between cells in table? i have table 2 columns , trying draw border-bottom on cell. want space between each border same cell padding. i using below code: pdfptable table = new pdfptable(2); table.settotalwidth(95f); table.setwidths(new float[]{0.5f,0.5f}); table.sethorizontalalignment(element.align_center); font fontnormal10 = new font(fontfamily.times_roman, 10, font.normal); pdfpcell cell = new pdfpcell(new phrase("performance", fontnormal10)); cell.setverticalalignment(element.align_middle); cell.sethorizontalalignment(element.align_left); cell.setborder(rectangle.bottom); cell.setpaddingleft(10f); cell.setpaddingright(10f); table.addcell(cell); table.addcell(cell); table.addcell(cell); table.addcell(cell); document.add(table); how do this? you want effect: that explained in my book , more in presspreviews example. you need remove borders first:

java - Swing L&F - Import and implementation -

i built game on java , want make looks better, used default "nimbus" lookandfeel it's not enough. tried install other themes building .jar files class path didn't work times tried showed kinds of messages, maybe i'm doing wrong. grateful if explain me how make work! you can in way. add classpath theme want. search , copy qualified name and, finally, this: try { uimanager.setlookandfeel("javax.swing.plaf.nimbus.nimbuslookandfeel"); //uimanager.setlookandfeel(uimanager.getsystemlookandfeelclassname()); //uimanager.setlookandfeel("set.qualified.name.here"); } catch (classnotfoundexception | instantiationexception | illegalaccessexception | unsupportedlookandfeelexception e) { e.printstacktrace(); }

sql server - conditional formatting for background color using VBA? -

Image
i got vba code populate t-sql query data in excel file. in data, 1 column contains values of red, amber, green , n/a. want background color according values (red, amber, green , white). how can in vba? edited: need this: id firstname lastname complaint 1 paul nixon red 2 john nathon red 3 sera teag amber 4 clare walker green now want background color column 'complaint' according cell value, if cell value red want background color red etc.. in vba code. changing background color of cell simple. determining color change key step here. if know 4 colors options, pound out cases , set colors. if find growing more colors, may want define them in dictionary , lookup instead of select-case construction. this simple code work example. want define range better (probably not "d2:d5") based on real application , tweak colors. sub colorwithtext() dim cell range each cell in range("d2:d5") sel

ios - JTCalendar Objective-C to Swift translation -

i'm having issue here trying translate objective-c codes swift [self.calendar setmenumonthsview:self.calendarmenuview]; [self.calendar setcontentview:self.calendarcontentview]; [self.calendar setdatasource:self]; i downloaded https://github.com/jonathantribouharet/jtcalendar , trying translate viewcontroller.m codes. i've tried self.calendar = self.calendarmenuview.setmenumonthsview doesn't work. please help. i'm using jtcalendar in swift. code is self.calendar.menumonthsview = self.calendarmenuview self.calendar.contentview = self.calendarcontentview self.calendar.datasource = self

html - Trying to get my website to fit all resolutions -

okay trying website fit resolutions or screen sizes because working on 17" 1920x1080 screen size , website looks fine when try run on 10" or 15" screen etc website screws up, content goes everywhere (mainly drops down) wondering how can fixed? thanks first of should use percentage values (e.g. width:20%; instead of width:200px; ) whenever can, don't rely on absolute pixel resolutions (which screw whole design/layout). for other things , tuning should take onto css media query (e.g. w3schools ): @media screen , (min-width:1024px) { /* ... */ }

c# - How to update client endpoint binding in code -

i have question modifying client endpoint binding in code. have added web service reference , created client endpoint binding it. in web.config binding set basic https, want change ex. http, have specified in web.config under name "basichttpbinding". when create instance of web service reference, there no way of using address , binding there not constructor takes such arguments. <endpoint address="http://localhost/localservice/sendrequest.asmx" binding="basichttpsbinding" bindingconfiguration="basichttpsbinding" contract="localservice.sendrequest" name="localserviceclient" /> any advice how solve problem appreciated. cheers! var binding = new system.servicemodel.basichttpbinding() { name = "localserviceclient", namespace = "localservice.sendrequest" }; var endpoint = new system.servicemodel.endpointaddress("http://localhost/localservice/sendrequest.asmx"); var cl

javascript - AJAX Search on 2 Elements -

i working on project using classic asp (not idea) , ajax uses access database pull data from. have following form: <form action="" id="autocomplete-search"> <div class="simplesearch"> <label for="intesearch">start typing name</label> <input type="text" onkeyup="showcustomer(this.value)" id="intesearch" onfocus="disable_submit()"> </div> the javascript have @ top of page following: function showcustomer(str) { // remove white space name entered on search screen str = str.replace(" ", ""); var xmlhttp; if (str=="") { document.getelementbyid("txthint").innerhtml="no records found"; return; } if (window.xmlhttprequest) {// code ie7+, firefox, chrome, opera, safari xmlhttp=new xmlhttprequest(); } else {// code ie6, ie5 xmlhttp=new activexobject("microsoft.xmlhttp"); } xmlhttp.onreadystatechange=f

r - Combine information from hi-resolution time series with another with daily information -

i have measurement data - - 1 minute resolution, irregular. timeseries time signal 1 2015-03-30 00:00:00 17.3 2 2015-03-30 00:01:00 16.2 3 2015-03-30 00:02:01 18.4 4 2015-03-30 00:04:03 17.7 in second data frame, have daily information. dailyinfo firstevent yesterday 1 2015-03-28 17:01:43 2015-03-27 15:25:51 2 2015-03-29 17:04:55 2015-03-28 17:01:43 3 2015-03-30 16:59:03 2015-03-29 17:04:55 the dailyinfo$firstevent boundaries. want like timeseries %>% group_by(between(time, dailyinfo$yesterday, dailyinfo$firstevent)) in tutorials, information present within 1 data frame (e.g. iris %>% group_by(species) %>% ... ). my workaround count number of rows between each set of boundaries, replicate firstevent -entry often, concatenate , put resulting vector timeseries new column. this not elegant, maybe can me how use dplyr this? use cut timeseries %>% mutate(interval = cut(time, dailyinfo$firstevent)) %>%

sql - Return unique rows based on minimum id in mysql -

i've stuck on this: need guid based on minimum id , remove other duplicates (guid, id). id unique field here. +-----------------------------+------+-------------+ | guid | id | post_parent | +-----------------------------+------+-------------+ | 5.jpg | 7626 | 2418 | | 3.jpg | 7625 | 2418 | | 2.jpg | 5972 | 2418 | | 2.jpg | 3000 | 2420 | | 0.jpg | 3205 | 2420 | | 9.jpg | 9205 | 2419 | +-----------------------------+------+-------------+ so want: +-----------------------------+------+-------------+ | guid | id | post_parent | +-----------------------------+------+-------------+ | 2.jpg | 5972 | 2418 | | 2.jpg | 3000 | 2420 | | 9.jpg | 9205 | 2419 | +---------------

c - split serial output in kernel space -

i developing code on openwrt router , receive data on serial port /dev/ttys0 . data receive different sources , parsed different user space applications. i split data n serial virtual ports n=number of information sources (a source temperature sensor, source sensor etc). so have /dev/ttys0 main serial device , /dev/ttys1 , /dev/ttys2 ... /dev/ttysn , each serial output data 1 information source. i guess have basic data parsing @ kernel level. know source example similar ? data going in 1 direction ... sensors router, don't need send simplify things. i'm opened sugestions

r - Obtain combined standard errors of main and interaction term -

how combined standard error of main , interaction term? in model1 wish combined estimates progacademic , progacademic:math. i have provided sample data below: df <- read.csv("http://www.ats.ucla.edu/stat/data/poisson_sim.csv") df <- within(df, { prog <- factor(prog, levels=1:3, labels=c("general", "academic", "vocational")) id <- factor(id) }) mdel1 <- glm(num_awards ~ prog + math + prog*math, family="poisson", data=df)

ruby - How can I test logger-messages with MiniTest? -

i have application , want test if correct messages logger. a short example (you may switch between log4r , logger): gem 'minitest' require 'minitest/autorun' require 'log4r' #~ require 'logger' class testlog < minitest::test def setup if defined? log4r @log = log4r::logger.new('log') @log.outputters << log4r::stdoutoutputter.new('stdout', :level => log4r::info) else @log = logger.new(stdout) @log.level = logger::info end end def test_silent assert_silent{ @log.debug("hello world") } assert_output(nil,nil){ @log.debug("hello world") } end def test_output #~ refute_silent{ @log.info("hello") }#-> nomethoderror: undefined method `refute_silent' assert_output("info log: hello world\n",''){ @log.info("hello world") } end end but get: 1) failure: testlog#test_output [minitest_log4r

handlebars.js - Handlebars templatig: Difference between empty list and list not given -

i creating summary emails recent activities can configured recipient. using mandrill handlebars templating syntax , {{#each objects}} passing in objects . that works fine. , can use {{else}} display message when list empty. (that event hasn't happened in referenced period of time) but want give user option never see summary particular kind of event (no matter whether exist or not). tried using {{#if objects}} , not adding parameter user. results in entire block not showing when list empty. in case want "no recent activity in category" has been working fine far. tl;dr: how differentiate between parameter not given , empty list given handlebars.

ios - Implementing collision detections -

basically game consists of basket player moves across screen, aim of game player catch balls falling top of screen. trying add collision detection between balls , basket, facing difficulties namely, implementing collision detection. new swift, sprite kit , app development, please help. appreciated. problem facing balls falling in centre of screen. line of code supposed execute when, ball hits basket , following ball should disappear, please new spritekit. import spritekit class gamescene: skscene { var basket = skspritenode() let actionmoveright = skaction.movebyx(50, y: 0, duration: 0.2) let actionmoveleft = skaction.movebyx(-50, y: 0, duration: 0.2) //let physicsbody = skphysicsbody(texture: , size: 3500) override func didmovetoview(view: skview) { /* setup scene here */ self.physicsworld.gravity = cgvectormake(0.0, -0.5) self.backgroundcolor = skcolor.whitecolor() basket = skspritenode(imagenamed: "basket") basket.setscale(0.5) basket.pos

algorithm - GNU Simulated Annealing -

i'm working template program given here: https://www.gnu.org/software/gsl/manual/html_node/trivial-example.html the program give compiles , runs perfectly, nice. generalise method find minimum of function arbitrary number of parameters. some cursory reading suggests metric function (m1) used in diagnostic , printing situations , can more or less ignored. remains define e1 , s1 appropriately. unfortunately knowledge of using pointers , void incomplete, i'm stuck trying upgrade configuration 'xp' array of parameters, rather single double. in naivete tried moving double x = *((double *) xp); to double x = (*((double *) xp))[0]; where appropriate, didn't work. i'm sure i'm missing stupid, hints nice! defining own e1 output function take these n parameters , return number. the underlying algorithm, gsl_siman_solve() link provided, generalized work data type. why ubiquitous xp parameter being cast double pointer before use. should

java - Why we use a flag to stop a thread? -

when tried figure out how stop thread in program multiple threads, suggested call method sets flag tell thread stop doing real works,like this: public class threadtobeterminated implements runnable { private static final logger logger = loggerfactory.getlogger(indexprocessor.class); private volatile boolean running = true; public void terminate() { running = false; } @override public void run() { while (running) { try { logger.debug("doing real work ,like counting..."); for(int i=0;i<100;i++){} } catch (interruptedexception e) { logger.error("exception", e); running = false; } } } } when want stop tread ,i'll call threadinstance.terminate(); . don't need literally stop thread ? why should leave thread useless work (method run called ,test flag running==false return)? mean : this waste

c# - Parse for Universal Apps -

i'm trying implement parse push notification on windows phone 8.1 (windows runtime app) searching around found need download sdk parse website , add reference parse.dll , parse.winrt manualy. i'm able use library, when try subscribe channel after while throws exception. i'm not able find proper tutorial :( anyway line of code reise exception: parsepush.subscribeasync("testchannel"); and stacktrace: at system.threading.tasks.task.throwifexceptional(boolean includetaskcanceledexceptions) @ system.threading.tasks.task 1.getresultcore(boolean waitcompletionnotification) @ system.threading.tasks.task 1.get_result() @ parse.parseinstallation.b__d(task 1 t) @ system.threading.tasks.continuationtaskfromresulttask 1.innerinvoke() @ system.threading.tasks.task.execute() --- end of stack trace previous location exception thrown --- @ system.runtime.compilerservices.taskawaiter.throwfornonsuccess(task task) @ system.runtime.compilerservi

java - OptimisticLockException Ebean even with @Version -

i tried update row in db using ebean in play! framework program. here class of entity update. transaction.java @entity @table(name = "transactions") public class transaction extends model{ @id @generatedvalue public int id; @onetoone @joincolumn(name = "car_fk") public car car; @onetoone @joincolumn(name = "user_lender_fk") public user user; @version public timestamp from_date; @version public timestamp to_date; public boolean availability; // true -> available. public string status; } and here metho use update it: transaction transaction = new transaction(); transaction.car = concernedcars.get(i); transaction.user = currentuser; transaction.from_date = tools.stringandroidtotimestamp(datefrom); transaction.to_date = tools.stringandroidtotimestamp(dateto); transaction.status = constants.waiting_for_answer; try{ ebean.update(transaction); }ca

arm64 - ARMv8 exception vector significance of EL0_SP -

i new armv8 architecture , while reading v8 exception vectors not able understand significance of adding sp_el0 level vectors while sp_elx vector set exists. trying find use case useful. understand when exception taken @ same level default stack of same exception level used example if el2 (hyp) mode defined if exception occurs while being @ el2 level stack defined @ el2 used not sure if configure use el0 level stack under use cases useful ? can 1 give use case , explain ? also while going through spec seems these 2 different stack usage idea taken cortex-m architecture not clear thread , handler modes well. can 1 explain ? just wanted add here armv7 doesn't have thread , handler concept not clear requirement in armv8. thanks sp_el0 "normal" stack pointer. code runs in el should running on sp_el0 whenever can. sp_el1/2/3 "exception" stack pointer mode. when exception, fault, or interrupt happens, processor switches stack (and possibly switc

Python Pandas - Logical indexing dataframe with multiple indexes based on single index -

i'm still pretty new pandas i've searched around quite bit , can't quite find i'm looking for. so here problem: i have 2 dataframe - 1 mutliple indexes , 1 index df1= value1 value2 ind1 ind2 1 1.1 7.1 b 2 2.0 8.0 c 3 3.0 9.0 4 4.0 10.0 b 5 5.0 11.0 c 6 6.0 12.0 df2= value1 value2 ind1 8.0 7.0 b 9.0 8.0 c 3.0 9.0 d 11.0 10.0 e 12.0 11.0 f 1.0 12.0 i index data df1 based on df2 value1 > value2 . df2['value1'] > df2['value2'] i know can data df2 with df2.loc[df2['value1'] > df2['value2']] but how data df1? tried: df1.loc[df2['value1'] > df2['value2']] but fails with *** indexingerror: unalignable boolean series key provided any suggestions appreciated, thank you!

java - Open a Treeview as a new Tab in eclipse via. plugin -

i have tried find answere myself, didn't one... i need open treeview creat dynamicly via. eclips-plugin, embetet tab in eclipse editor. atm. open treeview in new window, creating jframe. my thoughts are, need creat treeview in jpanel , link eclipse ide? don't find how that.

networking - what messages could be delivered to socket that is only used for sending -

in our application have udp socket(s) used send packets (these sockets never read, , never bound port). sockets "connected" destination address. there messages icmp etc conceivably directed @ these ports , delivered receive buffers of these sockets? if types of messages occur? (these sockets never read, , never bound port). they bound port when call connect() if not bound. are there messages icmp etc conceivably directed @ these ports yes. icmp unreachable start. and delivered receive buffers of these sockets? no. icmp unreachable cause exception next time use socket. if types of messages occur? none. if getting data in socket send buffer, sending udp datagrams. in fact connect target sending udp datagrams.

c - Stirling approximation producing a different output than expected -

so new c , learning syntax. have come across problem though. trying prove stirlings approximation where ln (n!) = n ln (n) - (n) so when make print statements within code test whether each element of array producing output of array number want be. it's far it. #include <stdio.h> #include <stdlib.h> #include <math.h> double * natural_log (); /* obtain natural log of 0 100 , store each value in array */ double * approximation (); /* use sterling approximation caluculate numbers 0 - 100 , store in array */ double * difference (); /* calculate difference between arrays */ double * percentage (); /* calculate percentage of difference , return array */ int main () { natural_log (); /* approximation (); */ return 0; } double * natural_log () { static double natural_array[101]; /* set array */ int i; /* set integer increase array value */ natural_array[0] = 0.0; /* set first value in array */ natural_array[1] = log(2); dou

netty - Interrupting an HTTP session with a forbidden error -

in netty server application receive httprequest must processed if cookie particular content present , valid (a kind of authentication). in pipeline have following objects: httprequestdecoder mycookiehandler myrequesthandler what want that, if cookie not present or not valid, no further elaboration occurs , forbidden error returned. this i've done inside 'mycookiehandler' : public void channelread(channelhandlercontext ctx, object msg) throws exception { ... if (!isvalid(cookie)) { ctx.writeandflush( new defaultfullhttpresponse(http_1_1, forbidden)) .addlistener(channelfuturelistener.close); return; } } however, 'writeandflush' called client receives error 'empty reply server'. what's wrong in code? thanks, massimiliano i found error. adding future listener channelfuture returned writeandflush , discovered problem httpresponseencoder needed pipeline encode answer bytebuf . so, solve problem, cha

python - Using show() with twill spams the console with HTML -

i've been using fuction twill.commands.show() raw html page. run every 5 seconds. every time function ran, spams console mentioned webpages raw html. need use console debugging, , since console filled html constantly, doing impossible. since show() programmed print html , return string, have edit twill, way beyond skillset, , makes program incompatible on other devices. although saving , reading file on , on might work, seems impractical every 5 seconds. code: go('http://google.com/') html=show() again, twill has save_html , used save file, i'm doing every 5 seconds , slow program/computer, if it's being run on older os. thanks! twill writes stdout default. you can use twill.set_output(fp) redirecting standard output. there're several possible implementations doing this: write stringio : from stringio import stringio sio = stringio() twill.set_output(sio) html = show() # html+'\n' == sio.getvalue() or /dev/null : impor

google app engine - How to write app.yaml for vast php project? -

i have ready php website. website writing app.yaml google app engine. read many answers doesnt me. facing problem php files under various subfolders in libraries folder. in index.php , accept rss feed url , process full text feed calling other php files. getting error. /makefulltextfeed.php?url=https%3a%2f%2fnews.google.co.in%2fnews%3fpz%max =10&links=preserve&exc=&submit=create+feed not found on server. how write app.yaml php files comes under various sub-folders?? have write handlers: individual php files?? stuck here whole day. new topic. if find stupid question please forgive me. here app.yaml application: xxxx-xxxx-90212 version: alpha-001 runtime: php api_version: 1 handlers: - url: / script: index.php - url: /config script: config.php - url: /makefulltextfeed script: makefulltextfeed.php - url: /css static_dir: css - url: /js static_dir: css - url: /images static_dir: images i have php files in subfolder. how write app.yaml that.

sql server - Convert varchar dd-mmm-yyyy to dd/mm/yyyy then order by not working? -

i have situation i need convert varchar value dd-mmm-yyyy dd/mm/yyyy order above converted date using convert(varchar(10), cast([date] datetime), 103) modifieddate i got required format but, when order modifieddate order result set showing 2013, 2014, 2015 years mixed match. think doing order date. doing wrong? can help? since modifieddate varchar, ordering lexical ( 01/01/1900 < 01/01/1901 < 02/01/1900 ). the solution not use varchar sorting. convert varchar-date real date (i.e., cast([date] datetime) without outer convert ) , sort expression.

node.js - Serialize query parameters to a filename -

i'd map api request 1::1 file name. this means, among other things, serializing query params safe filename, ideally on both windows , *nix. if api request this: api/eggs/fresh?search=brown&order=asc then filename might be: api/eggs/fresh?search=brown&order=asc.json but ? char , maybe & unsafe, have encode them think. the serialization must bi-directionally deterministic. have able data out. converting illegal characters _ , example, wouldn't meet criteria. is right method querystring.encode ? encoding urls might work if % file system safe. how url encode in node.js? ? or there better suited file system? i'm following process: get folder + resource name get array of params in request alphabetize params (so order doesn't matter) join params & (i think safe in modern file systems) concat folder/resource + __&__ + paramstring + .json this fails if uses __&__ part of actual query, think that's unlikel

excel - How can I limit the number of loops in a Do While loop? -

so i've written function that uses text-box inputs search corresponding values in sheet. problem if doesn't find match goes infinite loop. can limit loops doesn't crash? if there solution rather limiting loops, i'm ears. here's i'm working with: function most_recent_deployment(label1 string, label2 string, label3 string) long dim all_rows range dim row range dim lastcell range dim lastcellrownumber long set lastcell = sheet7.cells(sheet7.rows.count, "a").end(xldown).end(xlup) lastcellrownumber = lastcell.row + 1 set row = sheet7.range("a:a").find(label1, lookin:=xlvalues, after:=cells(lastcellrownumber, "a"), searchdirection:=xlprevious) while row.row > 1 if (sheet7.cells(row.row, 2).text = label2) , (sheet7.cells(row.row, 3).text = label3) most_recent_deployment = row.row exit function end if lastcellrownumber = row.row set row = sheet

How do I set non-fixed dimensions on an angular ui grid? -

i found how turn off scrolling doesn't make rows show flat table of data. $scope.gridoptions.enablehorizontalscrollbar = uigridconstants.scrollbars.never; $scope.gridoptions.enableverticalscrollbar = uigridconstants.scrollbars.never; is there way use ng-grid inline-block element takes size of children regardless of how tall or wide are?

ios - Setting other font than system in WatchKit (Apple Watch) -

i have 1 apple watch app using menlo bold font label. in first version of xcode supported watchkit able change font of label in storyboard menlo bold 36 , working fine. in curent version (xcode 6.2) not possible more, found tutorial on how set custom font in apple watch, http://www.tech-recipes.com/rx/53710/how-do-i-use-custom-fonts-in-my-apple-watch-app/ i tutorial found code: func printfonts() { let fontfamilynames = uifont.familynames() familyname in fontfamilynames { println("------------------------------") println("font family name = [\(familyname)]") let names = uifont.fontnamesforfamilyname(familyname string) println("font names = [\(names)]") } } this code print available fonts. used see why name of font have added. at stage have not added custom font, run function see font available on apple watch default. after running found: /* lot of fonts before */ -------------------------

shell - Create a command line script -

i'm using web tool has inbound webhooks. provide me url, can post string , logs system. i create script me , team can use terminal this: ~: appname ~: webhook url? here can copy , paste url gives me, , stores it. can this: ~: appname message want send... and sends post webhook string. ideally can share non-techies , that's easy set up. , have no idea how start this. i assuming want strictly shell. in end want use curl (bash) curl --data "msg=$2" $url the $url variable come flat file(app.txt) key value key=appname you first script need append file(app.txt) echo $1 $2 >> app.txt

ios - Is there any way to disable the Touch ID prompt (UIAlertview)? -

Image
trying integrate touchid in application, , successful too. the question can customize default touchid uialertview ? can disable it? no, cannot. popeye said in comment, system controls prompt, not app – request system display you. due obvious security concerns. for example, if initiated $100 in-app purchase, changed prompt say, "place thumb on home button start game!" not go on well.

How to declare an array in a function and call the function in C -

i have assignment , cannot figure out part. the assignment requires create 2 separate functions , call them in main. question syntax calling pointer array , how call function in main program? example, int function_1(int x, *array); how call function_1 ? or lost here? i should add anytime try , call function array, error: [warning] assignment makes pointer integer without cast [enabled default] int function(int x, char *array) { //do work return 0; } and in main int main() { char arr[5] = {'a', 'b', 'c', 'd'}; int x = 5; function(x, &arr[0]); return 0; }

excel - VBA ComboBox not displaying values -

this question has answer here: my combobox doesn't display values i've added in vba 2 answers trying use comobobox vba , displays 1 empty row when click on down arrow. have never used combobox before , still beginner vba. private sub comboboxt_change() comboboxt.additem "apple" comboboxt.additem "orange" comboboxt.additem "banana" end sub like saagar said, way code written, add items combobox if there change in combobox. code use this: private sub userformname_activate() comboboxt.additem "apple" comboboxt.additem "orange" comboboxt.additem "banana" end sub the easiest way achieve in user form creator, double click on userform frame. should show code working with, top dropdown bars (the first 1 might either "userform" or "general") can select

python 2.7 - Why this dynamodb query failed with 'Requested resource not found'? -

Image
i have doubled checked item exists in dynamodb table. id default hash key. i want retrieve content using main function in code: import boto.dynamodb2 boto.dynamodb2 import table table='doc' region='us-west-2' aws_access_key_id='yyy' aws_secret_access_key='xxx' def get_db_conn(): return boto.dynamodb2.connect_to_region( region, aws_access_key_id=aws_access_key_id, aws_secret_access_key=aws_secret_access_key) def get_table(): return table.table(table, get_db_conn()) def main(): tbl = get_table() doc = tbl.get_item(id='4d7a73b6-2121-46c8-8fc2-54cd4ceb2a30') print doc.keys() however exception instead: file "scripts/support/find_doc.py", line 31, in <module> main() file "scripts/support/find_doc.py", line 33, in main doc = tbl.get_item(id='4d7a73b6-2121-46c8-8fc2-54cd4ceb2a30') file "/users/antkong/project-ve/lib/python2.7/site-packag

java - Having trouble recursively calling my algorithm -

i'm writing divide , conquer algorithm i'm having trouble recursively calling it. says cannot find symbol method multiply , variables m, e, m public class multiply { private static int randomint(int size) { int maxval = (1 << size) - 1; return (int)(math.random()*maxval); } public static int[] naive(int size, int x, int y) { int[] result = new int[3]; if (size == 1) { result[0] = x*y; } else { int m = size/2; int = x/2; int b = x % (int)math.pow(2,m); int c = y / (int)math.pow(2,m); int d = y % (int)math.pow(2,m); int e = multiply(a,c,m); int f = multiply(b,d,m); int g = multiply(b,c,m); int h = multiply(a,d,m); } return ((int)math.pow(2,2*m)*e) + ((int)math.pow(2,m)*(g+h)) + f; } try multiply.naive(x,y,z) instead of multiply(x,y,z)

php - Merging combining arrays if certain key/values matches in an array -

let's have array looks this: array ( [0] => array ( [id] => 44091 [epid] => 109912002 [makes] => honda [models] => civic [years] => 2000 [trims] => [engines] => 1.6l 1590cc 97cu. in. l4 gas sohc naturally aspirated [notes] => ) [1] => array ( [id] => 77532 [epid] => 83253884 [makes] => honda [models] => civic [years] => 2000 [trims] => [engines] => 1.6l 1595cc l4 gas dohc naturally aspirated [notes] => ) [2] => array ( [id] => 151086 [epid] => 109956658 [makes] => honda [models] => civic [years] => 1999 [trims] => [engines] => 1.6l 1590cc 97cu. in. l4 gas sohc naturally asp

php - Simple Ajax filter not returning results -

i trying implement simple filter of data stored in mysql database through drop-down menu using code w3 schools website (please bear in mind new javascript!). ajax script returns no results. appreciated. ajax.html <html> <head> <script> function showuser(str) { if (str == "") { document.getelementbyid("txthint").innerhtml = ""; return; } else { if (window.xmlhttprequest) { // code ie7+, firefox, chrome, opera, safari xmlhttp = new xmlhttprequest(); } else { // code ie6, ie5 xmlhttp = new activexobject("microsoft.xmlhttp"); } xmlhttp.onreadystatechange = function() { if (xmlhttp.readystate == 4 && xmlhttp.status == 200) { document.getelementbyid("txthint").innerhtml = xmlhttp.responsetext; } } xmlhttp.open("get","getuser.php?q=&q

Creating Android LIbrary Project Jar Using gradle with dependencies -

i'm trying build .jar file out of android library project (non-executable) using gradle dependencies, i'm getting noclassdeffounderror because accessing 1 of files dependency modules. so far i've tried fatjar method includes in jar file except dependant libraries. what should do? update my gradle.build file apply plugin: 'android' android { compilesdkversion 22 buildtoolsversion "21.1.2" defaultconfig { applicationid "com.myapplication" minsdkversion 9 targetsdkversion 22 versioncode 1 versionname "1.0" } buildtypes { release { runproguard false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } sourcesets { main { java { srcdir 'src/main/java&#

angularjs - Angular JS Action on ng-change the select dropdown -

i have simple table 3 rows , 2 values each row - date , state: <tbody> <tr> <td>red</td> <td class="lastmodified">{{item.reddate}}</td> <td class="status"> <select id ="red" class="form-control" ng-change="update();" ng-model="item.redstatus"> <option value="" disabled="" selected="" class="ng-binding">please select value</option> <option ng-selected="step.value === item.redstatus" ng-repeat="(key, step) in steps">{{ step.title }}</option> </select> </td> </tr> <tr>green</tr> <tr> .... </tr> </tbody> so, simple date , status values red, green , blue. 1 in dropdown - status, second - output date. on change select value -

javascript - $rootScope is not defined -

i'm trying use cookie value in multiple places , within multiple controllers error saying $rootscope not defined here's code: capapp.controller('cookiectrl', ['$scope','$cookies', function($scope, $rootscope, $cookies) { // set variable nav $rootscope.cookieset = $cookies.user_id; }]); capapp.controller('maincontroller', function($scope, $location) { $scope.user_id = $rootscope.cookieset; // set global var }); is there better way this? want cookie value available site wide you missed add $rootscope dependency in both controllers code capapp.controller('cookiectrl', ['$scope','$rootscope', '$cookies', function($scope, $rootscope, $cookies) { // set variable nav $rootscope.cookieset = $cookies.user_id; }]); capapp.controller('maincontroller', ['$scope', '$location', '$rootscope', function($scope, $location, $rootscope) { $scope.user_id =

jquery - How to force user to input value in javascript prompt? -

i have jquery code, open prompt box. problem whether user inputs value in or not, still proceeds code if user click ok. there anyway force user input value in, click ok else can not click ok button. here tried did not work. $(function() { $(".adminapprovepost").click(function(){ var id = $(this).attr("id"); var tag = prompt("you must enter 1 keyword approve post"); if(tag!=null) { $.ajax({ type: "post", url: "/admin/admin-approve-post.php", data: {id:id,tag:tag}, success: function(){ } }); $(this).parents(".postrecord").animate({ backgroundcolor: "#fbc7c7" }, "fast") .animate({ opacity: "hide" }, "slow"); } return false; }); }); it should work this: $(function() { $(".adminapprovepost").click(function(){ var id = $(this).attr("id"); var proceed = true; while(proceed) { tag = prompt("you m

java - Getting the coordinates of the panel -

using mouseevents, able x , y coordinates of frame, yet unable x , y coordinates of panel. below codes me getting x , y coordinates of frame. public void mousemoved(mouseevent e) { x = e.getx(); y = e.gety(); text = integer.tostring(x) +","+integer.tostring(y); frame.frame.repaint(); } the below codes me trying x , y coordinates of panel, it's painting out 0's instead. paint.paint name of jpanel. don't know i'm doing wrong. please if can. public void mousemoved(mouseevent e) { x = paint.paint.getx(); y = paint.paint.gety(); text = integer.tostring(x) +","+integer.tostring(y); frame.frame.repaint(); } if understand right, mouselistener registered jframe, , wish x/y relative jpanel contained within jframe. x , y within mouseevent refer component in mouselistener registered. if have mouselistener registered on parent container, , coordinates of mouseevent relative child component, can using swinguti

Extract parent and child node from python tree -

i using nltk's tree data structure.below sample nltk.tree. (s (s (advp (rb recently)) (np (nn someone)) (vp (vbd mentioned) (np (dt the) (nn word) (nn malaria)) (pp (to to) (np (prp me))))) (, ,) (cc and) (in so) (s (np (np (cd one) (jj whole) (nn flood)) (pp (in of) (np (nns memories)))) (vp (vbd came) (s (vp (vbg pouring) (advp (rb back)))))) (. .)) i not aware of nltk.tree datastructure. want extract parent , super parent node every leaf node e.g. 'recently' want (advp, rb), , 'someone' (np, nn)this final outcome want.earlier answer used eval() function want avoid. [('advp', 'rb'), ('np', 'nn'), ('vp', 'vbd'), ('np', 'dt'), ('np', 'nn'), ('np', 'nn'), ('pp', 'to'), ('np', 'prp'), ('s', 'cc'), ('s', 'in'), ('np', 'cd'),

youtube api - What happens to the api calls that v2 comments require during the grace period? -

another thread here mentions youtube api v2 turned off april 21st , comments functionality left on grace period. some of client libraries require parts of v2 api turned off comments. example in .net library need pass v2 video object video comments. v2 video object there separate video api call. happen these required api calls during grace period? var v2video = _request.retrieve<video>(uri) _request.getcomments(v2video) you should migrate other requests v3. can use videos.list call that, use v2 request comments. in general need video id getcomment method. can recreate resource knowing id.

Excel 2007 VBA: Event refires after the same event procedure ends -

private sub workbook_sheetchange(byval sh object, byval source range) application.enableevents = false ' code application.enableevents = true end sub the "some code" used trap when user has pasted value in cell. if paste came after copy operation procedures works correctly. if paste value came after cut operation after execution reaches end sub procedures starts again , cannot determine change occuring cause refire. the source , destination cells formatted data validation. try , can see first event fired range cut, , second paste destination. private sub workbook_sheetchange(byval sh object, byval source range) application.enableevents = false debug.print sh.name, source.address() application.enableevents = true end sub

How to use excel formula to highlight 3 closest values from range -

1) 0.218967921 2) 0.02111355 3) 0.145493415 4) 0.151092791 5) 0.15407891 6) 0.178046392 7) 0.11408411 i need highlight number 0.145493415 ,0.151092791,0.15407891 (column 3,4,5) closest in list. assuming have unsorted data in a1:a7 without duplicates, , "3 closest values" difference between smallest , largest (of three) smallest difference of any 3 values in range, can use formula in conditional formatting =abs(rank(a1,a$1:a$7)-match(min(large(a$1:a$7,row(indirect("1:"&count(a$1:a$7)-2)))-large(a$1:a$7,row(indirect("1:"&count(a$1:a$7)-2))+2)),large(a$1:a$7,row(indirect("1:"&count(a$1:a$7)-2)))-large(a$1:a$7,row(indirect("1:"&count(a$1:a$7)-2))+2),0)-1)<=1 it's rather complex can equally applied sized list of values, containing blanks or text values in range if there's more 1 set of 3 same "spreadover" formula highlights largest set of values. se

android - Listview scrolling bug on 5.1 -

just noticed weird bug in listview, seems reproducible 5.1, , wonder how nobody brought (couldn't find related). pretty easy reproduce : find listview enough items (100 +) , scroll somewhere 3/4 of list , scroll fast (2-3 long flings) , you'll notice listview scroll way bottom! p.s don't try blame on code since managed reproduce on contacts/fb/google io/whatsapp... now imo pretty severe bug, , find workaround/fix asap, got 1 ? update : listview.java hasn't changed sdk21, abslistview.java did. you may use recycler view instead of list view may no longer supported google. try slidenerd videos on youtube. it. hope helps.

http - Mirror WebSite download specific file type with BASH -

i trying archive collections several websites. want able maintain them sort of organization. ideal store them in mirrored dir structure. below attempt wget -m -x -e robots=off --no-parent --accept "*.ext" http://example.com while using "-m" option have limit on how far goes? (will wander off the web-site? go forever?) if so, better use wget -r -x -e robots=off --no-parent --accept "*.ext" --level 2 http://example.com is reasonable way this? know "wget" has --spider option, stable? edit this solution have found. the files looking tagged , stored in single dir on server side. when trying variations of wget . able structure of links , various files kept having trouble links running in loops. came work around. works slow. advice on how increase efficiency? the structure of website & files trying get home ├──foo │ ├──paul.mp3 │ ├──saul.mp3 │ ├──micheal.mp3 │ ├──ring.mp3 ├──bar ├──nancy.mp3