Posts

Showing posts from July, 2013

android - how to open a specific folder with gallery or file manager that contains images and videos -

a folder contains images , videos, when click on button onclicklistener(), want open folder gallery or file manager, , show images , videos saved in folder. you can use ajax event, fetch following code (this images): path = "media/images/iconized/"; $images = glob($dirname."*.png"); foreach($images $image) { echo '<img src="'.$image.'" />; } or can use plugin https://cksource.com/ckfinder/demo

Add temp column with default as trim of an existing column in Oracle SQL -

i trying add temporary column table in order fix leading , trailing spaces in original column. original column values (excluding speech marks): " john smith " " jay morgan " temporary column values (excluding speech marks): "john smith" "jay morgan" sql: alter table persons add t_full_name default trim(full_name); however, not work. trying impossible? this worked me (oracle 11g): create table t2 (full_name varchar2(40)); insert t2 (full_name) values (' test '); select * t2; alter table t2 add (fu2 varchar2(40) (trim(full_name))); select * t2; output full_name fu2 test test added after comment. if later want rename columns told, can following: alter table t2 add fu3 varchar2(40); update t2 set fu3=fu2; alter table t2 drop column fu2; alter table t2 drop column full_name; alter table t2 rename column fu3 full_name; or directly, if don't want intermediate checks: update t2 set full_

sql - How to get DB records which have different value of same column in same table -

please take of below sql: select top 3 acct_num acct_package package_key in ( select package_key acct_serv serv_id = 'a1' , package_key in ( select package_key acct_serv serv_id = 'b1' , package_key in( select package_key acct_serv serv_id = 'c1' ) ) ) in case, no other tables had relationship. i can retrieve data need above sql, guess maybe have other coding more effective. many helping!!! this approach (please remember use order when use top xx, otherwise result not predictable) (i tried on oracle db, without top of course): select top 3 acct_num acct_package inner join (select package_key, sum(rc) sum_tot (select package_key, serv_id, 1 rc

angular - asp.net core Angular2 MVC http get issue -

i new angular 2. trying data mvc controller angular 2 import { component } '@angular/core'; import { http } '@angular/http'; @component({ selector: 'subscriber', templateurl: './subscriber.component.html', styleurls: ['./subscriber.component.css'] }) export class subscribercomponent { public ivm: incidentviewmodel; constructor(private http: http) { //this.ivm.id = "id"; this.http.get('api/form/incidentform').subscribe(res => this.ivm = res.json() incidentviewmodel); //map console.log(this.ivm.id) } } interface incidentviewmodel { id: string; code: string; datetime: date; address: address; contact: contactviewmodel; } interface contactviewmodel { firstname: string; lastname: string; telephone1: string; telephone2: string; } interface address { street1: string; } this controller namespace subscriber.controllers {

javascript - How to get my anonymous function to return a value instead of a function? -

my code: var host_choice = function(){ var choice; { choice = shuffled_list[random_choice()]; } while (choice == "car" || choice == player_choice); return choice; }; here host_choice function have call. unsure how make variable containing choice . know missing basic here, how it? side note: shuffled_list contains 3 elements. , want host_choice variable contain neither element car nor player_choice there "fancier" way of doing this? you can invoke directly. var host_choice = (function(){ var choice; { choice = shuffled_list[random_choice()]; } while (choice == "car" || choice == player_choice); return choice; })(); this example of iife (immediately invoked function expression). handy various reasons, such modularity in javascript.

xml - Add namespace to child element using JAXB -

i want namespace added child element header. using jaxb <soap:envelop xmlns:soap="http://www.w3.org/2003/05/soap-envelope"> <soap:header xmlns:wsa="http://myapp/"> <wsa:action></wsa:action> <wsa:to></wsa:to> <soap:header> </soap:envelop> i tried package-info.java , namespaceprefixmapper both add namespace root element shown below. <soap:envelop xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:wsa="http://myapp/"> <soap:header> <wsa:action></wsa:action> <wsa:to></wsa:to> <soap:header> </soap:header> why adding namespace prefix , namespace uri child element complicated in jaxb. any appreciated.

r - Problems in a regular expression to extract names using stringr -

i cannot understand why regular expression not work extract info want. have unlisted vector looks this: text <- c("senator, 1.4balbal", "rule 46.1, declares", "town, 24", "a town long name, 23", "this document,23) i create regular expression extract name of "town", if town has long name 1 written in vector ("a town long name"). have tried extract name of town: reg.town <- "[[:alpha:]](.+?)+,(.+?)\\d{2}" towns<- unlist(str_extract_all(example, reg.prov)) but extract around ",". thanks in advance, it looks town name starts capital letter ( [[:upper:]] ), ends comma (or continues end of text if there no comma) ( [^,]+ ) , should @ start of input text ( ^ ). corresponding regex in case be: ^[[:upper:]][^,]+ demo: https://regex101.com/r/qxytyv/1

deep learning - caffe parse log is broken since rc5 -

i have upgraded caffe/rc5 , figured out parse_log.sh not date anymore. there new way produce parsed log or bug? produced output in log.train: #iters seconds trainingloss learningrate 0 62.534432 62.5355s/100 0.0005 100 119.882181 57.3488s/100 0.0005 corresponding log file i0328 11:28:27.227087 9438 solver.cpp:398] test net output #0: loss = 907.84 (* 1 = 907.84 loss) i0328 11:28:27.680057 9438 solver.cpp:219] iteration 0 (0 iter/s, 62.5355s/100 iters), loss = 895.13 i0328 11:28:27.680119 9438 solver.cpp:238] train net output #0: loss = 860.911 (* 1 = 860.911 loss) i0328 11:28:27.680124 9438 sgd_solver.cpp:105] iteration 0, lr = 0.0005 i0328 11:29:25.027806 9438 solver.cpp:219] iteration 100 (1.74372 iter/s, 57.3488s/100 iters), loss = 56.9938 i0328 11:29:25.028008 9438 solver.cpp:238] train net output #0: loss = 64.645 (* 1 = 64.645 loss) i0328 11:29:25.028014 9438 sgd_solver.cpp:105] iteration 100, lr = 0.0005

php - SQL Image doesn't display with header-content -

i have images stored on mysql database, longblob type column, when try display them on browser on chorme see little white box, , on firefox see , error message saying image file has problem. this use display image. $query = "select file, type uploads ref = '$ref'"; $statement = $pdo->prepare($query); $statement->execute(); $row = $statement->fetch(pdo::fetch_assoc); header("content-type: " . $row["type"]); echo $row["file"]; note: $row["type"] mime type of file. think image isn't corrupted because can display this. echo '<img src="data:image/jpeg;base64,'.base64_encode( $row['file'] ).'"/>'; but need other way, curious thing few days ago worked fine same code. perhaps mysql fault? edit code of upload. function uploader_upload($file, $ref) { $uploader = $_login["userid"]; $name = $file["name"]; $type = $file["type

How to allow only numbers in textbox in reactjs? -

how allow numbers in textbox in reactjs using regular expression only? for use regex: /[0-9]+/g; in onchange method, check whether value proper of not, if value proper update state value otherwise ignore. check example: class app extends react.component{ constructor(){ super(); this.state = {value: ''}; this.onchange = this.onchange.bind(this) } onchange(e){ const re = /^[0-9\b]+$/; if (e.target.value == '' || re.test(e.target.value)) { this.setstate({value: e.target.value}) } } render(){ return <input value={this.state.value} onchange={this.onchange}/> } } reactdom.render(<app/>,document.getelementbyid('app')) <script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js"></s

How to convert cURL to postman? -

postman has built-in function convert postman curl code, if want convert curl code postman, how can efficiently? example, curl code following; curl -v -x post " https://speech.platform.bing.com/recognize?scenarios=smd&appid=d4d52672-91d7-4c74-8ad8-42b1d98141a5&locale=your_locale&device.os=your_device_os&version=3.0&format=json&instanceid=your_instance_id&requestid=your_request_id " -h 'authorization: bearer your_access_token' -h 'content-type: audio/wav; codec="audio/pcm"; samplerate=16000' --data-binary @your_wave_file thanks , best regards, by using 'import' functionality followed 'paste raw text'. explained in official docs here . for body selects raw , expects user paste content of file postman. alternatively can toggle binary , upload file manually while doing actual request.

ios - Alamofire -What to do when there is a wifi connection but no internet connection? -

Image
i'm using alamofire in ios app. use bool values in viewwillappear , in appdelegate nsnotifications check if there internet connection. if there no wifi connection pop appears inform user. if there wifi connection pop disappears , works fine again. i've had no problems long wifi not working. i @ meetup , explained me way works it looks wifi connection , not internet connection. e.g.. if have wifi router , it's plugged in router isn't connected internet alamofire view successful connection because connecting wifi although doesn't know wifi can't connect internet. i in situation connected open network, app responded if connected internet (no pop up) couldn't connect anything. wifi signal on full. in terminal ran ping , turns out connection dead. app couldn't tell difference. how make pop appear in sitaution this? also .case unknown for? alamofire.swift: import foundation import alamofire open class networkmanager { open static var

c# - DayPilot - returning a new View on EventClick -

i attempting implement daypilot lite mvc on project. i've set events , clickable(tested debug statement). looking process click , load new view, using viewmodel built id of event clicked. public actionresult booking() { applicationdbcontext db = new applicationdbcontext(); int id = dpc.eventid; if (id == null) { return new httpstatuscoderesult(httpstatuscode.badrequest); } lesson lesson = db.lessons.find(id); if (lesson == null) { return httpnotfound(); } return view(lesson); } class dpc : daypilotcalendar { public int eventid; protected override void oninit(initargs e) { applicationdbcontext db = new applicationdbcontext(); events = ev in db.lessons select ev; dataidfield = "classid"; datatextfield = "classlevel"; datastartfield = "classstartdate&

python - django-money form field in unit test -

i using django-money , have money field ( value = moneyfield(…) ) want test in model form. code: def test_post_valid(self): data = {'value': money('99.99', currency='gbp'), } response = self.client.post(url, data) i error in form parsing code stating: (pdb++) form.errors {u'value': [u'this field required.']} what correct format? django-money hack moneyfield , doesn't translate simple html form field, , instead produces 2 html form fields value , currency code. you have pass value of type decimal (or value can coerced decimal ) , value_currency of 3-character currency code ( choicefield of country codes). def test_post_valid(self): data = {'value_0': '99.99', 'value_1': 'gbp' } response = self.client.post(url, data)

html5 - Creating CSS shape dividers between content -

Image
how can create such section in wordpress ? , have content in both black , white sections adaptive diagonal line ? you can use css clip-path. can use website generate clip-path. http://bennettfeely.com/clippy/ #mydiv{ height:200px; width:400px; background-color:red; -webkit-clip-path: polygon(0 0, 100% 0, 40% 100%, 0% 100%); clip-path: polygon(0 0, 100% 0, 40% 100%, 0% 100%); } <div id="mydiv"> </div>

angular - ng2-pdf-viewer Access-Control-Allow-Origin -

i using ng2-pdf-viewer library angular , trying display pdf basic url. problem following error : xmlhttprequest cannot load https://www.bbv.ch/images/bbv/pdf/publikationen/bbv16poster_angular2.pdf . no 'access-control-allow-origin' header present on requested resource. origin ' http://localhost:54800 ' therefore not allowed access. here code : .ts : { name: "angular2 tuto", description: "an amazing angular2 pdf !", url: {url: "https://www.bbv.ch/images/bbv/pdf/publikationen/bbv16poster_angular2.pdf", withcredentials: true} } .html : <pdf-viewer [src]="document.url" [page]="1" [original-size]="false" style="display: block;"></pdf-viewer> i tried , without "withcredentials" property - nothing changed.. how can show pdf link in angular2 ? (worked in basic iframe though...)

amazon S3 upload API is sensitive to http post parameter ordering -

i've created bucket policy makes mandatory specify content-type of object being uploaded. if specify content-type after file element, (example below) <form action=".."> ... <input type='file' name='file' /> <input name='content-type' value='image/jpeg' /> <input type='submit' /> </form> it returns following error <error> <code>accessdenied</code> <message>invalid according policy: policy condition failed: ["starts-with", "$content-type", ""]</message> <requestid>15063eb427b4a469</requestid> <hostid>yezapf4z2inaafhcqyq4oolvkdwnsrwqqhnyg6jm5hpqwsoltptuk0t9hn+zkbebk+rp4s5nfvs=</hostid> </error> if specify content-type before file element, upload works expected. encountered behaviour first time. have few questions regarding it. is part of specification clients , intermediate proxies suppo

c# - 'stream.ReadTimeout' threw an exception of type 'System.InvalidOperationException' sending photo to telegram bot -

i wrote below code sending photo bot, in stream, have 2 exceptions read , write , photo not send. i think maybe reason error, couldn't fix it: stream.readtimeout threw exception of type 'system.invalidoperationexception' using (var stream = system.io.file.open("a.jpg", filemode.open)) { var filetosend = new filetosend("a.jpg", stream); task.run(() => bot.sendphotoasync(u.message.chat.id, filetosend).configureawait(false)); } the reason exception dispose stream immediatly after starting task. the using statement calls dispose on stream instance when execution leaves block. can either remove using statement or - if method async - may await call sendphotoasync() . there no reason use thread task.run() : using (var stream = system.io.file.open("a.jpg", filemode.open)) { var filetosend = new filetosend("a.jpg", stream); await bot.sendphotoasync(u.message.chat.id, filetosend).configurea

java - where is server log -

in spring boot project when run project on tomcat webserver gives below exception. part of stacktrace, in last line says "see server log details", can not find server log for. checked logs file (i mean address: apache-tomcat-8.5.9\logs) , path empty. note: running don't changes make not run anymore. 28-mar-2017 16:25:35.336 severe [rmi tcp connection(3)-127.0.0.1] org.apache.catalina.core.standardcontext.startinternal 1 or more listeners failed start. full details found in appropriate container log file 28-mar-2017 16:25:35.337 severe [rmi tcp connection(3)-127.0.0.1] org.apache.catalina.core.standardcontext.startinternal context [] startup failed due previous errors [2017-03-28 04:25:35,375] artifact cardservice:war exploded: error during artifact deployment. see server log details. it in tomcat's log file called catalina.out .

java - How to call to LinkedList with generic type -

i'm using several linkedlist each 1 different type, example : linkedlist<a> typea = new linkedlist<>(); linkedlist<b> typeb = new linkedlist<>(); linkedlist<c> typec = new linkedlist<>(); and want print them according type, each type call appropriate function. void funca(linkedlist<a> ls) void funcb(linkedlist<b> ls) void funcc(linkedlist<c> ls) and wonder if option of calling 1 function , inside function check type. thank help! have nice day :) you use unbound generic type in list parameter of method, follow: public static void main(string[] args) { list<string> liststr = arrays.aslist("a","b","c"); list<integer> listint = arrays.aslist(1,2,3); printlist(liststr); printlist(listint); } private static void printlist(list<?> list) { for(object obj : list){ if(obj instanceof string){ string str = (string) obj;

XSLT with XML source that has a default namespace set to xmlns -

i have xml document default namespace indicated @ root. this: <myroot xmlns="http://www.mysite.com"> <mychild1> <mydata>1234</mydata> </mychild1> </myroot> the xslt parse xml not work expected because of default namespace, i.e. when remove namespace, works expected. here xslt: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:xs="http://www.w3.org/2001/xmlschema"> <xsl:template match="/" > <soap:envelope xsl:version="1.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:body> <newroot xmlns="http://wherever.com"> <newchild> <childid>abcd</childid> <childdata> <xsl:v

angularjs - Angular2 component - function not being recognised -

i trying create separate component deal presentation of news feed. works fine when have within app.component.ts, when separate code own component (news-feed.component.ts) displays fine when menu button clicked (e.g.: <button (click)="getnews('the-telegraph')">telegraph</button> ) failing recognise function 'getnews' , following error generated:' exception: error in ./appcomponent class appcomponent - inline template:4:12 caused by: self.context.getnews not function '. please note - running getnews() function within newsfeedcomponent when site first loads. here app.component.ts: import {component} '@angular/core'; import {newsservice} './news.service'; import {observable} 'rxjs/rx'; import { newsfeedcomponent } './news-feed.component'; @component({ selector: 'news-app', template:` <h1>news feed</h1> <nav> <button (click)="getnews('bb

Html and css mobile compatible -

Image
i'm trying make website friend's company , did looks on desktop computers. on phones , tablets looks bad. doing research couldn't find how use fluid layouts or other way. on phones, divs position in weird places , on other phones small or cover whole screen. , have white space on bottom of page(on phones). here link can take look: http://agrofit.hr/ p.s. on croatian don't need read :-))). please can. thanks!!!! try using percentage measurements instead of pixel measurement's. for example: .example {width: 100%} rather than: .example {width: 700px} also mentioned above use css media queries. so example: @media screen , (max-width: 700px) { img {width: 200px} } this says whenever viewing on device screen smaller 700px, image 200px. hope helps. [edit] test site on mobile - 1) open webpage want test in chrome. 2) right click , click 'inspect' 3) grey window should appear either @ bottom of browser or right hand side of bro

Entity Framework core configurations -

in ef 6 directly pass entitytypeconfiguration model builder build maps , keep our configuration class separate context without being verbose in code. have removed maps in ef core. there way add configuration without doing in model builder every class? the best way keep configuration code away onmodelcreating method. can like: create class store actual configuration: public class applicationuserconfiguration { public applicationuserconfiguration(entitytypebuilder<applicationuser> entity) { // here have stuff entity.totable("user", "identity"); entity.property(p => p.id) .hascolumnname("id); // , on .... } } and onmodelcreating instantiate new created class , pass correct entity: protected override void onmodelcreating(modelbuilder builder) { base.onmodelcreating(builder); // custom configs here new applicationuserconfiguration(builder.entity<applicationuse

c++ - getting an error linking sdl with g++ -

i know lot of people have problems none of solutions have worked im linking sdl heres code: #include <sdl/sdl.h> #include <iostream> int main() { return 0; } im using command-line g++ heres command: g++ main.cpp -o application -wall -ideps/include -ldeps/lib -lsdl2 -lsdl2main im in: c:\users\user\desktop\my_stuff\code\visual_studio_code\c++\graphics graphics has: deps include sdl gl lib libs main.cpp im getting output using -v: using built-in specs. collect_gcc=g++ collect_lto_wrapper=c:/mingw/bin/../libexec/gcc/mingw32/4.5.2/lto- wrapper.exe target: mingw32 configured with: ../../src/gcc-4.5.2/configure --build=mingw32 --enable- languages=c,c++,ada,fort ran,objc,obj-c++ --enable-threads=win32 --enable-libgomp --enable-lto -- enable-fully-dynamic-string --enable-libstdcxx-debug --enable-version-specific- runtime-libs --with- gnu-ld --disable-nls --disable-win32-registry --disable-symvers --disable-werror -- pref

asp.net web api - OWIN - clear invalid WSFederation cookies -

i implemented asp.net web api 2 project adfs cookie authentication , hosted on iis. works fine. however, clients have got old cookies became invalid because of configuration changes. such cookies cause following error when calling api: [cryptographicexception: key not valid use in specified state. ] system.security.cryptography.protecteddata.unprotect(byte[] encrypteddata, byte[] optionalentropy, dataprotectionscope scope) +447 system.identitymodel.protecteddatacookietransform.decode(byte[] encoded) +49 [invalidoperationexception: id1073: cryptographicexception occurred when attempting decrypt cookie using protecteddata api (see inner exception details). if using iis 7.5, due loaduserprofile setting on application pool being set false. ] system.identitymodel.protecteddatacookietransform.decode(byte[] encoded) +329 system.identitymodel.tokens.sessionsecuritytokenhandler.applytransforms(byte[] cookie, boolean outbound) +167 system.identitymodel.tokens.sessionsecur

html5 - Dropdown list in PHP MVC -

i looking way create drop down list depending on user chooses. if user picks package of 1 profile the output give user drop down list 1 field if user chooses 2 profiles output give user drop down 2 fields. code displays 1 dropdown if user chooses second option developing website using php , javascript <ul class="dropdown-menu <?= empty($business) ? 'hidden' : '' ?>" aria-labelledby="business_list"> <?php foreach ($business $key => $item) : ?> <li><?= html::a($item->name, ['social-manager/profiles', 'b' => $key]) ?></li> <?php endforeach; ?> </ul> try this.. <ul class="dropdown-menu <?php if(empty($business)) echo 'hidden'; ?> aria-labelledby="business_list"> <?php if(!empty($business)) { foreach($business $key => $value){ ?> <li><?php echo $value->name;?></li> <?php } } ?>

java - Pass global variable to php file through AsyncTask in Android Studio -

i populating rrecyclerview remote database wish query database dates based on users id. have userid assigned global variable on loginactivty of app i'm not sure pass information php page dateactivity. my code dateactivity follows: import android.app.progressdialog; import android.os.asynctask; import android.os.bundle; import android.support.v7.app.appcompatactivity; import android.support.v7.widget.linearlayoutmanager; import android.support.v7.widget.recyclerview; import android.widget.toast; import org.json.jsonarray; import org.json.jsonexception; import org.json.jsonobject; import java.io.bufferedreader; import java.io.ioexception; import java.io.inputstream; import java.io.inputstreamreader; import java.net.httpurlconnection; import java.net.malformedurlexception; import java.net.url; import java.util.arraylist; import java.util.list; public class dateactivity extends appcompatactivity { public static string globex_num; // connection_timeout , read_timeout in mil

regex - Need Regular expression to replace RTF control word with in text. Java -

i have string in tags can appear inside caret sysmbol ^...^ . found regular expression can find tags in string \\^.*?\\^ . after finding tags tags can contain rtf control words. it's not in cases can. here example of such tag ^l\\hich\\af39\\dbch\\af31505\\loch\\f39 ot-city^ . want replace rtf control word in tag. tried make regular expression can start \ , can contain letters or numbers or both after slash , ends space. , replace empty "" . in way have lot-city remains. how can it. tried following string tagregex = "\\^.*?\\^"; pattern tagregexpattern = pattern.compile(tagregex, pattern.multiline); matcher tagregexpatternmatcher = tagregexpattern.matcher(input); while(tagregexpatternmatcher.find()) { // work string tag = tagregexpatternmatcher.group(); string controlwordregex = "\\b\\[a-za-z]+(-?[0-9]+)? ? \\b"; pattern controlwordregexpattern = pattern.compile(controlwordregex, pattern.multiline); matcher controlwordregexpatt

android - trigger function when sound reach certain position -

i want play sound either using mediaplayer or sound pool. , want when sound/music reach position such function void hello(){ // reach position 1.5 seconds } mediaplayer.setoncertainposition(1500, hello()); // not actual code currently found create loop function every xxx millisecond , mediaplayer.getcurrentposition() from this answer is there better code? note: found audiotrack not sure how works , how use it

quill - Detect selected text replacement -

i'm looking way detect, user replacing selected text. for internal business needs, need prevent user - replacing of large portions of text. is there event can listen to, , abort text replacement ? thank in advance, - jack

ruby on rails - Ransacker and Arel on associations fields -

i have project::contribution belongs_to user , , user has_one user::profile . first_name , last_name fields contained in user::profile i want create ransacker allow me filter contributions user profile first_name , last_name . how can achieved ? this tried far : # admin/contribution.rb filter :user_full_name_cont # models/user.rb ransacker :full_name |parent| arel::nodes::infixoperation.new('||', parent.table[:profile_first_name], parent.table[:profile_last_name]) # error end this fails because of : parent.table[:profile_first_name] , parent.table[:profile_last_name] because can't access profile table so. finally came solution : # models/user/profile.rb ransacker :full_name, formatter: proc { |v| v.mb_chars.downcase.to_s } |parent| arel::nodes::namedfunction.new('lower', [arel::nodes::namedfunction.new('concat_ws', [arel::nodes.build_quoted(' '), parent.table[:first_name], parent.table[:last_na

classification - Supervised Machine Learning algorithms -

i trying classify data using supervised machine learning algorithms. everything's working fine, curiosity, tried 6 classification algorithms simultaneously on single data set. steps followed follows- 1> train algorithms. 2> predicted result( either 1 or 0 ) test_data individually, algorithms. 3> if of algos gave 0 , considered result data pair 0 , result 1 . 4> found out overall accuracy. expected overall accuracy higher individual results(by each algorithm working individually), got average accuracy.(average here means average of accuracies of individual algos). can please me find reason? this depends on algorithms picked. many algorithms sensitive different things. instance, k-means, linear svm, , power iteration clustering markedly different results. you got asked for: averaged votes, without coordinating algorithms in way. got average result. i doubt weighted averaging much; you're doing there training meta-model. in

html - .net best way to render advance forms? -

i plan on making advance form system cms company use. options found wpf, winforms or render in html on offline application. i have varying level of experience first 2 third 1 never came across until while researching topic (unless i'm poorly searching it) can not seem find info it. need system dynamically create each form via code. my question situation, choose , explain little more html rendering method , how create type of system. we aren't building system can't advise should do winforms pros classic structure easy pick if familiar classic desktop development cons rigid structure controls functions , appearance closely coupled meaning doing none standard difficult wpf pros loosely coupled function , appearance, means can customise pretty every element of controls similar css high automation level, binding built in fundamental function cons very different classic structure mvvm style required, trying out bad idea, meaning can ha

dagger 2 - Dagger2 - should an activity component be a sub-component of other? -

i used @subcomponent case activities need use shared objects application component, or fragments components want use objects provided container activity. now wondering if can make activity components subcomponent of activity component. example, taskdetailactivity has task object , want provide other activities such taskparticipantactivity , taskprogressactivity , fragments. the traditional way provide task object other activities set intent object, how if want use dagger2 case? update: sistuation similar case of userscope in article http://frogermcs.github.io/dependency-injection-with-dagger-2-custom-scopes/ , instead of saving user component in application class, can save in activity, i.e taskdetailactivity ? components grouping objects of similar lifecycle. while components may happen correspond particular set of functionality (like taskcomponent injecting taskactivity , taskpresenter ) not possible or desirable insist on 1 component per set of functionality

Android Sync Adapter: Detect if user has pressed sync now button -

Image
i'm making app instant backup paid feature. background service not reliable way implement sync, used sync adapter handle sync. now have somehow know if user has pressed "sync now" button ins settings (shown in picture below) i have checked extras in onperformsync method, not working. can know how it?

java - Unable to access DesiredCapabilities methods -

my question : created desiredcapabilities instance shown in below code : public class testcommons { desiredcapabilities capabilities = desiredcapabilities.firefox(); capabilities.setcapability("marionette", true); webdriver driver = new firefoxdriver(); public void setup() { driver.navigate().to( "http://toolsqa.wpengine.com/automation-practice-form/"); driver.manage().window().maximize(); driver.manage().timeouts().implicitlywait(20, timeunit.seconds); system.out.println(""); } public void teardown() { driver.close(); } } when write capabilities. in next line not getting eclipse intellisense options. , if write capabilities.setcapability , showing error. in code , in setup() method when write capabilities. options. why not getting eclipse intellisense outside method? attached screenshot. desiredcapabilities instance this because have write c

https - Run node.js as secure server and use webRTC when IIS is using port 443? -

i trying use webrtc stream audio client node.js. problem is: webrtc not work on http, https. - iis using port. tried establishing node.js listen port 443: first attempt: use https.createserver, on port 9001: node.js script: var options = { key: fs.readfilesync('../cert/key.pem'), cert: fs.readfilesync('../cert/server.crt') }; var httpsserver = https.createserver(options).listen(443); var server = binaryserver({ server: httpsserver, port: 443 }); client script: client = new binaryclient('ws://example.com:443'); i'm getting error in node script, first question is: because port 443 being used iis? throw er; // unhandled 'error' event ^ error: listen eacces 0.0.0.0:443 @ object.exports._errnoexception (util.js:1018:11) @ exports._exceptionwithhostport (util.js:1041:20) @ server._listen2 (net.js:1249:19) having error, tried using different port (9001). second attempt: use https.createserver, on port 9001:

azure - How to associate public Ip Address with an existing domain name -

i don t understand how dns works! i have public ip address bouaght azure , website has domain name (mywebsite.com) tied old server. now have bought new vm in azure ( ubuntu). now, how can change domain name (mywebsite.com) point new public ip address of vm @ azure. do have in command line or not? ?? you should gave @ article walter linked - covers full scenario end end. i assume you're using azure resource manager, you've mentioned public ip address resource. don't mention if you've configured dns name public ip address, or if has static or dynamic ip address. can find full details public ip address resource here: https://docs.microsoft.com/en-us/rest/api/network/create-or-update-a-public-ip-address you're going need log service on you're hosting mywebsite.com , create dns record. record depends on below: -if need users hit zone apex , resolve website (i.e. mywebsite.com), need ensure public ip address static, , create record ip addres

post curl to rest interface using a shell script -

i try create script send messages nagios servers rest api in json. i try this: /usr/bin/curl \ --header "content-type: application/json" \ --request post \ --data '{"u_id": "$notify_serviceproblemid", "u_date_time" : "$notify_shortdatetime", \ "u_state" : "$notify_serviceshortstate", "u_host" : "$notify_hostname", "u_address" : "$notify_hostaddress", \ "u_description" : "$notify_hostalias/$notify_servicedesc $notify_servicestate"}' \ https://my-rest_api but not working.. variables start $notify should expand. i wondering should end single quotes since single quotes must part of json being sent rest api. thank you

user interface - MATLAB GUI - Button Press returning error -

i have simple matlab gui code, find attached. when button pressed runs function. however when press button twice, throwing error undefined function 'gui' input arguments of type 'struct'. error in @(hobject,eventdata)gui('pushbutton1_callback',hobject,eventdata,guidata(hobject)) error while evaluating uicontrol callback % --- executes on button press in pushbutton1. function pushbutton1_callback(hobject, eventdata, handles) % hobject handle pushbutton1 (see gcbo) % eventdata reserved - defined in future version of matlab % handles structure handles , user data (see guidata) set(handles.pushbutton1, 'enable','off'); output = randomfunction(); = 1 while(1) = a+1 if == 4 break; end end set(handles.pushbutton1, 'enable','on'); the issue randomfunction must either change current working directory or modify path such gui function ( gui.m ) no longer on path , abl

In CS-Cart What is the relationship between themes, templates, blocks and layouts? -

so: understand following: templates belong theme. css belongs theme. css , html belong theme. the layout 'above' in way blocks dynamically generated content (content stored in database) , edited through layout editor , assigned specific location in layout. there built-in blocks available pull out specific data. blocks kind of component or widget. i've seen in layout 1 can specify controller , view (presumably dispatcher). so; example; dispatch: viewproduct products.view i'm guessing means layout in loaded theme products view template? in template /templates/views/products/view.tpl find 2 pieces of interest: i. {hook name="products:layout_content"} ii. a comment: "one of selected product templates connected, depending on 'product details view' setting" my questions are: what hook line doing here? and what/where product details view' setting? thanks

javascript - Select not displaying correct selected value after update -

this select in html: <select id="bgposition"> <option value="left top" selected="selected">left top</option> <option value="center top">center top</option> .. </select> on page load need update selected value one, tried .each .prop , this: function setactiveoption(el,val){ $(el).find('option:selected').removeattr('selected'); $(el).find('option[value="'+val+'"]').attr('selected','selected'); console.log('selected: '+$('#bgposition').val()) } all ok other select boxes, not #bgposition think because values contains spaces. selected attribute in right place, displaying first option selected any idea how can fixed? i tried different jquery libraries update: my fiddle , how running functions. given example fiddle, select element doesn't respect value set middle one, #bgrepeat ,

c++ - how to use boost::serialize::make_binary_object against a map -

my intention input map<int,std::string> , create binary archive below code failing , right way of creating it? , how know whether data correctly archived or not(desirializing using boost) need create boost::archive::binary_iarchive oa(oss,1); , copy oss ? #include <fstream> #include <boost/serialization/map.hpp> #include <boost/serialization/nvp.hpp> #include <boost/archive/xml_oarchive.hpp> #include <string> #include <iostream> #include <map> #include <boost/archive/binary_oarchive.hpp> #include <boost/archive/binary_iarchive.hpp> #include <boost/serialization/serialization.hpp> using namespace std; class myconnections { public: myconnections() { e_group.insert( std::make_pair(1,"etoto") ) ; e_group.insert( std::make_pair(2,"etoto") ) ; } template<class archive> void serialize(archive& ar, const unsigned int version) { using boost::serialization:

like another field concat in MYSQL -

i trying use inner join statement... inner join r_data r on r.ids_logs concat("%",l.id,"%") ...but error message. you have error in sql syntax; check manual corresponds mysql server version right syntax use near '' @ line 5 why error generated? there appears invalid character @ end of inner join statement. try remove character , try again execute statement.

Use a key which is the value of a constant in a hash in perl -

please check code below: my %hash = ( 123 => "a", 456 => "b", ); use constant x_1 => 123; use constant x_2 => 456; i want use $hash{x_1} "a". tried store x_1 variable , use key, worked. my $var = "x_1"; # or $var = x_1 but when variable x_1 array store variable, , try access hash variable, shows error. my @arr; $arr[0]{"y_1"} = "x_1"; $arr[0]{"z_1"} = "x_2"; $newvar = $arr[0]{"y_1"};#$newvar = x_1 print $hash{$newvar}; #this shows error. how use variable not string constant here? i want use $hash{x_1} "a" by using identifier, expression won't autoquoted. example, use of following: $hash{+constant} $hash{(constant)} so use $hash{+x_1} instead of $hash{x_1} . how use variable not string constant here? you rightfully ask prevented doing adding use strict; because it's dangerous (meaning hard read, hard debug, hard ma

java - Auto-injection custom ErrorHandler in spring-rabbitmq -

we know can inject custom message converter: @bean messageconverter messageconverter(){ return new custommessageconverter(); } however in case of errorhandler doesn't work. why ? can conclude code in way ? that's true. spring boot's rabbitannotationdrivenconfiguration doesn't support injection. you have declare own simplerabbitlistenercontainerfactory @bean , supply desired errorhandler injection, other required options, including messageconverter . note overriding out-of-the-box bean should specify own 1 rabbitlistenercontainerfactory name meet condition: @bean @conditionalonmissingbean(name = "rabbitlistenercontainerfactory") public simplerabbitlistenercontainerfactory rabbitlistenercontainerfactory(

dataset - Separate long and complex names in R -

say have following list of full scientific names of plant species inside dataset: fullspeciesnames <- c("aronia melanocarpa (michx.) elliott", "cotoneaster divaricatus rehder & e. h. wilson","rosa canina l.","ranunculus montanus willd.") i want obtain list of simplified names, i.e first 2 elements of given name, namely: simplespeciesnames<- c("aronia melanocarpa", "cotoneaster divaricatus", "rosa canina", "ranunculus montanus") how can done in r? we can use sub match word ( \\w+ ) followed 1 or more white space ( \\s+ ) followed word , space, capture group, , rest of characters ( .* ). in replacement, use backreference of captured group ( \\1 ) trimws(sub("^((\\w+\\s+){2}).*", "\\1", fullspeciesnames))

c# - how to keep email conversation together. MVC website -

i'm working on ticketing system, staff can send email customers using smtp , when customer replies fetch using imap , add ticket. right i'm adding ticketid in subject line,so when email comes in can append existing ticket. but @ times customers remove subject line , reply creates new ticket. can advice me how around it. think zendesk appends ticketid in email address, not sure if work. most systems have comment in replies telling customer not edit subject line. if remove subject, can instead search email content (if included previous reply information of subject line) perhaps first 200 lines if want limit it, using regular expression pattern match subject line text string , extract ticket number that.

c++ - how to assign an int to char* with operator overload -

this question has answer here: overloading operator=() callback 1 answer i have class saves big numbers string , can general mathematical operations on it. 1 of these operations assigning int (0-9) 1 digit of big number. question how can overload operators , convert int value char* , save instead of digit in string. following code should work: \\ bignumber[3] == '8' bignumber[3] = 4 \\ bignumber[3] == '4' you can convert string int number; std::ostringstream stream_string; stream_string << number; string numberstring = stream_string.str(); if want convert string char* bignumber[0] = numberstring.c_str();

Error when using Relay + React Native (create-react-native-app): GraphQL validation error `Unknown Type "Viewer".` -

i'm trying set rn app (that created create-react-native-app ) , connect relay. i've got following setup in app.js already: import { stylesheet, text, view } 'react-native' import relay, { route, rootcontainer, } 'react-relay' import pokemonlist './components/pokemonlist' relay.injectnetworklayer( new relay.defaultnetworklayer('https://api.graph.cool/relay/v1/ciyeih9590fhl0162e5zh1z4h', { headers: { }, }) ) class indexroute extends route { static queries = { viewer: () => relay.ql`query { viewer }` } static routename = 'indexroute' } export default class app extends react.component { render() { return ( <view style={styles.container}> <rootcontainer component={pokemonlist} route={new indexroute()} renderfetched={(data) => <pokemonlist {...this.props} {...data} />} /> </view> ) } } the pokemonlist does