Posts

Showing posts from February, 2015

javascript - How to set relative path resolution based on 'dist' folder -

when creating npm package, quite common , convenient structure so: root / dist / src / package.json where package.json : { "main": "dist/index.js" "files": [ "dist" ] } the drawback of approach is, when consumer wants require files using relative path, needs include dist folder. e.g. const abc = require('my-package/dist/x/y/abc'); is there way tell nodejs resolve relative path based on path.dirname(main) or similar? update: clarify, related relative/deep resolution, not export hoisting in es6. controversial subject should done @ all, consumer coupled internal folder structure of package. update 2: want achieve concept of "sub-module" (similar namespacing). example, folder structure looks this: root / dist / testutil.js / index.js testutil.js contains useful functions testing. since not used in normal use, don't want export them @ top-level. i.e., instead of: // index.js export

java - Implementing rxJava in a library with interfaces which return values -

so have android library has several interfaces callbacks various things. i'm working on extension module wrap library in rxjava. i've got of callbacks covered, ran issue in couple of spots. so there couple of interfaces used filters essentially. callback gets called, , returns value library know next. a simple example public interface myfilter { reaction oncallback(someevent event); } public void someinternalmethod() { // event happens here need let library user know reaction reaction = filter.oncallback(event); if (reaction.dothing1()) { ... } else if (reaction.dothing2() { ... } so library user implement interface tell library how proceed when "someevent" happens. library user observing someevent, library needs return value know how proceed on said event. as onnext method returns void, i'm not sure best way implement this.

php - yii2 transfering navbar widget parametres to single html parametres -

i going make yii2 popup window feedback form , followed programmers tutorial. in tutorial programmer gave these parametres navbar in main.php echo nav::widget([ 'options' => ['class' => 'navbar-nav navbar-right'], 'items' => [ ['label' => 'home', 'url' => ['/site/index']], ['label' => 'about', 'url' => ['/site/about']], **['label' => 'contact', 'url' => '#', 'options' => ['data-toggle' => 'modal', 'data-target' => '#mymodal']]**, the programmer gave these parametres inside nav widget in contact label, 'options' => ['data-toggle' => 'modal', 'data-target' => '#mymodal'] however, must use -->['data-toggle' => 'modal', 'data-target' => '#my

javascript - what is the proper way to create a Joomla component that can write files on click of button? -

i trying create joomla administrator component - non commercial later. component bootstrap customiser joomla theme - protostar. example - trying achieve in joomla admin component - https://getuikit.com/v2/docs/customizer.html the component will: 1) read front end page , show in iframe 2) import less files , allow modification of template's less variables 3) on click of button "recompile less", compile less , update iframe , write compiled less css files. as of now, have entry file in component, call helper compile less. files have helper.php , componentname.php , less compiler php file require. need controller? need view.xyz.html ? know mvc pattern joomla simple task, not sure how implement. thanks

python 2.7 - mongodb - querying & projecting element value from nested array -

Image
i have nested arrays below in 1 of collections, how retrieve value specific sub array & don't need of other fields in document. have tried using following query didn't me expected output, query: db.getcollection('my_collection').find({"_id":"08d4608a-e6c4-1bd8-80e6-8d1ac448c34b"},{"_id":0,"customproperties.0.1":1}) you can try db.getcollection.find({ "somearray.somenestedarray.name": "value" })

d3.js - programatically click on sankey node -

i working on sankey collapsible view. got inspiration https://bl.ocks.org/thebiro/f73a2a0625bb803179f3905fe7624e22 there functionality click on node node collapses. i have requirement node or nodes , it's children should collapsed when sankey generate. e.g collapse: pagou n_pagou and children programatically. i.e when sankey generates. , user can click on above 2 nodes , uncollapses it. following 2 nodes should collapsed when sankey first generates.

amazon web services - Unable to ssh into one EC2 instance from another in same VPC -

i trying ssh 1 ec2 instance (in-ports:22,443) db server (another ec2) in-port 3306 sg-group of first ec2 group. ec2 instance 1: security group a- inbound: port 22 & 443, source: '0.0.0.0/0' ec2 instance 2 (db server): security group b- inbound: port 3306, source: 'security group a' when try ping 2 1, connection times out. what doing wrong? are trying ssh server 1 server 2, or trying connect database on server 2 server 1? question unclear, says want ssh port 3306, makes no sense. ssh works on port 22 default. port 3306 default mysql database port. the way security groups configured, can ssh server 1, , can use mysql client on server 1 connect mysql database on server 2. if want ssh server 1 server 2, need top add rule security group b: inbound: port 22, source 'security group a'. you shouldn't worry ping. protocol ping (icmp) blocked security groups, ping isn't going useful test.

r - Clean way to reorder tidyr spread after nest and purrr map -

Image
consider following: library(tidyverse) library(broom) tidy.quants <- mtcars %>% nest(-cyl) %>% mutate(quantiles = map(data, ~ quantile(.$mpg))) %>% unnest(map(quantiles, tidy)) tidy.quants #> # tibble: 15 x 3 #> cyl names x #> <dbl> <chr> <dbl> #> 1 6 0% 17.80 #> 2 6 25% 18.65 #> 3 6 50% 19.70 #> 4 6 75% 21.00 #> 5 6 100% 21.40 #> 6 4 0% 21.40 #> 7 4 25% 22.80 #> 8 4 50% 26.00 #> 9 4 75% 30.40 #> 10 4 100% 33.90 #> 11 8 0% 10.40 #> 12 8 25% 14.40 #> 13 8 50% 15.20 #> 14 8 75% 16.25 #> 15 8 100% 19.20 which great , tidy, however, when attempting spread (or pass plot), names column returns in (somewhat) unexpected order: tidy.quants %>% spread(names, x) #> # tibble: 3 x 6 #> cyl `0%` `100%` `25%` `50%` `75%` #> * <dbl> <dbl> <dbl> <dbl>

javascript - Relative vs. non-relative module import for custom modules -

update[09/12/2017 16:58 est] added reason why hesitate use natively-supported non-relative import own modules bottom of question. update[09/12/2017 12:58 est]: per request, made file structure below reflect actual use case. nested view module requesting utility module somewhere directory tree. per request in both typescript , es6, 1 can import custom module by // relative import { numberutil } './number_util'; // or // non-relative import { numberutil } 'number_util'; and according typescript docs ( link ), 1 should: ... use relative imports own modules guaranteed maintain relative location @ runtime. ... use non-relative paths when importing of external dependencies. my problem here have project structure this: project/ |--utils | |--number_util.ts |--views | |--article_page | |-- editor_view | |--editor_text_area.ts and when include utils/number_util inside editor_text_area module

Export Module Using Macro -

i'm stepping through code export module using this post, nothing happens. there security setting allow vba permission export module? i'm copying few tabs workbook new workbook, tabs have macros lead broken links. around want move module , re-associate macro. if can't work copy whole workbook , delete info don't want in destination. here's code above post: public sub copymodule(sourcewb workbook, strmodulename string, targetwb workbook) ' description: copies module 1 workbook ' example: copymodule workbooks(thisworkbook), "module2", ' workbooks("food specials rolling depot memo 46 - 01.xlsm") ' notes: if module copied exists, removed first, ' , afterwards copied dim strfolder string dim strtempfile string dim fname string if trim(strmodulename) = vbnullstring exit sub end if if targetwb nothing msgbox "error: tar

oracle - SSRS ORA-12571 encountered error message -

Image
i'm working on oracle code in ssrs. i'm getting following error message: i'm not sure why i'm getting error. can explain me? select h."dept name", c."id", c."fullname", c."fte", bu "bu",'overtime' "paytype", f."paycode", d.start_date "date", sum(d.time_in_seconds/60/60) "hours", sum (d.gross_pay_amount) "dollar" , b, c, d, f, bu, h a.effective_date =(select max(e.effective_date) e a.= e. emp_records a.job_id = e.job_id a.emp_record_id = c.personnum) , b.status <> 'd' , a.sequence=0 , d.start_date >= (:startdate, 'yy-mon-dd') , d.end_date <= (:enddate,'yy-mon-dd') , d.pay_type in ('f','r') group h.laborlev2nm, h.laborlev2dsc, f.name, f.abbrv, c.personnum, c.fullnm, c.ftepct, bu.external_

r - Always get 401 error from reddit API using oauth_token2.0 from httr package -

as title says, i'm trying connect reddit api, i've created app (named comment extractor) on profile, , copy paste public , secret keys, , use http://localhost:1410/ redirect uri , url. app script, tried web app same result. the code i'm using copy pasted hadleys httr demos, exchanged keys own (everything done latest version of httr, 1.3.1). library(httr) # 1. find oauth settings reddit: # https://github.com/reddit/reddit/wiki/oauth2 reddit <- oauth_endpoint( authorize = "https://www.reddit.com/api/v1/authorize", access = "https://www.reddit.com/api/v1/access_token" ) # 2. register application @ https://www.reddit.com/prefs/apps app <- oauth_app("comment extractor", "rrg5wfghkm5kvw", "[secret key]") # 3b. if 429 many requests, default user_agent overloaded. # if have application on reddit can pass using: token <- oauth2.0_token( reddit, app, scope = c("read", "modposts")

how to fix npm webpack install error 4048? -

so.. tried intall webpack, webpack-dev-server , html-webpack-plugin, in developer mode. instalation interrompted following error: npm err: path: c:\user\leonardo kalyn\documents\vs projects\study\node_modules\fsevents\node_modules\abbrevzpackage.json npm err: code eperm npm err: errorno 4048 npm err: syscall unlink operation not permited. and asks me run root/adm when try run again adm. my os windows 10 node 8.4.0 npm 5.4.1 i've found lot posts same error number , code, , same , different syscall, no working solution far. ps error occurs atempt install webpack, create-react-app

javascript - How do I run a graqphl query in gatsby-browser.js -

i want run graphql query inside wraprootcomponent / replaceroutercomponent . both methods belong gatsby browser api . documentation , code unable find possibility run graphql query.

angular 4 programmatic animation -

how add animation programatically ? @component({ moduleid: module.id, selector: 'my-toolbar', templateurl: './my-toolbar.component.html', styleurls: ['./my-toolbar.component.scss'], encapsulation: viewencapsulation.none, animations: [ trigger('mytoolbarstate', [ state('initial', style({top: '*'})), state('up', style({top: '-50px')), transition('initial => up, => initial', animate(header_shrink_transition)) ]) ] }) how achieve same without annotation ? underlying goal create dynamic trigger function uses different values based on @input . it important note animations or triggers must have at-least 1 variable. makes question different how reuse animations. i ended following factory class shown below being used animations[] :- this used below: @component({ selector: 'my-app-header',

sqlite3 - Android SQLite queries marked as Error by Android Studio -

in 1 of android apps use sqlite queries starting give problems since i've updated android studio 3.0 . despite can compile , run app marked error. these queries. db.execsql("insert table1 (…) ... substr(replace(table2.field2, ',', ''), table1.field1, 1) … table1 … …"); gives error in 'replace': ')' or expression expected, got 'replace' i think work because replace returns string . and: db.execsql("delete table1 table1.rowid in (…)"); gives error in 'rowid': column name or table name expected, got 'rowid' i think work because sqlite adds implicit rowid each table. and: db.execsql("attach database ? newdb", new string[] { getdatabasepath(database_name_new).getpath() }); gives error in '?': expression expected, got '?' i've changed query this: db.execsql("attach database '"+getdatabasepath(database_name_new).getp

android - Trust anchor for certification path not found with okhttp -

so i've been trying night make work, nothing seems trick ... keep getting trust anchor certification path not found. here how i'm build okhttpclient (i followed https://medium.com/@sreekumar_av/certificate-public-key-pinning-in-android-using-retrofit-2-0-74140800025b ) fun provideokhttpclient(): okhttpclient { val httpclientbuilder = okhttpclient() .newbuilder() val logging = httplogginginterceptor() logging.level = if (buildconfig.debug) httplogginginterceptor.level.body else httplogginginterceptor.level.none val certificatepinner = certificatepinner.builder() .add(host, sha) .build() val connectionspec = connectionspec.builder(connectionspec.modern_tls) connectionspec.tlsversions(tlsversion.tls_1_2).build() val tlssocketfactory = tlssocketfactory() return httpclientbuilder .certificatepinner(certificatepinner) .addnetworkinterceptor(logging)

unix - Informix 4GL String -

how use informix 4gl string variables? should import or add library? i want use variables of variable length text , split type function separate fields of first string pipes. name | age | city arrangement [1] = name arrangement [2] = age arrangement [3] = city the version of informix use 12.10. i want separate string of text stored in file , save in record. define rg_customer record idcustome nchar(12), cdprovee nvarchar(10), mcnifnie nvarchar(1), nunif nvarchar(22), tpidpers nchar(1), tpcomuni nchar(1), cdnacint nchar(1), age int end record

sql - How to JOIN two tables on behalf of Max date -

i have tried following. query working returning more rows not expected. select x,y,z (select (t1.hour*4) + int (t1.minuts/15 ) +1 x,t1.amount y, t1.date,t2.amount z table1 t1 inner join (select * table2 date=(select max(date) table2 ))as t2 on t1.store=t2.store t1.date = (select max(date) table1 )) sample data:= store date day_of_wk hour minuts amount 574 13-03-2017 2 0 0 0.00 574 13-03-2017 2 0 15 0.00 574 12-03-2017 2 0 30 0.00 574 11-03-2017 2 0 45 0.00 574 11-03-2017 2 1 0 0.00 574 13-03-2017 2 1 15 0.00 both table having same data there different business logic on amount column. what need amount , time id both tables of max date. solved following query=> select t1.id x,y,z (select (hc.hour * 4) + int (hc.minuts/15 ) + 1 id, amount y, date table1 hc date = (select max(date) table

java - How to move folder and files? -

my program uses file database , wondering how move folder without deleting files within folder. using java. when press button them move specified location. code on button looks this: private void uploadbuttonactionperformed(java.awt.event.actionevent evt) { // todo add handling code here: projectinfo.documenttitle = filename.gettext(); projectinfo.movefilelocation = filespecificlocation.gettext(); string name = usernametext.gettext(); signup.filetomoveto = "c:\\cloudaurora\\" + name + "\\"; string docttl = projectinfo.documenttitle; // docttl.renameto(new file(signup.filetomoveto)); projectinfo.documenttitle = filename.gettext(); projectinfo.movefilelocation = filespecificlocation.gettext(); string name = usernametext.gettext(); signup.filetomoveto = "c:\\cloudaurora\\" + name + "\\"; string docttl = projectinfo.documenttitle; system.out.print

javascript - I want to create this page scroll animation with CSS3. Is it possible? -

the page scroll animation: https://codyhouse.co/demo/page-scroll-effects/gallery-hijacking.html i'm wanting use effect on wordpress site, i'm not javascript. easiest way of implementing or similar? possible css3?

JSON list of dictionaries to python -

Image
my json file list of dictionaries i able open not sure how access "the_dict" dictionary can retrieve , print "test" , "pie" in python program. with open('my_settings.json') json_data: config = json.load(json_data) # my_words = config["the_dict"] tried not work config_file list, not dictionary, have observed. need access first dictionary in list, , call key "the_dict" "words" list of words: my_words = config_file[0]["the_dict"]["words"]

html - CSS - textarea overlapping other elements on Android -

Image
i have textarea described as: <textarea id="textarea" name="body" rows="6" required></textarea> with css follows: textarea { display: block; margin: 0; width: 100%; font-size: 2em; border: 1px solid #bbb; } textarea { font-family: sans-serif; } as can see in screenshot below, textarea doesn't size 6 rows, denoted inline, instead overlaps other elements. using chrome dev on android 5.0 on samsung galaxy s5. how can prevent textarea overlapping other html? a screenshot chrome version 60.0.3112.113 on windows, reference [

telegram bot, callback query of an inline button in a group chat, redirect the user to private chat of bot. python -

my bot sends messages groups inline button, want, when button clicked, chat bot page should open, i.e. somehow redirect user private chat bot. i'm using this wrapper. what have tried far set url in answer_callback method, equal url of bot i.e. url="https://t.me/my_sample_bot keep getting url_invalid response telegram, tried http(since read somewhere in api documentation urls should http), did not work either. my question doing right? mean have set url in answer_callback method redirect user, or should try way? well figured out myself, setting url right way it, , though wrappers documentation not detailed, took @ source code , there docstring method answer_callback_query said url: :param url: (optional) url opened user's client. if have created game , accepted conditions via @botfather, specify url opens game – note work if query comes callback_game button. otherwise, may use links telegram.me/your_bot?start=xxxx open bot parameter. so ha

c++ - MinGW path set but not being found at Powershell -

i started learning c++ in class, , have trouble setting built environment. our class uses mingw , vs code default building environment, followed class guideline install necessary mingw libraries , added directory of mingw bin folder environment variables(path). so worked first time, after reboot vs code cannot find gcc , g++. typing gcc --version , g++ --version @ cmd works well; shows version info. however, typing in powershell(which vs code uses) not work anymore. i'm totally new c++ , related environment, have fix trouble. in advance. try add system environment variable, , var name "g++" value "c:\mingw\bin\g++.exe"(replace path g++.exe file path).maybe should restart computer apply operation if windows os version windows 10.

javascript - Does AngularJS Route needs to import the same script in all the views that is needed? -

i have main thread , imports @ end of script ajax calls, when call view uses script need reimport script on view , "jquery-2.1.1.min.js:4 [deprecation] synchronous xmlhttprequest on main thread deprecated because of detrimental effects end user's experience. more help, check https://xhr.spec.whatwg.org/ "

How do you migrate from a list to a class C# DataContract Serialization? -

how can migrate configuration new class list of bools? used list of bool, list being abused class, each index having specific meaning field. i want migrate list, class instead acts list serialization purposes, exposes normal fields rest of application. how can write class listemulator serializes out list, without introducing new xml tags? old code namespace { [datacontract] public class configuration { public const string filename = "configuration.xml"; public configuration() { alist = new list<bool>(); aguidlist = new list<guid>(); } [datamember] public list<guid> aguidlist { get; set; } [datamember] public list<bool> alist { get; set; } } } new code. namespace { [datacontract] public class configuration { public const string filename = "configuration.xml"; public configuration() {

model view controller - Cannot close Dialog on Python PyQt4 -

my program has mainwindow contains inventory system. have added dialog window pop-ups when clicked "add item". able open dialog window can't seem close it. when user tries close dialog window, display messagebox asking if user wants close window. currently, i'm using self.close() . closes messagebox i've made prevent accidental exit , doesn't close dialog window unless end using ide or task manager. here's code snippets: main.py class main(qtgui.qmainwindow): def __init__(self): qtgui.qmainwindow.__init__(self) self.db = database() self.model = model(self) self.ui = mainwindow_ui() self.ui.setupui(self) self.window = ui_dialog() self.ui.additem.clicked.connect(lambda : self.start_form()) def start_form(self): window = qtgui.qdialog() self.window.setupui(window) self.window.show() def main(): app = qtgui.qapplication(sys.argv) window = main()

ios - UITableViewCell - shadow when clicking -

Image
i'm starting swift , xcode, created tableview , cell , works, there shadow when clicking on cell. here screen: what did: created cell, added image view 5 pixels top , 5 pixels bottom constraints. how can remove shadow? that default selection style of table view cell. if want disable that, should change selectionstyle .none inside uitableviewcell subclass. selectionstyle = .none

React-Native-Camera Error when take photo with modified flashMode attribute -

i getting following error when trying take photo flashmode attribute modified: { nslocalizeddescription: 'error domain=avfoundationerrordomain code=-11800 "the operation not completed" userinfo={nsunderlyingerror=0x170440210 {error domain=nsosstatuserrordomain code=-16800 "(null)"}, nslocalizedfailurereason=an unknown error occurred (-16800), nslocalizeddescription=the operation not completed}' } } 2017-09-12 00:08:29.907053-0300 gimenesapp[1936:765074] { [error: error domain=avfoundationerrordomain code=-11800 "the operation not completed" userinfo={nsunderlyingerror=0x170440210 {error domain=nsosstatuserrordomain code=-16800 "(null)"}, nslocalizedfailurereason=an unknown error occurred (-16800), nslocalizeddescription=the operation not completed}] here piece of code using: <camera capturetarget={camera.constants.capturetarget.disk} ref={(cam) => { this.camera = cam; }} fla

python - Assuming `obj` has type `objtype`, are `super(cls,obj)` and `super(cls,objtype)` the same? -

in python, assuming obj has type objtype , super(cls,obj) , super(cls,objtype) same? is correct super(cls,obj) converts obj object class superclass of objtype after cls in mro of objtype ? what super(cls,objtype) mean then? for example, given implementation of singleton design pattern: class singleton(object): _singletons = {} def __new__(cls, *args, **kwds): if cls not in cls._singletons: cls._singletons[cls] = super(singleton, cls).__new__(cls) return cls._singletons[cls] any subclass of singleton (that not further override __new__ ) has 1 instance. what super(singleton, cls) mean, cls class? return? thanks. according docs , super return proxy object delegates method calls parent or sibling class of type. so super returns object knows how call methods of other classes in class hierarchy. the second argument super object super bound; instance of class, if super being called in context of met

eclipse - What is difference between AndroidDriver from Selenium and java-io[Appium]? -

as there androiddriver class present in both libraries while performing mobile device automation, major differences in between these 2 classes? io.appium.java_client.android.androiddriver org.openqa.selenium.android.androiddriver appiumdriver class contains methods shared ios , android. iosdriver , androiddriver both extend appiumdriver , provide more methods, , specific implementations methods. differences: appiumdriver abstract class androiddriver concrete class extends appiumdriver class appiumdriver class not implement interface androiddriver class implements generic , non-generic interfaces seen in declaration appiumdriver parent class , androiddriver child class appiumdriver contains abstract,non-abstract methods androiddriver being concrete class not contains abstract methods, override methods of appiumdriver class, androiddriver class not add new method class partially can appiumdriver abstract design pattern , androiddriver class d

physics - Optimizing Fly Overs in STK 10 -

i'm trying math find the orbit fly on greatest amount observatories anywhere in world. in stk 10, i'm plotting many observatories can , seeing ones hit - tedious process. i'm not sure stk able find orbit me once plot each observatory, new software. if able tell me if there function within stk can determine such orbit me, appreciate it. otherwise, giving me rundown on of math i'd need use determine orbit equally appreciated. i can here (full disclosure, i'm vp of engineering @ agi, creators of stk). there's no magical function in stk (or other similar tool i'm aware of) this. can tell whether have "coverage", after it's optimization problem. here bunch of questions you'll need able answer frame out problem: fly on during period of time? 1 day, 1 week, 1 month? what definition of fly over? using constraint properties on each of objects. example, if trying model when satellite might in view of observatory can viewed through te

c# - Can I convert my code using await to use call-backs instead -

i new @ c#, , converting swift bluetooth le code c# uwp. i have code working uses async/await. make similar have in swift, think i'd ideally callback when apis async complete. for example, swift code: private func connect_to( per : cbperipheral) { centralmanager?.connect( per, options: nil) } func centralmanager(_ central: cbcentralmanager, didconnect peripheral: cbperipheral) { peripheral.delegate = self peripheral.discoverservices([transferserviceuuid]) } the second func call-back. in c# have things this: private async void connectbyid_oraddr( uint64 btaddr) { btledev = await bluetoothledevice.frombluetoothaddressasync(btaddr); if (btledev == null) { // todo: failure notifications... return; } gattdeviceservicesresult result = await btledev.getgattservicesasync(bluetoothcachemode.uncached); // etc. } i saw references using delegates in c#, wasn't clear me how api calls. you can use continuewith chain tasks

java - Fetching only message headers from Gmail -

i'm writing small app generate stats in gmail inbox endless task of cleaning our mailbox. my code working, unnecessarily download messages's payload data access message headers (from field header). the method gmail.users.messages.get.setfields(string) payload option, payload heaviest part of it. tried using values "payload.header", "payload.headers", none of these values work. so question is, how can access message's field instead of fetching entire payload data in order improve performance? map<string, integer> emailaddresscountmap = new hashmap<string, integer>(); (message message : messages) { message m1 = service.users().messages().get(user, message.getid()).setfields("payload").execute(); stream<string> fromheadervalue = m1.getpayload().getheaders().stream() .filter(h -> "from".equals(h.getname())).map(h -> h.getvalue()); string emailaddress =

mysql - Can't Insert multiple rows using two forms at same page -

this form page form.html <html> <head> </head> <body bgcolor="blue"> <table> <form action="masemp12ad.jsp" method="post"> <tr><th colspan="2" bgcolor="#c0c0c0">employee referees</th></tr> <tr><td>name:</td><td><input type="text" name="name" maxlength="30"> </td></tr> <tr><td>residential address:</td><td><textarea name="add" rows="10" cols="30"></textarea></td></tr> <tr><td>phone no:</td><td><input type="text" name="no" maxlength="30"></td></tr><tr><td></td><td></td></tr> <tr><td>name:</td><td><input type="

ios - Show UIAlertController from a common utility class -

i working on project uses uialertview , problem have replace of uialertview's uialertcontroller's , there around 1250 of them in code. planning uses existing utility class create function this, following planning do: +(void)showalert:(nsstring *)title errormessage:(nsstring *)msg { uialertcontroller *alertcontroller = [uialertcontroller alertcontrollerwithtitle:title message:msg preferredstyle:uialertcontrollerstylealert]; [alertcontroller addaction:[uialertaction actionwithtitle:@"ok" style:uialertactionstyledefault handler:nil]]; [self presentviewcontroller:alertcontroller animated:yes completion:nil]; } i have following questions before doing this: 1 - worth efforts (using uialertcontroller instead of uialertview ) ? 2 - how handle uialertview's had tags , different delegate implementation across hundreds of files ? 3 - fourth line function above gives error : no known class method selector 'presentviewcontroller:animated:comple

java - How to limited String in Android -

in application want show text (date) textview . text server , want show text in textview. text server : 16 dec 2017 but want show such : 2017 how can remove 16 dec ? try use split() there 2 signature split() method in java string. public string split(string regex) and, public string split(string regex, int limit) use split string in java use .split(" ") splits string according pattern provided, returning string array. sample code string date="16 dec 2017"; string [] dateparts = date.split(" "); string day = dateparts[0]; string month = dateparts[1]; string year = dateparts[2];

python - Searching a data frame via a range of datetime -

hi wondering able search data frame base on column datetime data, want search rows datetime within value. time user 1 2017-07-13 18:30:18 . gary 2 2017-07-13 13:30:23 . mary 3 2017-07-13 02:30:18 . tim 4 2017-07-12 12:11:44 . jim 5 2017-07-12 03:31:54 . tom 6 2017-07-11 01:21:21 . john 7 2017-07-11 05:32:12 . sam lets want search rows date lands between 7-13-17 00:00:00 7-13-17 15:00:00. result be: 2 2017-07-13 13:30:23 . mary 3 2017-07-13 02:30:18 . tim is there way slice data selection exact? realize technically create if/elif statement wondering if there easier method creating multiple if/elif statements accomplish task. use between boolean indexing : #if necessary convert datetime df['time'] = pd.to_datetime(df['time']) df = df[df['time'].between('2017-07-13', '2017-07-13 15:00:00')] print (df) time user 2 2017-07-13 13:30:23 mary 3 2017-07-13 02:30:18 tim or datafra

string - I have java code for entering a password following certain rules -

some websites impose rules passwords. writing method checks whether string valid password. the rules of password are: a password must have @ least 8 characters a password consists of letters , digits a password must contain @ least 2 digits i figured out of code, think got concept correct right no matter password enter prints out "invalid password"..i tried running debugger got confused. this code below: import java.util.scanner; public class practice { public static void main(string[] args) { system.out.print("enter password"); scanner input = new scanner(system.in); string password = input.nextline(); boolean iscorrect = checkpassword(password); if(iscorrect) { system.out.println("valid password"); } else { system.out.println("invalid password"); } } //this method checks password public static boolean checkpassword(string password) { int countdigit = 0; if (password.length() >=8

windows - How to install HDFS and hadoop? -

i trying learn hadoop , have started hdfs. have windows machine. found on apache hadoop site, there tar available download. means need have virtual machine on windows machine, has unix installed on it. , tar file needs installed on vm. please let me know best way start hadoop practicals , configure haddop node on windows machine.

Version compatibility of Firefox and the latest Selenium IDE (2.9.1.1-signed) -

Image
i visited https://addons.mozilla.org/en-us/firefox/addon/selenium-ide/ to install latest selenium ide (v 2.9.1) in firefox. my firefox version 54 (64-bit) os: windows 10 pro 64-bit (10.0, build 14393) but unfortunately "add firefox" button shown disabled on site https://addons.mozilla.org/en-us/firefox/addon/selenium-ide/ on site note found as: note: selenium ide not work on firefox version 55 onwards. please stay on firefox version 54 or older. what can install selenium ide on ff 54? sad true, no secret selenium ide deprecated. in fact, has already stopped working since firefox 55. here potential replacements may consider applying project: robot framework katalon studio protractor good luck , bye legend.

angular - Check internet connection when app starts in ionic -

i using ionic 3, problem app checks connection after has changed only. need check connection when main page loads trigger change in ui. here have gotten fa: constructor(public navctrl: navcontroller,private changedetect: applicationref, private weatherprovider: weatherprovider, private formbuilder: formbuilder, private network: network, public alertctrl: alertcontroller, private platform: platform) { let disconnectsubscription = this.network.ondisconnect().subscribe(() => { console.log('network disconnected :-('); this.netstatus = false; this.loginbtntxt ="ofline"; settimeout(() => { // if (this.network.type === 'wifi') { // console.log('we got wifi connection, woohoo!'); // } }, 3000); }); // watch network connection let connectsubscription = this.network.onconnect().subscribe(() => { console.log('network connected!'); this.netstatus = true; this.loginbtntxt ="online"; // got co

c# - Combining tags from children in Umbraco -

i have blog section on umbraco site, want tags each blog item , combine them in list without dublicates, can use taglist filter. i have section tags listed <ul id="blogtags" class="inline-list"> <li class="tag-item"><a href="#">tag 1</a></li> <li class="tag-item"><a href="#">tag 2</a></li> <li class="tag-item"><a href="#">tag 3</a></li> <li class="tag-item"><a href="#">tag 4</a></li> </ul> on blogitem doctype have field tagslist editor can input comma-separated list of tags. so want tags blogitems , combine them list dublicates removed. i getting blog items using: var blogitems = umbraco.typedcontent(model.content.id).children.where(x => x.documenttypealias == "blogitem" && x.isvisible()); but not sure how tags, combine , remove

header - nginx server block where to put underscores_in_headers on; using certbot ssl / letsencrypt -

i using certbot generate ssl certificates lets encrypt traffic forwarded 443/ssl. i need add flag underscores_in_headers on; print headers forward partner if try , add flag server block causes error , fails (see in "listen 443" block). ive added listen on 80 block doesnt work either. ideas? server { listen 80; underscores_in_headers on; root /home/www/staging; index index.php index.html index.htm; server_name url; error_page 404 /404.html; error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/www; } location / { try_files $uri $uri/ /index.php?$args; #proxy_redirect http:// https://; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php7.0-fpm.sock; } listen 443 ssl; underscores_in_headers on; ssl_certificate /etc/letsencrypt/live/url/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/url/privkey.pem; include /etc/letsencrypt/options-ssl-nginx.conf; }

node.js - ESOCKETTIMEDOUT Cloud Functions for Firebase -

i using cloud functions firebase firebase realtime database in order data management app. one of functions though seems terminated since takes 100-150 seconds complete. happens error : esockettimedout . is there way prevent this? here function: function gettopcarsforuserwithpreferences(userid, genres) { const pathtocars = admin.database().ref('cars'); pathtocars.orderbychild("istop").equalto(true).once("value").then(function(snapshot) { return writesuggestedcars(userid, genres, snapshot); }).catch(reason => { console.log(reason) }) } function writesuggestedcars(userid, genres, snapshot) { const carstowrite = {}; var snapcount = 0 snapshot.foreach(function(carsnapshot) { snapcount += 1 const cardict = carsnapshot.val(); const cargenres = cardict.tacargenre; const genre_one = genres[0]; const genre_two = genres[1]; if (cargenres[genre_one] === true ||cargenres[genr

html - Vue.js component with dynamic template (e.g. eventhandler) -

lets made compontent called test , inserted html so: <test :data="foo"></test> how can achieve on-click attribute value changes property value 'data'? vue.component('test', { props: ['data'], template: '<div v-for="element in {{foo}}" >></div>' }); just outline expectations - looking for: <test :data="bar"></test> <test :data="hello"></test> renders to <div v-for="element in bar" ></div> <div v-for="element in hello" ></div> btw: participates here in :) parent: <test :data="foo" @onmyevent="data=$event"></test> child component: vue.component('test', { props: ['data'], template: '<div @click="$emit(\'onmyevent\', \'bar\')"></div>' }); see docs based on edits: //parent <template

javascript - If and Else Function For Checkboxes -

i wanna add function checkbox user able click multiple check boxes in order perform calculations calc() function. calc() not called when user not check on boxes. note variables in calc() functions in 1 single function (i may want refer value checkbox functions). moreover, have removed of codes due limitation of word counts, error may have encountered function run-able. need on this. function calc() { let arr = document.getelementsbyname('qty'); let tot = 0; (let = 0; < arr.length; i++) { let radios = document.getelementsbyname("group" + (i + 1)); (let j = 0; j < radios.length; j++) { let radio = radios[j]; if (radio.value == "yes" && radio.checked) { tot += parseint(arr[i].value); } } } //display total value of test points document.getelementbyid('total').value = tot; //calc standard hour var stdhour = ((tot * 0.85) / 3600); //display