Posts

Showing posts from May, 2013

vb.net - If I imported a class, should I still prepend that class name to its methods when they're used in a different class? -

i work codebase there many classes thousands of lines of code. i've noticed inconsistencies in style concerning prepending class names when using methods , i'm trying figure out previous developer's reasoning. if we import generalcode in class a, bad practice write generalcode.dosomething() in class since imported (instead of using dosomething() )? think so, suppose it's nice know methods come classes @ glance, since class imports many classes , uses methods several of them. edit : vb.net, not java (sorry wrong tag, rough morning). new vb.net generalcode , dosomething() not declared static, neither import in class a. might vb.net, dosomething() can indeed used or without prepending generalcode . a method need prefixed the class name if it's static method. the name of instance when it's not static method. unless calling method own class.

c# - How to get a route without the action in the URL -

i want route like: /product/123 i have action don't want in url, currently: /product/get/123 how this? global.asax.cs routeconfig.registerroutes(routetable.routes); public static void registerroutes(routecollection routes) { routes.ignoreroute("{resource}.axd/{*pathinfo}"); routes.maproute( "default", "{controller}/{action}/{id}", new { controller = "home", action = "index", id = urlparameter.optional }, new[] { "myapp.web.controllers" } ); } you can use route attribute define path this: [route("product")] public class productcontroller { [route("{productid}"] public actionresult get(int productid) { // code here } } which provides full route definition "/product/{productid}" "/product/123" in case. more details there: https://blogs.msdn.microsoft.com/webdev/2013/10/...

Concatenate strings from multiple records in Teradata SQL -

i have list of merchants business in different states. merch state nc fl b ca b va instead of returning 4 records want group merch concatenate strings of states output looks like merch states nc,fl b ca,va i'm having lot of trouble translating response in answer issue optimal way concatenate/aggregate strings i cannot string_agg work, i'm not sure works in teradata. https://docs.microsoft.com/en-us/sql/t-sql/functions/string-agg-transact-sql you can use xml_agg() built in function in teradata. doesn't translate sql server why having issues 2 links. select merch, trim(trailing ',' (xmlagg(states || ',' order states) (varchar(500)))) yourtable group 1;

python - OAuth2 InvalidScopeError in Backend Application flow -

i trying implement backend application flow access token datahug api (following instructions in https://api.datahug.com/#gettingstarted ). from oauthlib.oauth2 import backendapplicationclient requests_oauthlib import oauth2session def get_access_token(): token_url = 'https://apps.datahug.com/identity/connect/token' client_id = client_id client_secret = client_secret scope = 'datahug_api' client = backendapplicationclient(client_id=client_id) client.prepare_request_body(scope=[scope]) oauth = oauth2session(client=client) token = oauth.fetch_token(token_url=token_url, client_id=client_id, client_secret=client_secret) return token if __name__ == '__main__': token = get_access_token() print(token) when running code i'm getting invalidscopeerror, namely user:dh user$ python so_test.py traceback (most recent call last): file "so_test.py", line 21, in <module> to...

php - Codeigniter Unit testing send file -

i'm using https://github.com/kenjis/ci-phpunit-test unit testing library codeigniter. i'm new @ writing tests, test how "adding new post" feature working. example send post requests fields , see messages see in view. public function test_when_you_send_slug_you_do_not_see_message() { $output = $this->request('post', '/pages/add', [ 'slug' => 'not-empty' ]); $this->assertnotcontains('<p>the slug field required.</p>', $output); } for example check whether when enter slug in form not specific error message. the problem can not test case when full form submitted correctly. have these required fields: title, content, slug, featured_image that last 1 file. so if pass title, content, slug in request, still missing featured_image file, , can't find information on internet how can pass $_files, cause guess 'post' wont see $_file. what want ask, how can pass file re...

Build XML file with XSLT to filter on severals childs nodes -

i've big xml file icecat. , want take informations. it's in following of subject filter-dynamically-xml-child-element-with-xslt-with-ssis now i've categorieslist xml file this: <icecat-interface> <response date="tue jul 25 16:00:10 2017" id="29306604" request_id="1500991209" status="1"> <categorieslist> <category id="2597" lowpic="http://images.icecat.biz/img/low_pic/2597-5095.jpg" score="471102" searchable="0" thumbpic="http://images.icecat.biz/thumbs/cat2597.jpg" uncatid="43223323" visible="0"> <name id="1088701" value="fiber optic adapters" langid="1"/> <name id="1595015" value="glasvezeladapters" langid="2"/> <name id="1088703" value="adaptateurs de fibres optiques" langid="3"/> <name id="1245208...

Restore SQL Server database backup of one machine to another -

scenario: i have database backup ( abc.bak ) on 1 machine i copied machine path let's g:\sqldb\backup\master_copy.bak i used following t-sql try , restore - errors. t-sql used: restore database new_db disk = 'g:\sqldb\backup\master_copy.bak' move 'coop_test_dat' 'g:\sqldb\livedb\new_db_data.mdf', move 'coop_test_log' 'g:\sqldb\livedb\new_db_log.ldf', replace error generated: msg 5133, level 16, state 1, line 1 directory lookup file "c:\sqldb\masterdb\master_blank.mdf" failed operating system error 3(the system cannot find path specified.). msg 3156, level 16, state 3, line 1 file 'coop_demo' cannot restored 'c:\sqldb\masterdb\master_blank.mdf'. use move identify valid location file. here given specified path old machine doesn't exists in new machine. how can fix this? what jeroen suggested was, might missing files..so see files use below command.. re...

ios - Swift - Firebase getting all keys and store them into array -

i have firebase database structure: main ----- name 1 --------value 1 --------value 2 --------value 3 ----- name 2 --------value 1 --------value 1 --------value 1 i'm trying key values , storing array of custom class. my custom class has init: init(name: string, photo: string) { self._name = name self._photo = photo } so in view controller have: var array = [customclass]() let ref = database.database().reference().child("main") func getinfo(){ ref.observesingleevent(of: .value) { (snapshot) in var arraytemp = [customclass]() child in snapshot.children { let snap = child as! datasnapshot let name = snap.key let custom = customclass(name: name, photo: "") arraytemp.append(custom) } self.array = arraytemp self.collectionview.reloaddata() } } func collectionview(_ collectionview: uicollectionview, cellforitemat indexpath: indexpath) -> uicollectionv...

full text search - Is it possible to obtain, alter and replace the tfidf document representations in Lucene? -

hej guys, i'm working on ranking related research. index collection of documents lucene, take tfidf representations (of each document) generates, alter them, put them place , observe how ranking on fixed set of queries changes accordingly. is there non-hacky way this? your question vague have clear answer, esp. on plan : take tfidf representations (of each document) generates, alter them lucene stores raw values scoring : collectionstatistics termstatistics per term/doc pair stats : postingsenum per field/doc pair : norms all data managed lucene , used compute score given query term. custom similarity class can used change formula generates score. but have consider search query made of multiple terms, , way scores of individual terms combined can changed well. use existing query classes (e.g. booleanquery, disjunctionmax) write own. so depends on want of note if want change raw values stored lucene going rather hard. you'll have write cust...

yii2 - Yii::$app->session->setFlash() is not working -

following code in sitecontroller works fine echo, not yii-method setflash(). maybe, have reconfigure config-file(main-local.php)? other ideas how keep setflash() doing job? public function actionscript() { //a new method, programmed thomas kipp $model = new myscriptform(); $filename = 'file'; $uploadpath = yii::getalias('@uploading'); if (isset($_files[$filename])) { $file = \yii\web\uploadedfile::getinstancebyname($filename); if ($file->saveas($uploadpath . '/' . $file->name)) { echo"<script>alert('hallo');</script>"; //echo \yii\helpers\json::encode($file); } } if ($model->load(yii::$app->request->post()) && $model->validate()) { $model->fileimage = uploadedfile::getinstance($model, 'fileimage'); $model->avatar = uploadedfile::getinstances($mo...

html - css - Two fonts in one page for two languages -

i'll explain myself. want users able write (in inputs, etc.) in 2 languages, hebrew , english. website can in english entirely user still type in hebrew , vice versa. basically, have no way of knowing in language user type in input box, want matching font each 1 of languages (so input box looks pretty both in english , in hebrew). so, how can have 2 fonts 2 languages in 1 element? btw: answer not :lang(he) . doesn't automatically detect language, html attribute lang . it's same writing [lang=he] as far know, should happen automatically. assign both fonts this: font-family: 'arial', 'arial (hebrew)'; @ this example.

android - Different Headers in StackNavigator -

i have implemented stacknavigator in removed header styles purpose. now have component inside stacknavigator i'd header back. how reckon ? here stacknavigator : const nav = stacknavigator( { splashscreen: {screen: splashscreen}, login: {screen: login}, register: {screen: register}, main: {screen: mainnav}, }, { headermode: 'none', }); but register screen, have header (to let user know can go back). i tried doing : static navigationoptions = { title: 'register', header: { } } but don't quite know put inside header part. personally did: had set height of header 0 when didnt want show , n show somenthing height: condition ? 0 : 10 otherwise answered here you can programmatically following code: static navigationoptions = ({ navigation }) => ({ header: > (navigation.state.params.thanks) => <headerview > content={navigation.state.params.thanks} /> : null, }) and can set...

How to call a child function inside a function from another function in Javascript? -

this question has answer here: how call function inside of function? 3 answers how javascript closures work? 89 answers function hello() { function helloagain(){ } } function myfunction(){ ... } here need call function helloagain() myfunction(). can suggest possible solution scenario. you can't. scope of helloagain il limited hello function. way make private scope in javascript.

android - Downloaded images upload, but camera taken images won't -

i have issue photo upload app allows pick image device , upload server. have been following guide on how use android upload service library this. application works image downloaded, or did not originate phone's camera. whenever choose image camera folder or if take 1 , try go choose it, image file not show in uploads folder. hits database table, not image folder. when click on image hyperlink sent table column, says "object not found" having real trouble understanding why happening images particularly. can help? here mainactivity code: package com.example.stins.orbotcamera; import android.manifest; import android.app.progressdialog; import android.content.context; import android.content.dialoginterface; import android.content.intent; import android.content.pm.packagemanager; import android.database.cursor; import android.graphics.bitmap; import android.graphics.color; import android.graphics.drawable.bitmapdrawable; import android.net.uri; import android.os.async...

Exclude an app from Django migrations -

is there way exclude models of app django migrations? know changing model meta options managed = false option that's lot of models edit every time. there way specify app models don't want migrate? removing __init__.py file within apps migrations directory should work.

python - How PyQt5 keyPressEvent works -

i create ui pyqt gpl v5.4 , use pyuic5 convert *.ui file *.py but not know how keypressevent work in code!! it should work qwidget, how let works. please help! from pyqt5 import qtcore, qtgui, qtwidgets pyqt5.qtcore import qt pyqt5.qtwidgets import qwidget class ui_mainwindow(qwidget,object): def setupui(self, mainwindow): mainwindow.setobjectname("mainwindow") mainwindow.resize(200, 200) self.centralwidget = qtwidgets.qwidget(mainwindow) self.centralwidget.setobjectname("centralwidget") self.pushbutton = qtwidgets.qpushbutton(self.centralwidget) self.pushbutton.setgeometry(qtcore.qrect(50, 110, 75, 23)) self.pushbutton.setobjectname("pushbutton") self.retranslateui(mainwindow) qtcore.qmetaobject.connectslotsbyname(mainwindow) def retranslateui(self, mainwindow): _translate = qtcore.qcoreapplication.translate mainwindow.setwindowtitle(_translate(...

google cloud platform - How do I specify a source in build requests using gcloud container builds submit? -

i trying specify build request source specified reposource : { "source": { "reposource": { "reponame": "myrepo", "branchname": "master" ...

android - Why is it showing that TextView object is null? -

i making app in in using fragments. have made in portrait in landscape mode. in portrait mode have done listview shown , on selecting item on next activity description shown in landscape mode have used 2 fragments in same activity in 1 fragment has listview , second fragment has description but when clicking item in list view showing me error cannot invoke method on null textview object but have initialised n onactivitycreated() method in fragment2.java why giving error? main.xml (portrait) <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.grepthor.fragment4.mainactivity"> <fragment android:layout_width="wrap_content" android:layout_...

angular - Jest external library use require('jquery') but return undefined -

hi there, i using jest-preset-angular angular-cli test angular 4 application uses materialize depends on jquery. the problem the problem materialize extends jquery , calls require('jquery') returns undefined when run tests jest. if (typeof(jquery) === 'undefined') { var jquery; // check if require defined function. if (typeof(require) === 'function') { jquery = $ = require('jquery'); // else use dollar sign alias. } else { jquery = $; } } my actual setup i mocking jquery this... import * $ 'jquery/dist/jquery'; object.defineproperty(window, '$', { value: $ }); object.defineproperty(window, 'jquery', { value: $ }); and importing materialize after mocking jquery this... import 'materialize-css/dist/js/materialize'; my expectations as materialize extends jquery , application components using extended methods, needs correctly loaded (including jquery) tests not fails. any ...

sorting - Cognos report drill through losing sort order -

i have 2 reports set identically (visually speaking) lists contain tables , charts, not plain list, represent 2 different levels of data. first can drill down second. drill down works great, data shows , everything, both reports need sorted manager name. if open either report separately sort properly, when drill down sort order doesn't work. i've tried added sort queries, i've tried adding sort list grouping, , both solutions work when opened individually, not on drill down. missing?

python - How to write unit tests for a sequence of data transformations? -

i trying learn tdd while writing script transform input data in long series of functions. problem similar whether write in python or r. guess it's more related tdd understanding. # of main in python def main(): data = get_data() data_a = transform_fun1(data) data_b = transform_fun2(data_a) data_c = transform_fun3(data_b) .... return data_x # of main in r main <- function() { data <- get_data() %>% transform_fun1() %>% transform_fun2() %>% transform_fun3() %>% ... data_x } what's best process write unit tests each transform_fun , knowing need input result of previous transform_fun ? in beginning looks clean, further , further, start reproduce more , more of main in each test, doesn't smell good. reproducing entire parts of main process looks counter-intuitive idea of unit testing. # in python (pytest) def test_transform_fun_n(data): data_a = transform_fun1(data) data_b = transfor...

java - How to split string if splitting character is dynamic or unknown? -

i want make java program in want take string input. string have 2 integer numbers , operation performed. eg. 25+85 or 15*78 the output solution of string. but don't know how split string because operator sign not known before execution. you want check operation using using string.contains("+"); , checking other operators want support. split wherever operator is, string.split("+") . there parse output of string.split("+") using integer.parseint(string s) , return sum. pretty simple, luck.

MS Access Run-time Error 3162 -

i'm trying use code copy file new folder , add file path/name docname column in tblfileattachments. when select file add, keep getting error "run-time error 3162...you tried assign null value variable not variant data type." here tables have tblfileattachments - docid - docname - requestid_fk tblrequests - requestid - pfname - plname - pbusinessname i have form based on tblfileattachments docid, docname , requestid_fk fields. have "add file" button following code: private sub btnattachfile_click() dim rsfile dao.recordset dim strfilepath string, strfilename string strfilepath = fselectfile() if strfilepath & "" <> "" strfilename = mid(strfilepath, instrrev(strfilepath, "\") + 1) currentdb.openrecordset("tblfileattachments") .addnew !docid = me.docid !filepath = strfilepath !filename = strfilename .update end end if end sub debugging error, highlights !docid = me.docid...

python - Why is python3 not finding a module? -

running script (which imports ply) python 2.7 works without issue. trying run same script python3 causes following. (note: i'm on v3.10 of ply - latest should compatible python3). bos-mpqpu:config_parse rabdelaz$ python3 lexparse.py traceback (most recent call last): file "lexparse.py", line 1, in <module> import ply.lex lex modulenotfounderror: no module named 'ply' bos-mpqpu:config_parse rabdelaz$ pip show ply | grep version version: 3.10 i've installed python3: bos-mpqpu:config_parse rabdelaz$ python3 python 3.6.2 (v3.6.2:5fd33b5926, jul 16 2017, 20:11:06) [gcc 4.2.1 (apple inc. build 5666) (dot 3)] on darwin type "help", "copyright", "credits" or "license" more information. >>> import ply traceback (most recent call last): file "<stdin>", line 1, in <module> modulenotfounderror: no module named 'ply' >>> try command if have pip3 pip...

python - How do I take an input string and count the number of characters in it by maintaining the order? -

my_string = "aaabbcccaa" required_output = "a3b2c3a2" please not provide code, try myself, please suggest me approach can required output. as suggested @ggradnig i've tried below code. def count_string(s): current_char= s[0] counter =0 result_string = '' in range(len(s)): if s[i] == current_char: counter+=1 if s[i] != current_char: result_string=result_string+current_char+str(counter) current_char = s[i] counter = 1 continue result_string=result_string+current_char+str(counter) return result_string given_string=count_string("aabbbccccaa") print(given_string) please suggest changes improve above code use hashing.. dictionaries in python. make character key , occurrence value.. , traverse dictionary... , took empty string , append both key , value string. edit now think change approach instead of using sets under d...

what I've done to get ValueError in logging module python -

i want write log both file , stdout, hence use code valueerror in stdout not in file. i want logging info level , above both stdout , file. , debug level , above wrote file. import logging logging.basicconfig(level=logging.debug, format='%(asctime)s %(name)-12s %(levelname)-8s %(funcname)-5s %(message)s', filename='okanimedownloader.log', filemode='w') console = logging.streamhandler() console.setlevel(logging.info) formatter = logging.formatter('%(levelname):-8s %(message)s') console.setformatter(formatter) logging.getlogger('').addhandler(console) dic = {'google drive': 'https://docs.google.com/file/d/0b-fk-js8djceyvvwrwdfwnc1yws/preview', 'mega': '//vk.com/video_ext.php?oid=359177611&id=456239042&hash=59d982cc2450bc8d&sd', 'openload': 'https://openload.co/embed/mvyskus5rm4/%5bokanime.com%5d_s%40ks2_-_11_%28animok%29....

MS Access convert short time in form to decimal time in table -

i have access database form contains "processtime" field, format hh:nn , input mask 00:00. i've got part working fine. in control source on associated table, however, processtime field/column appear decimal minutes. haven't been able figure out how that. for example, user might enter processtime in form 01:30, meaning 1 hour , 30 minutes. associated value in table appear 1.5, meaning 1 , half hours. how can go modifying processtime field in table show time in decimal hours? had assumed there simple "decimal time" format enter processtime field in design view, haven't found 1 yet. i'm using ms access 2013. there no intrinsic format or conversion function this. don't modify field. calculation in query or textbox. [processtime] date/time type? following expression work date/time or text type. hour([processtime]) + minute([processtime])/60

c++ - Pointer returned by overloaded new is changed -

this question has answer here: overloading new returns wrong address 1 answer i have come across bizarre problem , have created simple program in order demonstrate it. know code doesn't make sense, highlight don't understand. #include <iostream> using namespace std; class tempclass{ public: float n; tempclass(){}; ~tempclass(){} //very important line void* operator new[](size_t size); }; void* tempclass::operator new[](size_t size){ tempclass* a; a= ::new tempclass[2]; (int = 0; < 2; i++) { a[i].n = i*10; } cout << << endl; return a; } int main(){ tempclass* a; = new tempclass[2]; cout << << endl; cout << a[0].n << endl; return 0; } in code, have overloaded operator new class have created. however, behaviour of function changes, depend...

php - PHPUnit : mock an Interface and super class at the same time -

i have interface : interface myinterface { const some_constant='hi'; function method(): void; } and super class : class myclass { private $id; function method1(){ //do } } i need mock implements interface , extends super class,i.e mock needs of type myinterface , myclass @ same time. the testcase::createmock method can take 1 class mock hoping see if it's possible mock need using phpunit 6. you use prophecy here. class classandinterfacetest extends phpunit_framework_testcase { /** * @test */ function classandiface () { $myclass_instance = $this->prophesize (myclass::class) ->willimplement (myinterface::class)->reveal (); $this->a ($myclass_instance); $this->b ($myclass_instance); } function (myinterface $i) { } function b (myclass $i) { } }

Check if a Python job is running using PHP -

i've got python script thats called twice day via cron job trigger alarm runs in loop, , terminated pressing physical button , calling destroy function when button pressed. so far good. now, i'd check via php if script running - before button pressed after it's called via cron. how can this? based on question - i've tried following: exec("jobs", $pids); if(!empty($pids)) { print_r($pids); } but doesn't seem returning value. calling jobs terminal works expected , lists job running when invoking script directly using python3 alarm.py & . using exec("ps -a | grep -i $processname | grep -v grep", $pids); feel won't work since process id can change , can not known until script running. use pgrep this: pgrep -f 'python scriptname.py ...' -f can used specify full command line of python process avoid collision multiple python processes running in parallel.

python - Editing a specific line of a large file -

i creating pruning tables rubik's cube solver, , means need create file mapping unique identifier cube number in range 0 25 represents distance cube solved state (25 maximum depth using). however, identifiers can go 0 4.7 * 10^21, or 2^72, cannot used indexes in conventional data structure because outside bounds of integer. also, pruning table need checked millions of times, need lookups quick. so, idea create file id of cube used line number , depth stored there. convert depth base 26 each line of file hold 1 character z. but, need write character specific line of file , i'd prefer not t read thousands of lines before it. so, wondering if there way edit specific line of file if know every line contains 1 character. for example, id of solved cube 591305913000000, 591305913000000th line store 0, because 0 moves solved cube. id of cube move r performed on has id 5889210210000498 , 1 stored @ 5889210210000498th line. i open suggestions on better way store of data ...

go - Signal other than SIGKILL not terminating process on Windows -

i launching simple java application through go, goal of proving go can send signal sigquit or sigterm, , java can catch , handle appropriately (i.e. shutdown gracefully). when run java program on command line , send ctrl+c, java program correctly catches signal. however, when launch java program through go , attempt send process signal, java process neither terminated nor handle signal. 1 works sigkill, of course not caught, , kills process. here relevant parts of go code: start: startchan := make(chan bool) go func(startchan chan<- bool) { a.cmd = exec.command("java", "-jar", "c:\\code\\sigterm\\testapp.jar") a.cmd.stdout = os.stdout a.cmd.stderr = os.stderr launcherr := a.cmd.start() if launcherr != nil { fmt.println("unable start app:" + launcherr.error()) } startchan <- true }(startchan) stop: func (a *app) stop(timeout time.duration) { a.cmd.process.signal(syscall.sigquit) //does n...

c# - Multiple IAutofacActionFilter execution order -

i have multiple action filters implemented iautofacactionfilter. want control order of execution. logging action filter execute first before action filter. please. i want implement globally. don't want specify attribute on each method of controller have 100 controllers 10000 controller methods.

javascript - asp.net add js to switching between tables by query -

Image
i want add arrow above table , switching query. picture want switching week 35, 36, , more. this example of table arrow: click on left arrow show me data previous week , more.. this code: cmd.commandtext = " select * week week_no= (select max(week_no) week); cmd.connection = con; sqldatareader rd = cmd.executereader(); table1.append("<table border='0'>"); if (rd.read()) { table1.append("<tr><th>week no</th><th>"+ rd[1] +"</th>"); table1.append("</tr>"); } table1.append("</tr>"); rd.close(); sqldatareader rd2 = cmd.executereader(); if (rd2.hasrows) { while (rd2.read())...

oop - The cast can never be succeed -

Image
i new in kotlin , study concept of oop i trying cast code, i'm facing error: open class operations1(){ open fun sum(n1:int , n2:int):int{ return n1+ n2 } fun sub(n1:int , n2:int):int{ return n1- n2 } } class multioperations1():operations(){ override fun sum(n1:int , n2:int):int{ return n1+ n2 +5 } fun mul(n1:int , n2:int):int{ return n1* n2 } fun div(n1:int , n2:int):int{ return n1/ n2 } } fun main(args:array<string>){ var oper = operations() var inlit = multioperations1() operations1 println("enter first number") var n1:int = readline()!!.toint() println("enter second number") var n2:int = readline()!!.toint() var sum = inlit.sum(n1 , n2) var sub = inlit.sub(n1 , n2) println("sum: " + sum) println("sub: " + sub) } screen shot of code error: you seem have both operations , operations1 class. multioperations1 class inherits operations instead of operations1 , won't able cast ope...

r - Adding missing time values -

i have table gives me date-time have received data , count of how data received in thirty minute interval. problem half hour blocks missing, , want insert them column , insert 0 in count column. here example of table looks like: date-time count 2017-07-13 17:30:00 111 2017-07-13 18:00:00 85 2017-07-13 20:00:00 127 2017-07-13 20:30:00 515 i want have 18:30:00 0 , on not sure how if has idea great. here have tried do: starttime <- df[1,`date-time`] (i in df){ time <- starttime + 30 new_dt$datetime <- ifelse(df[i] = time, df$datetime, time) new_dt$count <- ifelse(df[i] = time, df$count, 0) } first let's create dummy data. library(tidyverse) library(lubridate) time_series <- tibble( datetime = c( "2017-07-13 17:30:00", "2017-07-13 18:00:00", "2017-07-13 20:00:00", "2017-07-13 20:30:00" ), count = c(111, 85, 127, 515) ) %>% mutate(datetime = ymd_hms(datetime)...

oracle - "Test connection succeeded" but "An unexpected error occurred in the ODP.NET, Managed Driver" -

i want connect oracle visual studio 2015 enterprise update 3. after installed odt visual studio 2015, add new connection data provider oracle database (odp.net managed driver) popup seems weird, test connection succeeds empty connection string -added ss- , when press ok, unexpected error occures. 64bit machine, uninstalled odac, repaired visual studio 2015 , installed odt vs 2015. thanks , regards, error

How do I write a SQL Server query that gives me the table names given a FK name? -

this question has answer here: how can find out foreign key constraint references table in sql server? 14 answers i have fk: "fk_blahblah" i want know 2 tables related it. how can write query this? this query returns info you're need... can add clause filter specific fk names, etc. select t.name tablename, (select cc.name sys.columns cc, sys.tables tt tt.object_id = cc.object_id , tt.object_id = fk.parent_object_id , cc.column_id = fc.parent_column_id) column_name, fc.constraint_column_id, fk.name fkname, objectproperty(fk.object_id, 'cnstisdisabled') is_disabled, objectproperty(fk.object_id, 'cnstisnottrusted') is_untrusted, object_name(fk.referenced_object_id) referenced_table_name, (select cc.name sys.columns cc, sys.tables tt tt.object_id = cc.object_id , tt.object_id = fk.referenced_...

android - Trouble getting ng-device-back-button directive to work for OnsenUI v2 -

i'm attempting stop user abandoning game accidentally clicking device button on android devices. i'm using cordova 6.3.1 , onsen ui v2 framework. by using onsen page's ng-device-back-button attribute, have been able disable button, prefer ask user if wanted leave confirm. @ point, happy if write console user has clicked device button, seems nothing happening other ng-device-back-button attribute preventing default. <ons-page ng-device-back-button="onbackkeydown"> ... </ons-page> $scope.onbackkeydown = function(e) { console.log("device button pressed"); } with above code, i'm able prevent onsen standard poppage() reaction, nothing being written console. any thoughts on i'm doing incorrectly? in advance. try ng-device-back-button="onbackkeydown()" instead of ng-device-back-button="onbackkeydown"

angular - How to test an asynchronous function using karma/Jasmine in ionic2? -

below have written down code in there asynchronous function, uses settimeout() internally , prints message after 3seconds. i have write spec using jasmine. i have followed docs didn't how apply in code. home.ts //implementing function written in class.all imports done properly. click(){ function delayedalert(message: string, time: number, cb) { return settimeout(() => cb(message), time); } delayedalert('aditya3', 3000, (message) => console.log(message));//function called } } home.spec.ts describe('asynchronous call', () => { let fixture: componentfixture<homepage>; let comp: homepage; let de: debugelement; let el: htmlelement; beforeeach(async(() => { testbed.configuretestingmodule({ declarations: [homepage], imports: [ ionicmodule.forroot(homepage), ], providers: [navcontroller], }).compilecomponents(); })); ...

Extracting CSV from Couchdb using PHP script and Curl -

i wondering if can me something context i trying make automated system extracts csv couchdb using php script on windows. have tried creating scripts of own little success since new couchdb , curl. have searched extensively find answer on site , although there similar questions, none deal problem same way. question 1) know if there way php can send url command of type " 10.10.10.10:5984/dbname/_list/_csv/viewname?startpoint=[x]&endpoint[y] ". how do this? have setup curl send command before executing? 2) there way avoid couchdb sending first line of file field names?

c# - invoke click on a buton in UWP webview on HTML DOM without an id -

i have c# uwp app , want click button html dom shown below using webview. <button type="button" class="btn btn-primary btn-extra-pad btn-shadow" onclick="checkmsgshowbig()">send</button> normally input has id , , code below trick var functionstring = string.format(@"document.getelementbyid('id').click();"); await webview.invokescriptasync("eval", new string[] { functionstring }); but button has class name. code below should work when using class name, not work. var functionstring = string.format(@"document.getelementsbyclassname('id').click();"); await webview.invokescriptasync("eval", new string[] { functionstring }); how make work? thank you. the return value getelementsbyclassname array should index before using it. here code sample private async void simulateclickasync() { var functionstring = string.format(@"document.getelementsbyclassname('...

R package, Seurat, interfering with ggplot2/plotly output -

i writing r script in rstudio looking @ single cell data , generating various graphs. package using ggplot2. generates nice graph outputs when seurat library not loaded: pure ggplot2 graph then when seurat library imported, graph reverts ugliness: seurat interfered plot here list of imports seurat brings upon being included: imports: methods, rocr, stringr, mixtools, lars, fastica, tsne, rtsne, fpc, ape, vgam, pbapply, igraph, fnn, caret, plyr, dplyr, rcolorbrewer, mass, matrix, irlba, reshape2, gridextra, gplots, gdata, rcpp, rcppeigen, rcppprogress, tclust, ranger any thoughts on how have both libraries present without alterations in graph output? solutions tried: - tried "detach("package:seurat", unload = true)" //did not revert plots upon closing , reloading rstudio , did not allow upstream code chunks provide ggplot2 normal graphing. thanks.