Posts

Showing posts from May, 2012

c# - How can i have multiple GET methods in single Controller -

namespace employeeapi.controllers { public class employeedetailscontroller : apicontroller { // api/employeedetails public ienumerable<employee> get() { } public ienumerable<details> get(int id) { } public ienumerable<team> getteammember() { } public ienumerable<details> gettid(int id) { } } have webapi this: 1) ienumerable<employee> get() -> api/employeedetails 2) ienumerable<details> get(int id) -> api/employeedetails/id 3) ienumerable<team> getteammember() -> api/employeedetails/id/teammember 4) ienumerable<details> gettid(int id) -> api/employeedetails/id/teammember/tid i tried making changes routing, new it, could'nt understand much.so, please can 1 me understand , guide me on how should done. in advance..:) you attribute routing . prefere use them give easy ov...

pandas - Group by of a Column and Sum Contents of another column with python -

i have dataframe merged_df_energy: merged_df_energy.head() act_time_aerateur_1_f1 act_time_aerateur_1_f3 act_time_aerateur_1_f5 class_energy 63.333333 63.333333 63.333333 low 0 0 0 high 45.67 0 55.94 high 0 0 23.99 low 0 20 23.99 medium i create each act_time_aerateur_1_fx ( act_time_aerateur_1_f1 , act_time_aerateur_1_f3 , act_time_aerateur_1_f5 ) dataframe wich contains these columns : class_energy , sum_time for example dataframe corresponding act_time_aerateur_1_f1 : class_energy sum_time low 63.333333 medium 0 high 45.67 i thing should use group this: data.groupby(by=['class_energy'])['sum_time'].sum() any idea me please? you can add columns [] aggregating: print (df.groupby(by=['class_energy'])['act_time_aerateur_1_f1', 'act_time_aerateur_1_f3','act_time_aerateur_1_f5'].sum()) act_time_aerateur_1_f1 act_time_aerateur_1_f3 \ class_energy ...

c# - IdentityServer - Using Hybrid Flow -

i implemented identityserver3 , try use new asp.net core mvc application. i want use hybrid flow don't seem working. my client on identityserver3 setup this: new client { clientname = "test", clientid = "test", clienturi = "http://localhost:59528/", flow = flows.hybrid, allowedscopes = new list<string>() { constants.standardscopes.openid, constants.standardscopes.profile }, redirecturis = new list<string> { "http://localhost:59528/signin-oidc", }, postlogoutredirecturis = new list<string> { "http://localhost:59528/", }, enabled = true } asp.net core mvc application setup this: public void configure(iapplicationbuilder app, iloggerfactory loggerfactory, iconfigurationservice configurationservice, applicationdbcontextseeddata seeder) { jwtsecuritytokenhandler.defaultinboundclaimtypemap.clear(); /* logging co...

How to use maven in android studio -

Image
i want use bottombar library in project. when add proper gradle command in build.gradle file , sync , error: failed resolve: com.roughike:bottom-bar:2.0 i have searched lot reason. solution use jcenter(), not accessible in country , syncing lasts 1 or in cases 2 hours. use maven instead. in case how can use maven commands recommended on library home page? should put following code? <dependency> <groupid>com.roughike</groupid> <artifactid>bottom-bar</artifactid> <version>2.+</version> <type>pom</type> </dependency> gradle dependencies { compile 'com.roughike:bottom-bar:2.+' } if error sync gradle run proxy( host=127.0.0.1 , proxyport=8580 ) , type command in cmd gradlew -dhttps.proxyhost=127.0.0.1 -dhttps.proxyport=8580

Send message from an Azure ServiceBus Topic after a specific delay with node.js -

basically, within azure service bus, have topic , subscription. if message arrives in topic between 11:00am, subscriber should not handle yet. however, @ 14:00pm, expect subscriber treat it. is there way achieve natively topic filters? i don't find mention of kind of use case in official documentation regarding filters. indeed, presented samples about: " subscriber handling kind of message, or never ". i'm looking for: " subscriber expecting handling kind of message but, later @ specific time ". sounds want defer message ? don't know azure sdk node.js msdn documentation can set scheduledenqueuetimeutc on message : the scheduled enqueue time in utc. value delayed message sending. utilized delay messages sending specific time in future. only sample send message queue : var message = { body: 'test message', customproperties: { testproperty: 'testvalue' }}; ser...

c# - Generating Update and cancel buttons on clicking edit button in asp.net -

i've content page dynamically binds grid view. i've added edit , delete buttons also. on clicking edit button, how generate update , cancel link buttons. i know must handled in rowediting event. please me in detail how buttons. here ap.net webpage <%@ page title="" language="c#" masterpagefile="~/managesms.master" autoeventwireup="true" codebehind="webform10.aspx.cs" inherits="sms_mod2.webform10" %> <asp:content id="content1" contentplaceholderid="head" runat="server"> </asp:content> <asp:content id="content2" contentplaceholderid="contentplaceholder1" runat="server"> <asp:dropdownlist id="dropdownlist1" runat="server" autopostback="true" onselectedindexchanged="dropdownlist1_selectedindexchanged"></asp:dropdownlist> <asp:panel id="panel1" visible="f...

c++ - programmatically check if desktop experience is installed or not windows server 2016 -

as know windows server 2016 comes option install desktop experience during os instllation timing , if done below program snippet fails detect though desktop experience installed. ienumwbemclassobject* penumerator = null; hr = psvc->execquery( bstr_t("wql"), bstr_t("select id win32_serverfeature"), wbem_flag_forward_only | wbem_flag_return_immediately, null, &penumerator); hr = penumerator->next(wbem_infinite,1,&pclsobj,&ureturn); if(0 == ureturn) { break; } variant vtprop; hr = pclsobj->get(l"id",0,&vtprop,0,0); this penumerator variable not contain desktop experience feature id 35. is expected behavior in windows server 2016 ? if not how value in windows server 2016 ?

xamarin - Pre-processing image using opencv for tesseract -

i want know methods needed process image best results, before giving ocr. also, character set should provided best result. currently, working on xamarin android app. below image processing code. cvinvoke.cvtcolor(img, img, colorconversion.bgr2gray); //cvinvoke.canny(gray, canny, 100, 50, 3, false); size s = new size(3, 3); cvinvoke.gaussianblur(img, img, s, 0, 0, bordertype.default); //cvinvoke.fastnlmeansdenoising(img, img, 3, 7, 21); cvinvoke.adaptivethreshold(img, img, 255, adaptivethresholdtype.meanc, emgu.cv.cvenum.thresholdtype.binary, 5, 4); cvinvoke.threshold(img, img, 0, 255, emgu.cv.cvenum.thresholdtype.otsu); i using emgucv library processing, tesseract. below white listed character set. _ocr.setvariable("tessedit_char_whitelist", "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz-1234567890 :$/.?,!@#%^&*()_+=\'\";{}[]+"); i want scan receipt , new concept. please let me know thoughts.

How to scan a folder and store all file names in a array variable and then loop through the array? -

i new batch , trying following: reading or scanning folder hold file names in folder in array variable (need hold file name or without extension) loop through array , create call specific file/bat based on type of file using if or case statement condition. example: if filename has word person in it, call specific file/bat. this have far: @echo off setlocal enabledelayedexpansion rem populate array existent files in folder set i=0 %%b in (*.*) ( set /a i+=1 set list[!i!]=%%b ) set filesx=%i% rem display array elements /l %%i in (1,1,%filesx%) echo !list[%%i]! ... ( echo !list[%%i]! | find /i "person" >nul && call specific.bat !list[%%i]! ) echo !list[%%i]! | find /i "person" : find word >nul : disregard output (we don't need it, errorlevel) && : if previous command successful (the word found), then... do need array? can "on fly": for %%b in (*.*) ( echo %%b | find /i "person...

java - Exception occured while Spring starting.please help me -

ide:idea framework:spring+sringmvc+mybatis+mongodb+activemq please give me hand,thanks. i add others error infomation. it's strange while use "mvn tomcat7:run" start project ,it started success! using debug/run in idea , occurs these errors. java.lang.nosuchmethoderror: org.springframework.util.reflectionutils.dowithlocalfields(ljava/lang/class;lorg/springframework/util/reflectionutils$fieldcallback;)v @ org.springframework.orm.jpa.support.persistenceannotationbeanpostprocessor.buildpersistencemetadata(persistenceannotationbeanpostprocessor.java:418) java.lang.illegalstateexception: applicationeventmulticaster not initialized - call 'refresh' before multicasting events via context: root webapplicationcontext: startup date [wed aug 24 15:09:35 cst 2016]; root of context hierarchy [2016-08-24 15:09:36] --- [warn] --- [abstractapplicationcontext.java:887] --- [exception thrown lifecycleprocessor on context close] --- @ org.springframework.context.support...

methods - What functions does the CLI perform before executing the command -

so, topic came during discussion cli , gui , interfaces , all. , gathered information not find definite complete answer. so, think developing cli set of api. functions can cli perform before calls particular method command entered. there few points able think of , got internet. validation of command security check what else cli before executing command?

c# - Dynamics CRM custom workflow activity and GAC reference version -

i experiencing error in crm workflows run custom activities reference common assembly gac, different versions. situation following: assembly , assembly b (both custom activities) reference assembly c contain base class (inheriting codeactivity) , b crmsvcutil generated class. assembly c exists in gac multiple versions. now, created new attribute in crm, regenerated types crmsvcutil, updated version of assembly c 1.0.0.3 , put gac, rebuilt assembly b (which uses new attribute) , updated using plugin registration tool. the error shows in workflows reference both assembly , b error message "assembly.type" cannot converted "assembly.type". in base class (assembly c) set assembly property able work strong types: iorganizationservicefactory servicefactory = executioncontext.getextension<iorganizationservicefactory>(); var type = type.gettype("microsoft.crm.workflow.synchronousruntime.workflowcontext, microsoft.crm.workflow, version=5.0.0.0"); typ...

visual studio 2015 - How to select from a cell in mysql and add to button.text -

i'm newbie visual basic 2015 in visual studio community. what i'm trying on load of main form i have 7 buttons need text field changed correspond entries in database. these buttons can change categories end user down road. i'm using mysql database. appreciated have searched google , youtube , it's endless world of overload. my db structure follows since cant embed image: idbtncat btn_name btn_caption panelno btn_image 1 btn_cat1 pizza pnl_cat1 pizza.jpg public class frm_mainconsole dim conn new mysqlconnection sub dbconn() dim databasename string = "posdb" dim server string = "localhost" dim username string = "root" dim password string = "8943117" if not conn nothing conn.close() conn.connectionstring = string.format("server={0}; user id={1}; password={2}; database={3}; pooling=false", server, username, password, databasename) try conn.open() catc...

javascript - Why is .nextAll() not returning the expected elements? -

i'm pretty new javascript/jquery. trying understand going wrong following code?: javascript: $('.rating-stars').each(function() { var currentscore = $(this).nextall('.current-score'); console.log(currentscore); $('.rating-stars').barrating('show', { theme: 'fontawesome-stars-o', deselectable: false, showselectedrating: false, initialrating: currentscore, }); }); html: <form id="vote_form" class="form-inline" method="post" action="/y/update_rating/39"> <span class="h3"><a href="#">title</a></span> <select class="rating-stars" id="id_vote" name="vote"> <option value=""></option> <option value="1"></option> <option value="2"></option> <option value=...

seo - Why Google robots.txt Tester has error and it's not valid -

Image
as can see in below image google webmaster tools robots.txt tester tell me 9 error don't know how fix , problem? please me figure out that valid robots.txt - you've got utf-8 bom (\xef\xbb\xbf) @ beginning of text file. that's why there's red dot next 'user' in first line. mark tells browsers , text editors interpret file utf-8 whereas robots.txt expected use ascii characters. convert text file ascii , errors go away. or copy after red dot , try pasting in again. i tested on live version, here's result translated byte form: \xef\xbb\xbfuser-agent: *\r\ndisallow: /en/news/iranology/\r\ndisallow: /en/tours-services/tour-the-soul-of-iran\r\ndisallow: /en/tours-services/tour-a-whistle-stop-tour\r\ndisallow: /en/to you can see bom @ beginning. browsers , text editors ignore may mess crawlers ability parse robots.txt. can test live version using python script: import urllib.request text = urllib.request.urlopen('http://www.best-ir...

ios - Every 11th execution of NSURLSessionTask takes much longer than others -

i'm having strange behavior in swift app, don't understand. i have subclassed nsoperation create different operations can call rest-webservices via nsurlsession / nsurlsessiontask. works fine in general. in case have execute many of these operations successively. let's create "chain" of 30 nsoperations setting dependencies execute them 1 one. now reproduce behavior, every 11th (?!) execution of such operation, takes longer others. seems if execution "sleeps" 10 seconds before goes on. can rule out, concrete web service call issue. because if change order of execution, still 11th operation "hangs". currently creating new instance of nsurlsession (defaultconfiguration) during execution of every operation. yesterday tried create static instance of nsurlsession , create instances of nsurlsessiontask during execution only. , "hanger" gone! unfortunately not way, because nsurlsessiondelegate has different operations, delegate mu...

python - Django Channels using django shell -

i'm trying use celery send sockets django channels. found same issue there using django's shell, , hoping if enlighten me. i have set within views.py, when user sends post request call group("chat").send({'text':'hello'}) the browser displays alert. however when try same thing using django's shell or 1 of celery's tasks: $ python3 manage.py shell $ channels import group $ group("chat").send({'text': 'hello'}) it doesn't anything, not returning error. if using in-memory channel layer it not support cross-process communication. try other channel layer types , go.

python - password special char ! in wsadmin script -

i have python/jython script automate web sphere console. i trying create jaasauth using script , password test123! my script given below ./wsadmin.sh -username wasadmin -password wasadmin -lang jython -c "print admintask.createauthdataentry('[-alias alias -user tstusr -password test123! -description authentication ]');" script finishes well. datasource connection test fails password auth incorrect. missing special char !. when manually update passoword in console, works well. i tried single quotes ' ' , escape characters , no luck. would great if can share info on this.

excel - How to use countif and if and round in the same time -

Image
from picture know data have mode 3.14 , value 3.14 = value 3.1 , right? whereas value 3.1 not 3.14 , include 3.05, 3.06, 3.07, 3.08, 3.09, 3.10 , 3.11 , 3.12 , 3.13 , , 3.14 right ? the question , how let count ​​of formula may appear known mode ? or whats formula of "if" or "round", if want know count value of 3.05, 3.06, 3.07, 3.08, 3.09, 3.10 , 3.11 , 3.12 , 3.13 , , 3.14 selected range of data without having reduce decimal point in data column , without typing value? i'm try =countif(a2:a22,round(mode(a2:a22),1)) , result = 1 not 6. can me? =countif(a2:a22,"<="&3.14)-countif(a2:a22,"<"&3.05) count equal or below 3.14, , subtract less 3.10. to automate rounding process, go dirk suggesting , use: =countif(a2:a22,"<"&round(mode(a2:a22),1)+0.05)-countif(a2:a22,"<"&round(mode(a2:a22),1)-0.05) proof of concept

hadoop - Hive/Impala UDF with String input/output -

i looking impala/hive udf examples, e.g.: public class fuzzyequalsudf extends udf { public fuzzyequalsudf() { } public booleanwritable evaluate(doublewritable x, doublewritable y) { double epsilon = 0.000001f; if (x == null || y == null) return null; return new booleanwritable(math.abs(x.get() - y.get()) < epsilon); } } then tried create own udf, has string input , string output. ideally, should like: public class myudf extends udf { public myudf() { } public stringwritable evaluate(stringwritable x) { string[] y = x.split(","); string z = y[0] + "|" + y[1] return new stringwritable(z); } } however, problem there no stringwritable class! see: import org.apache.hadoop.hive.serde2.io.bytewritable; import org.apache.hadoop.hive.serde2.io.doublewritable; import org.apache.hadoop.hive.serde2.io.shortwritable; import org.apache.hadoop.hive.serde2.io.timestampwr...

how to modify _xspAppSearchSubmit on Application Layout Xpages -

im trying modify search parameter in application layout search, accept dot(.) literal part of search item filtering view.. for example... "mr. smith" not show in view, but "mr.smith" will.. digging deeper google debugger, found function _xspappsearchsubmit can change code encodeuricomponent(val) encodeuricomponent(val.replace(/s+\.s+/g,'') worked when tested on console. s+ remove spaces, \. keep dot literal. but somehow, cannot find function in applicationlayout1 custom control, , listed 1 event - onitemclick . possible add "onchange" event? there's option , optionparam property there not sure how apply this. im newbie xpage , control, can me work around this, i've checked other sites doesn't explain kind of issue. i've checked encodeuricomponent functionality, still interprets dot command. learned dot works * wildcard. the application layout ccbaseui "one ui", , setup basic application ...

mysql - simple SUM query for C# -

i want ask simple sum query. in question, attached picture let guys see table. now, want calculate januari's target + februari's target = februari's target_ytd have got far this select sum(target) 'target_ytd' revenue bulan = "januari" or bulan = "februari" but query above produce final result of calculation, , want is, want put result in "revenue" table (which februari's target_ytd column exactly). appreciate can me figure out. thank you i suppose revenue table contains column named 'target_ytd' , want update field sum function januari , februari target values use that update revenue set target_ytd=(select sum(target) revenue bulan in ('januari', 'februari')) bulan='februari'

.net - Control compression of html file when packaging UWP app as an APPX -

Image
i'm looking documentation how change compression html files using makeappx.exe tool https://msdn.microsoft.com/en-us/library/windows/desktop/hh446767(v=vs.85).aspx when running makeappx pack /v can see in logs like: settings extension html: type = text/html, compression = normal. adding "c:\snip\content\startpage.html" package payload file. path in package "content\startpage.html". what i'd set compression "none". (because it's removing cariage returns , corrupting mark-of-the-web in startpage.html.) can't find documentation how though. thanks! what i'd set compression "none". if type makeappx pack /? see there /nc option, prevent tool compressing files: so command makeappx pack /v /nc .

c# - ASP.NET MVC. How manually add "cascade delete" to a code first relationship? -

how configure cascade delete code first project without setting navigation properties [required] or non nullable ? for instance: class mainclass{ [key] int id {get;set;} public string name {get;set;} public virtual icollection<subitem> subitems {get;set} } and class subitem{ [key] int id {get; set;} public string name {get;set;} } deleting main class should delete related subitems to have cascade deletes on nullable foreign keys through code first set up, best way achieve through fluent api. add fluent api code dbcontext: protected override void onmodelcreating(dbmodelbuilder modelbuilder) { modelbuilder.entity<subitem>() .hasoptional(o => o.mainclass) .withmany(m => m.subitems) .hasforeignkey(k => k.mainclassid) .willcascadeondelete(true); } and subitem class needs updated these properties: class subitem { [key] int id {get; set;} public string name {ge...

c# - Load a DataTable from a SQLDataReader in batches using Powershell -

i need load datatable sqldatareader in batches. sqldatareader return millions of records, , datatable load() method exhaust available memory. here current code: [cmdletbinding( defaultparametersetname = 'instance', supportsshouldprocess = $true, confirmimpact = 'high' )] param ( [string] $srcserver = "mysqlserver,12345", [string] $srcdatabase = "sourcedb", [string] $srctable = "dbo.sourcetable", [string] $srcquery = "select top 100 hashbytes('sha',stay_number) stay_number_h, * $srctable", [string] $tgtserver, [string] $tgtdatabase = "targetdb", [string] $tgttable = "tmp.targettable", [switch] $truncate = $true ) function connectionstring([string] $servername, [string] $dbname) { "data source=$servername;initial catalog=$dbname;integrated security=true;connection timeout=30" } ########## ma...

java - Testing console output -

got question regarding testing console output. stdoutput class: public abstract class stdouttest { private final printstream stdoutmock = mock(printstream.class); private final printstream stdoutorig = system.out; @before public void setup() { system.setout(this.stdoutmock); } @after public void teardown() { system.setout(this.stdoutorig); } protected final printstream getstdoutmock() { return this.stdoutmock; } } now here don't understand: public class test extends stdouttest{ @before public void setup(){ //empty } @test public void example(){ system.out.println("hello"); verify(getstdoutmock()).println("hello"); } } i use mockito verify , test passes when delete setup(), setup() fails. fail message says: hello wanted not invoked: printstream.println("hello"); -> @ observer_test.test.example(test.java:18) actually,...

windows - BATCH Preventing users from opening file from outside the program? -

i have plugin system on program written in batch, follows; (thanks https://stackoverflow.com/users/3536342/davidpostill ) :plugindragon echo. echo plugins echo ============== dir /b plugins\*.cmd echo. echo enter name of plugin want run. set /p plugin=root/plugins/plugin_dragon.jr@root:~$ start "" plugins\%plugin% goto root is there way prevent users of program opening said plugins without running plugindragon script? in can't directly go plugins folder , double click applications (as they're written in batch). they'd need use "terminal" window open them, , that. here modification of script following: makes files hidden , system files using attrib changes permissions on files make them unopenable using icacls :plugindragon echo. echo plugins echo ============== dir /b plugins\*.cmd echo. echo enter name of plugin want run (exclude extension). set /p plugin=root/plugins/plugin_dragon.jr@root:~$ :: grant permission access file ...

PHP Array of Bytes to Zip File -

i have php array, contains bytes, , actual bytes represent zip file (which contains multiple files inside zip). this returned third party api, have no choice work format. so i'm trying convert zip file. example of byte array returned api: [bytes] => array ( [0] => 37 [1] => 80 [2] => 68 [3] => 70 [4] => 45 [5] => 49 [6] => -46 ... continues close 20,000 ) i have tried getting browser return creating complete byte string, , adapting browser headers... using: foreach($bytes $byte) { $bytestring .= $byte; } header("content-type: application/zip"); header("content-disposition: inline; filename='test.zip'"); echo $bytestring; this create zip file, it's invalid / corrupted. i have tried found elsewhere on stackoverflow: $fp = fopen('/myfile.zip', 'wb+'); while(!empty(...

ruby - Can't always access value of instance variable without @ even with attr_accessor -

this question has answer here: why ruby setters need “self.” qualification within class? 3 answers how come error nomethoderror: undefined method '+' nil:nilclass line puts test prints out 1 know value initialized? class testclass attr_accessor :test def initialize() @test = 1 end def testfn puts test test = test + 1 end end t = testclass.new t.testfn it works if change test @test thought didn't have if had attr_accessor :test when assigning value instance variable through accessor / writer, have use self , otherwise ruby interpreter thinks local variable. in case, testfn code should this: def testfn puts test self.test = test + 1 end

vba - Data input on excel: form sheet to database sheet -

i'm using dynamic button on 1 sheet send data database/summary sheet within same workbook in excel. i know know. should've done using access , queries, used trusty brute-force method in code shown below. it works, it's painstakingly slow. please advise on how perform task less demand on processor. 'enter database nextspgp.value = range("b7").value nextdate.value = format(range("m7").value, "mm/dd/yyyy") nextstart.value = format(range("a12").value, "hh:mm") nextfinish.value = format(range("b12").value, "hh:mm") nextmix = range("c12").text nextbatch.value = range("d12").value nextgrouter.value = range("j7").value nextpump.value = range("h7").value nextpass.value = range("f7").value nextdepth.value = range("e12").value nextsleeve.value = range("f12").value nextinitpress.value = range("g12").value nextfinalpress....

python - Why supervisor doesn't start after `restart` comand? -

on ubuntu 14.04 have supervisor 2 working sites on django (gunicorn). configs similar. good, supervisor correctly restart , up. after adding 1 more site - on sudo service supervisor restart shut down, doesn't up. , must hit sudo service start start supervisor. here config: supervisord.conf : [unix_http_server] file=/var/run/supervisor.sock ; (the path socket file) chmod=0700 ; sockef file mode (default 0700) [supervisord] logfile=/var/log/supervisor/supervisord.log ; (main log file;default $cwd/supervisord.log) pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid) childlogdir=/var/log/supervisor ; ('auto' child log dir, default $temp) loglevel=debug [rpcinterface:supervisor] supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface [supervisorctl] serverurl=unix:///var/run/supervisor.sock ; use unix:// url unix socket [include] files = /etc/supervisor/conf.d/*/*.conf /etc/s...

Python equivalent of Matlab's hist3 -

for i=1:n centersx(:,i)=linspace(min(xdata)+dx/2,max(xdata)-dx/2,nbins)'; centersy(:,i)=linspace(min(ydata)+dy/2,max(phase)-dy/2,nbins)'; centers = {centersx(:,i),centersy(:,i)}; h(:,:,i) = hist3([xdata ydata],centers); end in each iteration, construct centersx , centersy linspace function. store them in 2x1 cell array called centers . h nbins x nbins x n struct. in each iteration fill nbins x nbins slice of h data hist3. i'm looking python equivalent. i'm having trouble passing arguments numpy.histogram2d : h[:,:,i] = numpy.histogram2d(xdata,ydata,centers) i following error: traceback (most recent call last): line 714, in histogramdd n, d = sample.shape attributeerror: 'list' object has no attribute 'shape' during handling of above exception, exception occurred: traceback (most recent call last): line 36, in <module> h[:,:,i] = numpy.histogram2d(xdata, ydata, centers) line 714, in histogram2d h...

python - Use Selenium to click a 'Load More' button until it doesn't exist (Youtube) -

i trying write python script goes youtube channel. clicks on video tab. scrapes webpage content. fine scraping content, until... load more button. python script have manages click load more button once never presses again :'( how can modify code have make click again , again until doesn't exist. way, can open user's complete channel , information every video have. thankyou. from selenium import webdriver selenium.common.exceptions import nosuchelementexception selenium.webdriver.common.by import selenium.webdriver.support.ui import webdriverwait selenium.webdriver.support import expected_conditions ec ^^ modules have imported. don't know how add in nosuchelementexception code either. here code: chrome_path = r"/users/jack/desktop/other/downloads/software_and_programs/chromedriver" browser = webdriver.chrome(chrome_path) youtuber_home_page_url = "https://www.youtube.com/user/google/videos" patience_time = 60 load_more_button_xpath = ...

swift - Open a ViewController from remote notification -

Image
i try open particular viewcontroller when app catch remote notification. let me show project's architecture. here storyboard : when receive notification want open "simplepostviewcontroller", appdelegate : var window: uiwindow? var navigationvc: uinavigationcontroller? func application(application: uiapplication, didfinishlaunchingwithoptions launchoptions: [nsobject: anyobject]?) -> bool { let notificationtypes: uiusernotificationtype = [uiusernotificationtype.alert, uiusernotificationtype.badge, uiusernotificationtype.sound] let pushnotificationsettings = uiusernotificationsettings(fortypes: notificationtypes, categories: nil) let storyboard = uistoryboard(name: "main", bundle: nil) self.navigationvc = storyboard.instantiateviewcontrollerwithidentifier("lastestpostsnavigationcontroller") as? uinavigationcontroller application.registerusernotificationsettings(pushnotificationsettings) application.registerforremot...

Freemarker XML parsing with attributes and value -

i have following xml contains 2 attributes , value. value containing content wrapped in field tag. <field key="title" primitive="string"> <![cdata[ problem i'm trying solve. ]]> </field> after parse it, when type ${item} in freemarker template. can attributes using item.@key , item.@primitive. unfortunately, i'm failing value or content. alternative solution use substring content value array. i'm sure freemarker has way sort of data. field[attributes={key=title, primitive=string}; value=[this problem i'm trying solve.]] assuming item holds field xml element, ${item} should work. output show isn't familiar me. guess there's strange xml wrapping there, perhaps using of legacy xml wrappers. should use w3c dom element or document added data model, or wrapped explicitly freemarker.ext.dom.nodemodel . btw, can try on http://freemarker-online.kenshoo.com/ indeed should work, if fill form this: template:...

java - How to set the distance between line border and edge of window? -

you know how when do panel.setborder(borderfactory.createtitledborder(txt)) creates border, , if that's panel in window, there space between border, , edge of window. but if panel2.setborder(borderfactory.createlineborder(color.lightgray, 1)) borer gonna touching edge of window. question how change distance between lineborder , edge of window comment if not clear enough the borer gonna touching edge of window....how change distance between lineborder , edge of window you can nest borders using compoundborder . example, create 'padding' border around line border: compoundborder cb = new compoundborder(borderfactory.createemptyborder(5,5,5,5), borderfactory.createlineborder(color.black)); mycomponent.setborder(cb);

woocommerce - Disable Auto login on PayPal checkout -

hello here problem. on woocommerce shop use paypal gateway. when try pay first see page when can choise how pay via account or card. after login account can t change it. if return site , try pay again don t see choise, paypal autologins me , on page can change account or pay via card. problem site because stupid users don`t know how log out , pay again. p.s. in api request 'landingpage' => 'billing' or 'landingpage' => 'login' has no effect.

c++ - How to make atomic getters and setters in a singleton? -

i have struct of getters , setters use use std::unique_lock lock access. getters shared same lock made request singleton serialized. mentioned solution worked slow. worried dead locks since of access data structure reads. i'd 70% of access reads. started looking atomic operations b\c there buzz lock free synchronization. i've noticed massive slow down in code base. first let me preempt suggestions architecture. code runs on x86 not memory fence issue. second i'm using acquire semantics loads , release semantics stores, , x86 explicitly guarantees no memory fences for. my theory i'm not using right memory_order want or @ least how library used in practice or has compiler. so i'm using msvc 2015 update 2 compiler , slow down prevalent on debug builds. struct singleton_struct { std::atomic_bool m_bis1; std::atomic_bool m_bis2; std::atomic_bool m_bis3; singleton_struct() : m_bis1(false), m_bis2(false), m_bis3(f...

php - Reducing database query sizes in laravel -

i'm looking reduce query size in laravel. my query looks (i shortened it, it's 10 times amount of lines): $users = user::where("interface_art", '=', 1)->where('role', '=', 2)->where('commstatus', '=', $unavailablecheck) ->orwhere("interface_art", '=', 1)->where('role', '=', 2)->where('commstatus', '=', 1) ->orwhere("web_art", '=', 1)->where('role', '=', 2)->where('commstatus', '=', $unavailablecheck) ->orwhere("web_art", '=', 1)->where('role', '=', 2)->where('commstatus', '=', 1) ->orwhere("illustration_art", '=', 1)->where('role', '=', 2)->where('commstatus', '=', $unavailablecheck) ->orwhere("illustration_art", '=', 1)->where('role...

python - How to build model in DynamoDB if each night I need to process the daily records and then delete them? -

i need store daily information in dynamodb. basically, need store user actions: userid, storeid, actionid , timestamp. each night process information generated day, aggregations, reports, , can safely deleted records. how should model this? mean hash key , sort key... need have full timestamp of each action reports in order query dynamodb guess easier save date only. have pks userid , storeid anyhow need process data each night, not data related 1 user or 1 store... thanks! patricio you can use rabbitmq schedule jobs asynchronously. faster multiple db queries. basically, tool allows create job queue (containing userid, storeid & timestamp) workers can remove (at midnight if want) , create reports (or whatever heart desires). this allows scale system horizontally across nodes. workers can different machines executing these tasks. safe if db crashes (though may still have design redundancy machine running rabbitmq service). db should used persistent storage , not que...

Does a PHP MySQL Transaction make only one call to the server? -

when using php , mysql transaction - in example below. $db->begintransaction(); // set of queries; if 1 fails, exception should thrown $db->query('first query'); $db->query('second query'); $db->query('third query'); $db->commit(); does make 1 call server? or multiple calls? welcome world of mvcc , or multi-version concurrency control, fancy way of saying transaction creates temporary alternate reality changes applied until commit changes nobody else can see them. when committed database merges changes main database. if rollback it's never happened. this makes 5 calls server, 1 open transaction, 3 insert data, , 1 commit. the transaction creates atomic operation , either succeeds or fails single unit, if it's composed of 5 individual operations.

angularjs - Making Graph in Javascript - Issue -

i need debugging problem simple graph (data structure, not chart). can insert node, create path next nodes fine; that's not problem. problem when call returngraph node @ first index returned [object object] , other nodes returned should be. being wrriten angularjs way. so looked solution , read in few places has either object's built in string method or conflict between javascript-objects , json-objects. unfortunately i'm little lost since i'm not familiar javascript internals. first off, here example json object using: //json object waiting passed node() obj1 = { id: 6111, name: "node1", stats: { "speed": 4 }, ranks: 5, prereq: 0 } here rest of code: //pass data json object through constructor create node function node(data){ this.name = data.name; this.stats = data.stats; this.maxrank = data.ranks; this.rank = 0; } //return node name node.prototype.returnname = function(){ retu...