Posts

Showing posts from January, 2010

jquery - Find the anchor element where the value is equal to the hash in the URL -

how find anchor element name= value equal hash in url, add open class next div element? if(window.location.hash) { var hash = window.location.hash.substring(1); //puts hash in variable, , removes # character console.log(hash); // find anchor element value equal has in url, add '.open' class next div element. $("a[name=$hash]").addclass('open'); //wrong syntax! how write this? } $(function() { if (location.hash === "#hash") { //logic $("#divid").addclass('open'); } });

c - Is it needed to typecast float to double when using math.h? -

i use cosmic c compiler stm8 micro controllers , use float variables. used platform compiler not provide double types. anyway, when 1 uses doubles treated floats. i wonder whether needed typecast float double when using e.g. fabs()? declared double fabs(double x); i haven't found in compiler docs regarding this. but without typecasting, compiles without warnings. way, gcc compiles without warnings when mix double float. numeric promotion whenever value 1 type converted value of larger similar data type, called numeric promotion (or widening, though term reserved integers). example, int can widened long, or float promoted double: 1 2 long l(64); // widen integer 64 long double d(0.12f); // promote float 0.12 double while term “numeric promotion” covers type of promotion, there 2 other terms specific meanings in c++: integral promotion involves conversion of integer types narrower int (which includes bool, char, unsigned char, signed char, unsigned short, sig...

MongoDB positional operator with nested arrays -

sample collection structure: { "_id" : objectid("57cfd62001ca2dd672cfebb1"), "name" : "category", "parent" : objectid("57cfd5d101ca2dd672cfebb0"), "posts" : [ { "name" : "post", "author" : objectid("57cfd09401ca2dd672cfebac"), "content" : "some content.", "comments" : [ { "author" : objectid("57cfd09401ca2dd672cfebab"), "content" : "first comment", "rating" : 2 }, { "author" : objectid("57cfd09401ca2dd672cfebac"), "content" : "second comment", "rating" : 5 } ] } ] } i select comments author objectid("57cfd09401ca2dd672cfebab") . this query ...

jquery - I am getting response from php but not printing in text box -

i have 2 files, 1 html , jquery , other php. getting response php page, not able display in html text box. here code: <script type="text/javascript"> function fill_amt() { var sname=$("#sname").val(); $.post("try_insert.php",{sname:sname,cmd2:"fill_amt"},function(data){ $("#tot_amt").html(data); }); } </script> here html code: <input type="text" id="tot_amt" name="tot_amt"> here php code $sql = mysql_query("select total_fee admission first_name='".$sname."'")or die(mysql_query()); $val=mysql_fetch_row($sql); $tot=$val; echo json_encode($tot); use: $("#tot_amt").val(data); instead of $("#tot_amt").html(data); also format json data correctly.

ios - Can't hear input sound in keyboard swift -

i want hear keyboard input sound in application. i added uidevice.currentdevice().playinputclick() to app delegate i'm still not hearing keyboard sounds. how can enable ? thanks try audioservicesplaysystemsound(1104) instead of uidevice.currentdevice().playinputclick() .

viewport - Dynamically change viewportSize in PhantomJS -

in order have phantomjs create screenshots of page @ different viewport widths, i'd adjust dynamically. not work, though: var system = require('system'); var page = require('webpage').create(); page.viewportsize = { width: 800, height: 600 }; page.open('http://example.com', function (status) { page.render('medium.png'); page.viewportsize = { width: 630, height: 420 }; page.render('small.png'); phantom.exit(); }); when run phantomjs script.js produces 2 identical png files medium.png , small.png @ width of 800px each. expected behaviour have medium.png , small.png @ width of 630px. how can achieved? ps: this answer similar question produces error me. the accepted answer question suggests quite ugly workaround avoid. i think should possible set viewport size , open page again this: var system = require('system'); var page = require('webpage').create(); page.viewportsize = { widt...

How to convert Properties class to JSON Object using JAVA -

can me? how convert below input json object? input : { "details": { "device/0/endpointclientname": "ndm-xx-1", "device/1/endpointclientname": "ndm-xx-2", "energymeter/0/current": "20", "energymeter/0/total": "400", } } output:- { "device": [ {"endpointclientname":"ndm-xx-1" }, {"endpointclientname":"ndm-xx-2" } ], "energymeter": [ {"current":"20", "total":"400"} ] } i have input json object properties class. in input sharing full path. have convert json object. [demo] https://jsfiddle.net/cntchen/vh7kat5a/ var input = { "details": { "device/0/endpointclientname": "ndm-xx-1", "device/1/endpointclientname": "ndm-xx-2", "energymeter/0/current": "20", "energymete...

c# - Importing nested COM references -

in visual studio 2015 if create "class library" c# project , add reference custom com dll (created using vb6), vs automatically add (?) com references vb6 dll depends on . how this? how can statically figure out references are? note -- our vb6 dll uses "early binding", still there no equivalent of imports table com items see in traditional "c" style dll. you adding reference type library . embedded inside dll resource. can see when use file > open > file, select dll, open typelib node. plays exact same role metadata in .net assembly, listing type definitions of exposed interfaces , classes. has binary format, can decompile oleview.exe utility. and has dependency info well, registry helps find such dependent type libraries (hklm\software\wow6432node\classes\typelib key). same role gac plays in .net. com isn't different .net assumes :) first version of clr created com+ group @ microsoft. eliminating registration , dll h...

php - Store URL with wildcards in MySQL and return matches -

i'm writing php router, lookups page's id in database such query select `id` `pages` '/about/test' regexp `url` order `url` from such table id type_id url name lookup 1 0 /about/[^/]* null null 2 1 /about/company null null so gets id 2 on '/about/company' , id 1 on /about/whatever on first row of result i'm looking best way retrieve wildcard values mysql, e.g. id of '/about/[^/]+' entry , 'test' second argument when passing '/about/test' ; , id when passing '/about/company' simply, want variadic number of columns, first column return id , others - wildcard values in right order let me assume have flag specifies if wildcard pattern or simple comparison. if want matches, can do: select `id` `pages` '/about/test' regexp `url` , url_has_wildcard = 0 union select `id` `pages` '/about/test' regexp `url` , url_has_wildcard = 1 , not e...

ubuntu - qt-creator no response after open project -

i'm using parallels desktop on macbook air. install ubuntu 14.04.4, , install qt-creator 4.0.2 (qt 5.7.0). after clean installation, opened qt-creator , new project. after project created, whole qt-creator had no response. if click "edit" tag on left, qt-creator had no response. if click "welcome" tag (the first tag) on left, qt-creator response well. if press "ctrl+r" build , run project, goes well. so can new project , build, , run, cannot see code.

ios - Pull to refresh plugin that works with hiding navigation bar when scroll -

there bug in ios 9 uirefreshcontrol when refresher animating , user switches tabs, refresher freezes when user switches back. trying find pull refresh plugin work along side hiding navigation bar when scrolling up. have searched several places , not find 1 suits. of ones out there have weird behaviour when navigation bar hidden , activity indicator animation stops animating. can recommend one? uirefreshcontrol stuck after switching tabs in uitabbarcontroller here how hide navigation bar self.navigationcontroller?.hidesbarsonswipe = true

spring - Parameter value didn't match expected type while querying with some clause -

@query("select w groupchatheartbeat w w.gender=?1 , w.id in (?2) order heartbeattime desc limit 1") public long findid(string gender,list<long> participants); i want retrieve id of participant available in given list of participant based on gender. m getting below exceptions. severe: servlet.service() servlet [rest] in context path [/app] threw exception [request processing failed; nested exception org.springframework.dao.invaliddataaccessapiusageexception: parameter value element [4027291] did not match expected type [java.lang.long]; nested exception java.lang.illegalargumentexception: parameter value element [4027291] did not match expected type [java.lang.long]] root cause java.lang.illegalargumentexception: parameter value element [4027291] did not match expected type [java.lang.long]

Give access to the Play Store in a WiFi HotSpot -

one of our hotel clients provide free wifi guests hot spot, however, there available few url access them freely (such facebook or website of hotel) , if need more access should log in. we have developed app hotel , 1 of features if open app gives complete access hotel wifi, can navigate page want. therefore, necessary guests can download app through play store without being logged in hotel wifi, guest can download app , access immediately. we have trace of url calls play store search , downloading app , have set hot spot allow access url, however, play store tells have no connection. what url should need enable in our hot spot play store work properly? these routes have enabled: .ggpht.com android.clients.google.com play.google.com thank help. this answer leed in right direction, made trace of play store , open del ip range. give access appstore in wifi hotspot happy coding.

sorting - Does java have underline or direct method to sort files in a directory by name, size, last modified or other OS supported? -

does java have underline or direct method sort files in directory name, size, last modified or other os supported? i search way sort file list using java, answers are: read file list array (or other memory object); sort array (or other object). but want know, java provide apis can invoke system call sort directly? maybe os or underline file system can provider better method? there?

java beginner - cannot find symbol -

Image
this question has answer here: what “cannot find symbol” compilation error mean? 7 answers i beginner in java , trying create program recieves input numbers in terminal, , continuously ask new numbers until 0 entered. after 0 has been entered want program summarize of numbers , plus them together. when try compile program error: heres code: import java.util.scanner; public class sumtall { public static void main(string[] args) { scanner tallscanner = new scanner(system.in); int tall = 0; int tall1; system.out.println("write number:"); tall1 = integer.parseint(tallscanner.nextline()); while(tall1 > 0) { system.out.println("write number:"); tall1 = integer.parseint(tallscanner.nextline()); int tall2 = tall + tall1; } if(tall1 == 0) { ...

java - eclipse refactoring API delete folders -

Image
i writing delete refactoring ( deleteparticipant ) customized eclipse ide. what try archieve following: when user deletes file, deleteparticipant registers , deletes several other files. if causes folders become empty, folders deleted deleteparticipant. if causes parent folders become empty, again, deleted participant. to achieve that, create deleteresourcechange each file , store them in compositechange object returned deleteparticipant . example: problem: the deletion works fine. however, when try undo changes eclipse shows me following error message: 'delete' cannot undone. reason: there not enough information restore 'gen'. as far understand problem, due fact undo logic first checks if reverting of each file possible , complains cannot restore gen folder in not existing services folder. is there way hint eclipse undo nevertheless consistent? question: i found out reverting single delete containing multiple files possible, while...

tibco - Running AppManage raises error -

running path\to\tibco\tra\5.8\bin\appmanage.exe (from tibco distribution) gives following error: failed open properties file : appmanage.tra adjustment failed. how can fix this? running appmanage.exe inside folder path\to\tibco\tra\5.8\bin or adding folder path solves issue.

How to run Linux libraries on Docker on Windows? -

i working on windows , need use libraries, availible linux (tensorflow,caffe). run software on docker. cannot understand docker mechanism clearly, completly lost, when problem. should , how should work? edit: about windows docker hosting capabilities (container on windows host): windows 10 offers docker host capabilities, based on hyper-v, i.e. means of linux-like vms. windows 2016 offers native docker host capabilities (thanks @friism point out below). about windows docker container capabilities (windows in container) : windocks offers .net , sql server support within containers (thanks @paul). on windows 2016, windowsservercore base docker image allows run windows services, see simple example . on windows 10 & hyper-v, nanoserver base docker image allows run windows commands (see here helloworld powershell example). requires windows version of docker daemon , not work on linux docker hosts, see here . original answer: bad news first: docker...

r - RGL: multiple polygon3d that can go through -

i developping shiny application , looking way force polygons drawing. using rgl 3d scatterplot , want able draw polygons between points share same information. my problem that, apparently, if polygon3d (p1) exists, new polygon3d (p2) can't drawn if p2 go through p1. can disable fill parameter, of course, , have segments, in thin lines, each polygons, want make polygons more highlighted, filling them if possible. how can fill or highlight polygons? edit: here 2 screenshots. 1) try in polygon3d option fill = f. here, can see segments delimitate polygons. http://norore.fr/images/stackoverflow/r_polygons3d_fillf.png 2) try in polygon3d option fill = t. here, can see few polygons. lost polygons generate followed error: warning in max(-coeffs[dn, 2]/(coeffs[dn, 1] - coeffs[dn, 2])) : aucun argument pour max ; -inf est renvoyé warning in max(-coeffs[up, 1]/(coeffs[up, 2] - coeffs[up, 1])) : aucun argument pour max ; -inf est renvoyé warning in max(-coeffs[up, 1]/(coe...

c# - ASP Net Core StructureMap HybridLifecycle replacement -

i'm in process of updating library built asp.net mvc 5 use latest asp net core 1.0 using structuremap di. however, i've noticed hybrid lifecycle in structuremap legacy , no longer supported. there replacement lifecycle out there, or way same functionality? for<sessioncontext>() .lifecycleis<hybridlifecycle>() .use<sessioncontext>(); i ended writing own asp net lifecycle class match same functionality of old hybrid lifecycle new asp .net core. public class aspnetcorelifecycle : ilifecycle { private readonly object maplock = new object(); public string description => "asp net core lifecycle object"; private readonly container container; private dictionary<httpcontext, iobjectcache> contextmap = new dictionary<httpcontext, iobjectcache>(); public aspnetcorelifecycle(container cont) { this.container = cont; } public void ejectall(ilifecyclecontext context) { lock (...

html5 - "No provider for RadioControlRegistry" in angular 2 what provider should I add? -

Image
what provider should add in provider component? <div class="radio"> <input let match id="male" type="radio" name="gender" value="true" [(ngmodel)]="ismatching" (click)="ismatching(match.value)" > here's console output: you need add formsmodule imports @ngmodule({ imports: [commonmodule, formsmodule] ... }) class mymodule {}

ios - EXC_BAD_INSTRUCTION on a keyboard action -

Image
this question has answer here: what “fatal error: unexpectedly found nil while unwrapping optional value” mean? 5 answers i have problem: can see in dismisskeyboard function have got error. can explain me error? the problem uitextfield nil . in line 12 have textfield declared there small circle next line number. if have outlet connected correctly circle filled. if change splitt-view (upper right corner - 2 circles) can drag said circle textfield make connection.

tcl - ::itcl::delete throws error "invalid command name" -

i using itcl delete command delete objects , classes. however, tcl interpreter says "invalid command name "delete". here partial code snippet. % itcl::find classes datapath point datapath_point itcl::find objects datapath_point0 datapath_point1 datapath0 % itcl::delete object datapath_point0 invalid command name "delete" thanks, boppu with peter, comments error in code. in 1 of base class, had following code. destrutor { delete object $this } here, delete namespace missing. though add "itcl::delete", endup in error. simple , correct solution should empty destructor. destructor { }

Python Pandas group by function -

Image
i have table uname sid usage 0 ahmad 5 1 ahmad 7 2 ahmad 10 3 ahmad b 2 4 mohamad c 6 5 mohamad c 7 6 mohamad c 9 i want group uname , side, , have usage column = group.max - group.min . if group count 1 return group max the out put should uname sid usage 0 ahmad 5 1 ahmad b 2 2 mohamad c 3 first, use agg grab min , max , , size of each group. multiply min size > 1 . when is, equal min , else 0 . subtract max . d1 = df.groupby(['uname', 'sid']).usage.agg(['min', 'max', 'size']) d1['max'].sub(d1['min'].mul(d1['size'].gt(1))).reset_index(name='usage')

scala - Replacing delegation with cake -

at moment i'm stacking features on class delegation trait backend { def product(id: int): string } class mybackend extends backend { def product(id: int) = "my product" } class loggingbackend(underlying: backend) extends backend { override def product(id: int) = { println(s"get product $id") underlying.product(id) } } class cachingbackend(underlying: backend) extends backend { /* ... */ } is possible replace code this? trait logging { : backend => def product(id: int) = { println(s"get product $id") /* don't know write here */ } } class myloggingbackend extends mybackend logging you need change logging : trait logging extends backend { abstract override def product(id: int) = { println(s"get product $id") super.product(id) } }

python - BeautifulSoup: get some tag from the page -

i have html-code <div class="b-media-cont b-media-cont_relative" data-triggers-container="true"><span class="label">Двигатель:</span> бензин, 1.6 л<br/> <div class="b-triggers b-triggers_theme_dashed-buttons b-triggers_size_s b-triggers_text-notif"><div class="b-triggers__text">110 л.с.</div><div class="b-triggers__item b-triggers__item_notif" data-target="cost" data-target-container="[data-triggers-container]" data-toggle="tax_dropdown"><div class="b-link b-link_dashed">110 л.с.</div></div><div class="b-triggers-hidden-area b-triggers-hidden-area_width_240 b-triggers-hidden-area_close" data-target-bind="cost" style="left: 0px; top: 39px; width: 241px;">Налог на&nbsp;2016&nbsp;год <b>2&nbsp;750&nbsp;руб.</b><br/><br/><span class="gray...

Archer GRC calculation based on date and value list fields -

Image
i have 2 fields need calculate. 1 date field initial data received via data feed, other radio button field values: [] none; [] 6 months; [] 1 year; [] 2 years, [] 3 years; [] permanent. i need calculate date field + radio button add 181 days 6 months, 366 1 year, 731 days 2 years, 1096 days 3 years, , show date december 31, 2099 if date permanent. [date] + [radio button] figured out, needed utilize archers valueof , dateformat correct calculation: if ([radio button] = valueof([radio button],"6 months"), [date] + "181", if ([radio button] = valueof([radio button],"1 year"), [date] + "366", if ([radio button] = valueof([radio button],"2 years"), [date] + "731", if ([radio button] = valueof([radio button],"3 years"), [date] + "1096", if ([radio button] = valueof([radio button],"none"), [date], if ([radio button] = valueof([radio button],"permanent...

c++ - Attempting to create a dynamic array -

i have following piece of code, half on entire code: // declare map elements using enumeration enum entity_labels { empty = 0, wall }; typedef entity_labels entity; // define array of ascii codes use visualising map const int token[2] = { 32, // empty 178 // wall }; // create type aliases console , map array buffers using gui_buffer = char_info[map_height][map_width]; using map_buffer = entity[map_height][map_width]; //declare application subroutines void initconsole(unsigned int, unsigned int); void clearconsole(handle hstdout); word getkey(); void drawmap(map_buffer & rmap); /************************************************************************** * initialise standard output console */ handle hstdout = getstdhandle(std_output_handle); if (hstdout != invalid_handle_value) { clearconsole(hstdout); // set window title setconsoletitle(text("tile map demo")); // set window size small_rect srwindowrect; s...

How can I use Visual studio 2015 to debug an extension for visual studio 15? -

i have extension developed visual studio 2015 i'd start testing visual studio 15. to try , set project launch c:\program files (x86)\microsoft visual studio\vs15preview\common7\ide\devenv.exe instead of c:\program files (x86)\microsoft visual studio 14.0\common7\ide\devenv.exe , keeping command line arguments set /rootsuffix exp . set appropriate install target in manifest: <installationtarget id="microsoft.visualstudio.community" version="[14.0,15.0)" /> <installationtarget version="[14.0,15.0)" id="microsoft.visualstudio.pro" /> <installationtarget version="[14.0,15.0)" id="microsoft.visualstudio.enterprise" /> <installationtarget version="15.0" id="microsoft.visualstudio.enterprise" /> <installationtarget version="15.0" id="microsoft.visualstudio.pro" /> <installationtarget version="15.0" id="microsoft.visualstudio.communit...

python - Anaconda plugin not working on Sublime Text 3 -

i using sublime text 3 portable app , dragged of anaconda files packages directory, i.e. \sublime text build 3114 x64\data\packages\anaconda-1.3.4 . however, keep getting error in console says importerror: no module named 'anaconda-1' . can see anaconda option when right-click anywhere, of commands in anaconda menu greyed out. nothing else, auto-complete, working either. any appreciated. edit: fixed using packagecontrol reinstall anaconda . fixed using packagecontrol reinstall anaconda.

mongodb - Mongoose: sort query results by least occurences of word in array -

i have collection of videos : var videoschema = new mongoose.schema({ url: { type: string, required : true }, orderby: { type: number }, views: [{ type: string }] }); 'orderby' lets me define order in serve videos 'views' list of usernames, have watched video. i want keep users watching again same video until have watched videos in collection. keep names of users have watched video inside 'views'. now query videos using 'sort'. return this.find(videoquery) .skip(offset) .limit(count || 10) // @todo 10 : param .sort({views: {$meta: username}, 'orderby': -1}) .exec(); and error message : can't canonicalize query: badvalue bad sort specification can ? may wrong mongo docs. when specify $meta in sort need include in projectedfieldname. https://docs.mongodb.com/manual/reference/operator/projection/meta/#proj._s_meta so should looks this return this.find(videoquery, { views: { $meta: ...

Internal Server Error due to set_time_limit in PHP -

i'm trying run following php script on shared hosting make run forever: <?php ignore_user_abort(true); set_time_limit(0); include_once("function.php"); while (true) { if (file_exists("stop_test.txt")) { echo "break file exists!"; break; } // something, commenting section, face internal server error too! sleep(30); } exit(); ?> but face "internal server error" after 1 minute. contacted hosting provider , asked them problem , have told me there no problem on server side , these kind of cron-like scripts allowed on shared hosting , suggested me review code. i couldn't figure out why script results in internal server error, problem script? i facing same issue, directly setting ini using ini_set() seems have corrected issue: ini_set('max_execution_time', 0); however, suggested in comments, it's best practice set sane limit (30 seconds or so).

asp.net mvc - What does 'the URL is local' mean? -

i debugging code , there check (in asp.net mvc controller) if (url.islocalurl(returnurl)) so check documentation , says returns value indicates whether url local. but mean, 'the url local'? if hit webserver, when webserver 'the url local' ? in asp.net mvc blog preventing open redirection attacks (c#) can find explanation of why should use it, but, tradition mvc's documentation, it's not explained how works. you can read source presented there though: checks whether url starts / or ~/ , meaning: whether relative url thereby points same domain.

web services - Is it possible to dynamically change the URI that an asp.net core process is listening on? -

i'd have following architecture: a factory web service running time under general uri, /service. a set of specific self-hosted application services, running under specific uri, /service/appa/db1, /service/appa/db2, /service/appb/. application services facades on top of legacy applications, , each application-database pair must in separate process. cannot merge them. there may thousands of combinations of these separate services, don't want kick them off. i'd kick them off on demand. now have client ask factory kick off needed service, , connect it, doesn't work cleanly in load-balanced environment. what factory service listen requests, , automatically kick off application services needed , stop listening portion of uri newly kicked off service listening to. for example, client wants call " http://hostname/service/productapp/myproductdb/products/get/byname " the first call go factory service. kick off application service "productapp-m...

javascript - Using generated Swagger TypeScript Rest Client in Angular2 -

i working on meteor web application using angular 2 , typescript. using rest api, have generated client code swagger codegen. unfortunately there no sample on github , how use rest client. i have angular 2 view component injecting angular 2 service (producttreeservice) , generated api (both marked "@injectable"): @component({ selector: 'panel-product-selection', template, providers: [producttreeservice, userapi], directives: [producttreecomponent] }) export class panelproductselectioncomponent { private categoriesproductstree: collections.linkedlist<categorytreeelement>; private producttreeservice: producttreeservice; private userapi: userapi; constructor(producttreeservice: producttreeservice, userapi: userapi) { this.producttreeservice = producttreeservice; this.userapi = userapi; } ngoninit(): void { //... } } while angular service accessable , working fine, application c...

conv neural network - What does TensorFlow's `conv2d_transpose()` operation do? -

the documentation conv2d_transpose() operation not explain does: the transpose of conv2d. this operation called "deconvolution" after deconvolutional networks , transpose (gradient) of conv2d rather actual deconvolution. i went through paper doc points to, did not help. what operation , examples of why want use it? this best explanation i've seen online how convolution transpose works here . i'll give own short description. applies convolution fractional stride. in other words spacing out input values (with zeroes) apply filter on region that's potentially smaller filter size. as why 1 want use it. can used sort of upsampling learned weights opposed bilinear interpolation or other fixed form of upsampling.

popup - Launch CKFinder in modal overlay from CKEditor -

Image
i've managed integrate ckfinder ckeditor using instructions found on site. however, ckfinder popup appears in new browser window. the ckfinder site demonstrates modal overlays - examples instances of ckfinder embedded in site , not 1 linked ckeditor. how can make sure ckfinder launched through ckeditor follows same format. i'm unable find examples of same on ckeditor / ckfinder site or forums. thank you. the problem it's how ckeditor handle custom file browsers. using file browser api ckeditor rely on popups only. using ckfinder's 3 modal possible if you'd implement custom plugin ckeditor adds "browse server" button , handles file browser itself.

apache - Play audio file of a system directory -

i have apache server locate on /var/www/html. want play audio file on browser locate on /var/spool/monitor/file.wav i'm trying directly , dont work, clearly: <audio controls> <source src="/var/spool/asterisk/monitor/2016/09/07/internal-2000-2001-20160907-115123-1473259882.329.wav" type="audio/wav"> browser not support audio element. </audio> how can that? i'm using php5.3 (yii1.1) , apache server <audio autoplay="autoplay"><source src="your path" type="audio/mpeg" /></audio> path should accessible browser ex : http://10.10.10.10/your-folder/file.mp3 this working me.

How can I center the scrollToColumn in React Virtualized's Grid? -

scrolltocolumn guarantee grid's column visible. how can rendered it's centered in grid? you can using scrolltoalignment property: controls alignment scrolled-to-rows. default ("auto") scrolls least amount possible ensure specified row visible. use "start" align rows top of list , "end" align them bottom. use "center" align them in middle of container. assuming you're using version 7.1.2+ property supported.

hover - Python bokeh apply hovertools only on model not on figure -

i want have scatter plot , (base)line on same figure. , want use hovertool on circles of scatter not on line. possible? with code below tooltips index: 0 , (x, y): (???, ???) when hover on line (any part of line). index: 0 data in source totally different ( (x, y): (1, 2) )... df = pd.dataframe({'a':[1, 3, 6, 9], 'b':[2, 3, 5, 8]}) bokeh.models import hovertool import bokeh.plotting bplt tools = ['box_zoom', 'box_select', 'wheel_zoom', 'reset', 'pan', 'resize', 'save'] source = bplt.columndatasource(data=df) hover = hovertool(tooltips=[("index", "$index"), ("(x, y)", "(@a, @b)")]) p = bplt.figure(plot_width=600, plot_height=600, tools=tools+[hover], title="my sample bokeh plot", webgl=true) p.circle('a', 'b', size=10, source=source) p.line([0, 10], [0, 10], color='red') bplt.save(p, 'c:/_teszt.html') thank yo...

php - OS Ticket not load properly -

Image
my company launched new website os ticket. os ticket attached old wordpress website before make switch. currently, os ticket not load os ticket content , navigation. want migrate os ticket database new website, these errors: php error – /support/main.inc.php on line 78 php error – /support/include/class.nav.php on line 321 if not load, means path not found. don’t know it. appreciated. [06-sep-2016 09:09:27 america/denver] php warning: include(): failed opening '/support/../wp-blog-header.php' inclusion (include_path='./:/support/include/:/support/include/pear/') in /support/main.inc.php on line 78 <?php /********************************************************************* class.nav.php navigation helper classes. pointless helps keep navigation clean , free errors. peter rotich <peter@osticket.com> copyright (c) 2006-2013 osticket http://www.osticket.com released under gnu general public license witho...

osx - Mac OS X route gateway link#5 -

Image
can tell me "link#5" means in "netstat" (netstat -rn) on mac? this how looks (for ipv6): this ifconfig: what gateway meant notation "link#5"? an more hard question: why route destination "fd00::/64" created automaticaly? has "fd00::" secial "meaning/use"? do have provided enough information answer question? thx! //stefan link#5 means interface en1 . (osi layer 1) mean packet put on interface en1 . and don't care destination mac address of packet. (osi layer 2) about osi: https://en.wikipedia.org/wiki/osi_model

c++ - trivial allocator aware container? -

i studying/playing allocators trying understand how works. run problems trying implement trivial container accepts allocator. ended this: template<class t, class allocator =std::allocator<t>> class container { public: using allocator_type = allocator; using value_type = t; using pointer = typename std::allocator_traits<allocator_type>::pointer; using reference = value_type&; using size_type = std::size_t; container( size_type n =0 , const allocator_type& allocator =allocator_type() ){ std::cout << "ctor" << std::endl; allocator.allocate(n); }; }; int main(int argc, const char* argv[]){ container<int> c {5}; return 0; } it gives me error member function 'allocate' not viable: 'this' argument has type 'const allocator_type' (aka 'const std::__1::allocator<int>'), function not marked const how fix er...

r - Printing values inside for loop gives different results if you print by index or by value -

i'm trying understand why different results when print values of list when access them index or directly: ws <- c(as.date('2016-01-01')) (w in ws) { print(w) } # prints 16801 (idx in 1:length(ws)) { print(ws[idx]) } # prints 2016-01-01 i'm not sure why first time, when access value using in wrong value. how can print values directly accessing via in (not using indexes)? , why happening? probably because ws integer; "date" see printing purposes, data tracked days since starting point. when create indexing variable w in ws , r coercing integer w has lost "date" attributes, , underlying integer. indeed, in ?control see seq : an expression evaluating vector (including list , expression) or pairlist or null. factor value coerced character vector. and as.vector(ws) return ws it's underlying, integer, state. in second example, ws has remained unchanged, printing elements continue formatted dates. ...

python - Repeat list if index range is out of bounds -

i have python list a = [1, 2, 3, 4] and i'd range of indices such if select indices 0 through n , i'm getting (for n=10 ) repeated [1, 2, 3, 4, 1, 2, 3, 4, 1, 2] i of course repeat list via (int(float(n) / len(a) - 0.5) + 1) * a first , select range [0:10] out of that, feels rather clumsy. any hints? you can use modulo operator when accessing list, i.e. a[i % len(a)] this give same result, doesn't require store redundant elements.

Google Sheets Error "Array Arguments to SUMIFS are of different size" -

converting excel file (where works fine), have sumifs formula returning error "array arguments sumifs of different size". formula in question looks this: =sumifs($g9:$ea9,$f$2:$dz$2,">=1/1/"&a$2,$f$2:$dz$2,"<=12/31/"&a$2) the array arguments are: g9:ea9 - 125 columns, 1 row f2:dz2 - 125 columns, 1 row f2:dz2 - 125 columns, 1 row the criteria arguments values. i'm not looking workaround or hack - want know if i'm somehow misusing sumifs formula can maintain consistency excel this turns out quirk of google sheets, generates many columns "needed". while excel understands ea means when there's no content there, default google sheets thinks there far fewer columns, , therefore offset array ranges indeed different sizes. 38 vs 39 in case. when added 125 columns sheet, formula worked fine.

linux - Raspberry Pi Zero USB device emulation -

i know raspberry pi 0 supports otg , usb peripheral protocols, , there's lot of cool built in peripherals shown here: https://learn.adafruit.com/turning-your-raspberry-pi-zero-into-a-usb-gadget?view=all#other-modules the problem need emulate usb peripheral device not appear on list. have vendor id , product id device, , i'm trying figure out how go doing this. need modify otg usb drivers in raspbian kernel? have build own kernel? or there better option don't realize? thanks in advance!! do need modify otg usb drivers in raspbian kernel? the answer first question "it depends", if device doesn't unusual no: need not modify source code kernel modules nor kernel. you're fortunate raspbian supports modern kernel configfs support. once set dtoverlay=dwc2 , can open functionfs bulk endpoint root so: modprobe libcomposite modprobe usb_f_fs cd /sys/kernel/config/usb_gadget mkdir -p myperipheral; cd myperipheral echo 0x1234 > idvendor ...

angularjs - Navigate from one tab to a nested view of another tab -

is possible link 1 tab nested view in tab? i've tried 2 different methods , neither seem work. here's router config: .config(function($stateprovider, $urlrouterprovider) { // ionic uses angularui router uses concept of states // learn more here: https://github.com/angular-ui/ui-router // set various states app can in. // each state's controller can found in controllers.js $stateprovider // setup abstract state tabs directive .state('tab', { url: '/tab', abstract: true, templateurl: 'templates/tabs.html' }) // each tab has own nav history stack: .state('tab.dash', { url: '/dash', views: { 'tab-dash': { templateurl: 'templates/tab-dash.html', controller: 'dashctrl' } } }) .state('tab.chats', { url: '/chats', views: { 'tab-chats': { templateurl: 'templates/tab-chats.h...

python - Improve the quality of the letters in a image -

Image
i'm working images have text. problem these images receipts, , after lot of transformations, text lost quality. i'm using python , opencv. trying lot of combinations of morphological transformations doc morphological transformations , don't satisfactory results. i'm doing right (i'll comment i've tried, , let uncommented i'm using): kernel = np.ones((2, 2), np.uint8) # opening = cv2.morphologyex(img, cv2.morph_open, kernel) # closing = cv2.morphologyex(img, cv2.morph_close, kernel) # dilation = cv2.dilate(opening, kernel, iterations=1) # kernel = np.ones((3, 3), np.uint8) erosion = cv2.erode(img, kernel, iterations=1) # gradient = cv2.morphologyex(img, cv2.morph_gradient, kernel) # img = erosion.copy() with this, original image: i this: it's little bit better, can see. still bad. ocr (tesseract) doesn't recognize characters here well. i've trained, can note, every "e" different, , on. i results, think, if resolve pr...

php - Wordpress print_r or echo from within hook callback -

i want debug function below. print_r nor echo not displaying though. how can print contents of: $order or $paypal_args ? function custom_override_paypal_email1( $paypal_args, $order ) { print_r($paypal_args); print_r($order); // die(); global $woocommerce; foreach ( $order->get_items() $product ) { $terms = get_the_terms($product['product_id'],'product_cat'); if (!is_null($terms)){ if(count($terms)>0) { //get first 1 $term = $terms[0]; if(strtolower($catname)==='ethics'){ $paypal_args['business'] = "zzz@zzz.example.com"; } else{ // $t = strval($term); $paypal_args['business'] = $t ."yyy@yyy.example.com"; } } ...

java - Is it possible to scope constructor injection in dagger 2? -

i have code , want make scoped. found not working , seems possible through in module. wasn't able find proper question , possible scope constructor injection? does not work @appscope @inject public stackoverflow() { } scope works!! @module public internetmodule { @appscope @provides public stackoverflow providestackoverflow() { return new stackoverflow(); } } you need put scope on class @appscope public class blah { @inject stackoverflow stackoverflow; @inject public blah() { } }

python - Create pandas dataframe column from another column that has dictionary keys -

i have dataframe , dict. these like, import pandas pd df1 = pd.dataframe({'first':['john','oliver','sarah']}) df1_map = {'john': 'anderson', 'oliver': 'smith', 'sarah' : 'shively'} print (df1) print (df1_map) first 0 john 1 oliver 2 sarah {'oliver': 'smith', 'sarah': 'shively', 'john': 'anderson'} the values of df1['first'] represent key values of dict. i add second column data frame called df1['second'] dict relationship maintained following dataframe, first last 0 john anderson 1 oliver smith 2 sarah shively now, iterate on dataframe values, so, df1['last'] = [ df1_map[i] in list(df1['first'])] i wondering if pandas support vectorized implementation / function can without iterating on rows of df you can map dictionaries values directly keys with: df1['last'] =...

javascript - How to return the response from an asynchronous call? -

i have function foo makes ajax request. how can return response foo ? i tried return value success callback assigning response local variable inside function , return one, none of ways return response. function foo() { var result; $.ajax({ url: '...', success: function(response) { result = response; // return response; // <- tried 1 } }); return result; } var result = foo(); // ends being `undefined`. -> more general explanation of async behavior different examples, please see why variable unaltered after modify inside of function? - asynchronous code reference -> if understand problem, skip possible solutions below. the problem the a in ajax stands asynchronous . means sending request (or rather receiving response) taken out of normal execution flow. in example, $.ajax returns , next statement, return result; , executed before function passed success callback ...