Posts

Showing posts from August, 2012

github - Create a barebones version of R -

i want deploy application i've been working on in r github, , i've found can upload 25mb worth of files without using command line. i've bundled portable version of r, can found here: https://sourceforge.net/projects/rportable/ r scripts. i tried deleting files in r portable try cut down, , wondering if way of going things. alternatively, mentioned previously, can try , use command line in github, haven't had luck getting work. appreciated. edit: found can uploaded using github desktop: https://desktop.github.com/ . however, main question still stands: worth \ safe cutting down r?

c# - Error using eazfuscator.net v3.3.0 Common Language Runtime detected an invalid program -

using eazfuscator.net 3.3.0 i'm having error: "common language runtime detected invalid program" happens when put mouse cursor on datagridview. i'm using c # in visual studio 2010. another error compiling application using eazfuscator not start if not run administrator. any ideas? thank you

html - trying to make icons fixed with css -

Image
h4 { color:#ffffff; font-size:20px; letter-spacing:2px; display:inline-block; padding:0 10px; } { color:#ffffff; font-size:20px; } <div class="col-md-12"> <i class="fa fa-angle-left" id="prev" aria-hidden="true"></i> <h4 class="quotes" style="display:inline-block;"> web devloper </h4> <h4 class="quotes" style="display:inline-block;"> web designer </h4> <h4 class="quotes" style="display:inline-block;"> freelancer </h4> <i class="fa fa-angle-right" id="next" aria-hidden="true"></i> </div> how make next , previous icons stay fixed? here's problem: add icons position: absolute; , parent element position: relative; . example: #block { padding: 20px 70px; ...

python 3.x - Why does my script continue to 'while' loop when if statement is true? -

at line 11, user chooses cancel button on easygui enterbox, why code continue 'while' loop though user's choice returns 'nonetype? doesn't meet condition of 'if' statement? shouldn't script return 'main' function being called? here full script. from easygui import* def children_menu(): title2 = "children." children_menu = ["1: register child.", "2: list of registered children."] button = buttonbox("choose option", title2, choices=children_menu) if button == children_menu[0]: enter1 = enterbox(msg="enter child's first name.", title=' ', default='', strip=true, image=none, root=none) if enter1 none: main() return else: while enter1 == "" or enter1.isalpha() == false: enter1 = enterbox(msg="invalid entry. please enter child's first name using letters only....

php - How to express OR conditions with the CakePHP 3.x query builder? -

i trying build query in cakephp 3.x following structure : , b , c , [d or e] a,b, c, d, e contains array of values joined or conditions $schools = $schools->where(['a in' => $arrayofaoptions]), $schools = $schools->where(['b in' => $arrayofboptions]), $schools = $schools->where(['c in' => $arrayofcoptions]) // want firstly joined or before joining other conditions , $schools = $schools->where(['d in' => $arrayofcoptions]) //or $schools = $schools->where(['e in' => $arrayofcoptions]) the problem here , not fields d , e isolated or , join others and in cakephp 2, managed achieve following codes $queryconditions = array( 'or'=> array_merge( array( 'school.d' => $this->session->read('conditions.d') ), array( 'school.e' => $this->session->read('conditions.e') ) ) ); before merging rest on conditions appreciat...

datetime - Swift - Calculating elapsed time takes too long? -

my server call gives me json data date time per piece of data , want calculate time elapsed between , , load data structure. way i'm doing takes way long, there different design practice should using? follow function using right now func datediff(_ datestr:string) -> string { var timeago = "10m" let formatter = dateformatter() formatter.dateformat = "yyyy-mm-dd' 'hh:mm:ss" formatter.timezone = nstimezone(name: "ast") as! timezone let dateformatter = dateformatter() dateformatter.dateformat = "yyyy-mm-dd' 'hh:mm:ss" dateformatter.timezone = nstimezone(name: "ast") as! timezone let = formatter.string(from: date()) if let date = formatter.date(from: datestr){ if let nowdate = formatter.date(from: now){ let components = calendar.current.datecomponents([.day,.hour,.minute,.second], from: date, to: nowdate) let sec = components.second let min...

javascript - Using Socket.IO from Node.js to connect to external server -

background: have node.js server running on localhost (call server a); , external server running node.js @ https://example.net:3000 (call server b). not control or have access server b (it dashboard site iot device in home), need connect using socket.io , emit specific message. i can connect flat javascript file (client-side), need running server side (ultimate goal make can call http request); , examples such how connect 2 node.js servers websockets? suggest should able use socket.io-client node.js same code achieve same results. when run code node.js, cannot connect socket. below code works in flat javascript file. know works because see 'socket connect' in console, , can test the socket emit @ end. var myemail = "email@gmail.com"; var device_id = '12345'; // create socketio instance, connect var socket = io.connect('https://example.net:3000'); socket.on('connect', function(){ try { console.log('socket connect'...

polymer 2.x - Instruct paper-dialog-scrollable to scroll to bottom -

i have paper-dialog-scrollable filled dom-repeat firebase-query. works fine, except paper-dialog-scrollable doesn't scroll bottom when firebase adds entry array. managed set callback whenever array gets new entry (basically observer on spliced array, not on array). how instruct paper-dialog-scrollable scroll bottom callback ? saw solutions here don't seem work. insight. as suggested in link provided, give paper-dialog-scrollable id (e.g pds ) , add following code: this.$.pds.$.scrollable.scrolltop = this.$.pds.$.scrollable.scrollheight; an element's scrolltop value measurement of distance element's top topmost visible content. when element's content not generate vertical scrollbar, scrolltop value 0. learn more scrolltop . the element's scrollheight read-only property measurement of height of element's content, including content not visible on screen due overflow. learn more scrollheight . i have made demo here: h...

mongodb - Document schema - Performance vs Modification anomaly - tradeoff -

Image
to design document schema below application. one approach is, below mongodb document designed primarily based on matching of data access pattern of application (above). > db.posts.find().pretty() { "_id": objectid("5099f5eabcf1bf2d90ea41ad"), // post 1 "author": "xyz", "body" : "this test body", "comments": [ { "body": "this comment", "email": "alan@tech.com", "author": "alan donald" }, { "body": "this comment\r\n", "email": "alan@tech.com", "author": "alan donald" } ], "date" : isodate("2012-11-07t05:47:22,9412"), "permalink": "this_is_a_test_post...

pandas - Google map does not display correctly in jupyter notebook -

i'm trying use google map api visualize data in jupyter notebook. here code used display basic map in jupyter: import gmaps import os import json import gmaps.datasets gmaps.configure(api_key="aiz....") fig=gmaps.figure() fig after ran code, nothing displayed. used own google api key , couldn't figure out why map isn't displayed. i'm new geojson field, idea or thoughts appreciated. did make sure widgets enabled in jupyter? try before run jupyter: jupyter nbextension enable --py gmaps jupyter nbextension enable --py widgetsnbextension

powershell - Unable to add txt file of computers into SCCM collection -

i trying add 400 computer collection , have error running powershell in sccm. try change . _ encounter same error. method invocation failed because [system.char] not contain method named 'split'. @ line:8 char:5 + $collectionname = $filenames.name[$x].split(".")[0] + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + categoryinfo : invalidoperation: (:) [], runtimeexception + fullyqualifiederrorid : methodnotfound powershell: #set path collection directory $collectiondir = "d:\collections\" #pull .txt files array $filenames = get-childitem $collectiondir* -include *.txt ($x=0; $x -lt ($filenames.length); $x++) { $collectionname = $filenames.name[$x].split(".")[0] $collectionname #add new collection based on file name try { new-cmdevicecollection -name $collectionname -limitingcollectionname "all systems" } catch { "error creating collection - collec...

http - Connection error while fetching data from Eloqua in mule -

sometimes i'm getting below error while connecting eloqua system using http component. sometime fetching data eloqua in rare cases getting below error. 20:31:11.474 08/18/2017 worker-0 [elq-sfdc-batch-interface-v1].ma-sfdc-ma-batch-interfaceflow.stage1.29 error remote host closed connection. possible ssl/tls handshake issue. check protocols, cipher suites , certificate set up. use -djavax.net.debug=handshake further debugging. 20:31:11.477 08/18/2017 worker-0 [elq-sfdc-batch-interface-v1].ma-sfdc-ma-batch-interfaceflow.stage1.29 error ******************************************************************************** message : error sending http request. element : /ma-sfdc-ma-batch-interfaceflow/processors/18/get-ma-exported-data/subprocessors/0 @ elq-sfdc-batch-interface-v1:ma-sfdc-marketing-activities-create-export.xml:74 (get exported data) -------------------------------------------------------------------------------- exception stack is: erro...

android - React Native: app crash once started in AVD -

Image
this first time use react native. have done necessary preparation stated in getting started . i created app "test1" i opened avd in android studio. i ran >react-native run-android in cmd. after while, said "build successful" in cmd. however, in avd, displayed the development server returned response on code:500 in red screen shown below. kindly tell me how fix it.

javascript - ng2-charts How to get the result of multiple push? -

i have worked chartsjs, has not been easy. show 2 lines of items on chart, can show 1 line @ time. my result: https://www.dropbox.com/s/wjbee6ze16br00x/capturar.png?dl=0 how can 2 lines or more in chart? my component.js import { chartservice } './../service/chart.service'; import { component, oninit } '@angular/core'; import { datepipe } '@angular/common'; @component({ selector: 'app-linea', templateurl: './linea.component.html', styleurls: ['./linea.component.css'] }) export class lineacomponent implements oninit { data_in: array<any> = []; labels: array<any> = []; options = { day: '2-digit', month: '2-digit', year: 'numeric', hour: '2- digit', minute: '2-digit' }; datasets: array<any> = [ { data: [], label: 'price 24h' }, { data: [], label: 'open' } ]; public linecharttype: = 'line'; public linechartlegend: = true; public linech...

Value of array element changes itself during loop in c language -

i have written simple code in c. problem element value changing during loop, though there no such command. elements calculated in first loop become 0 after loop ends. elements calculated in 2nd or higher numbered loop show correct values, don't become 0 (obviously). why did elements become zero? mistake? i have printed value of u(1,0) every time. #include <stdio.h> /* standard library of input , output */ #include <complex.h> /* standard library of complex numbers */ #include <math.h> #include <string.h> #include <stdlib.h> #define pi 3.141592 int main() { // declaration variables // integers int n = 2, nx = n, ny = n, i, j; // important give n-1 n double x[nx], y[ny], lengthx = 1.0, lengthy = 1.0; double complex u[nx][ny]; // x direction (i = 0; <= nx; i++) { x[i] = (double)i / (nx + 1) * lengthx; //printf("x coordi %.15f \n", x[i]); } // y direction (j = 0; j...

python - break inside list comprehension -

i have datalist , filterlist , want use list comprehension method search item in datalist string contains word filterlist: >>> datalist=['mytest123orange','dark angle','double69','spartan','broken image 999','2 cup of tea'] >>> filterlist=['test','2','x','123','orange'] >>> print [i in datalist if len([ j j in filterlist if j in i])>0 ] ['test123orange', '2 cup of tea'] it's working want. problem value len([ j j in filterlist if j in ])>0 , need loop item inside filterlist. if match first item in filterlist, loop have go through till end. example when try check 'mytest123orannge' , if test in filterlist match it's enough, want 'break' loop don't want loop rest. don't need match 'orange' or '2' or '123' . my questions : how can break inside loop? is there other better method? ...

android - androidmanifest.xml doesn't exist, with sync button have clicked -

when run or sign apk file, prompt "androidmanifest.xml doesn't exist or has incorrect tag" appear. i've tried click "sync project gradle files", problem exists well. can do? here manifest file: manifest i'm not developer, student. don't understand java lot. forked project github. if can, please explain as possible, thanks!

python - How to start coroutines and continue with synchronous tasks? -

i trying understand asyncio , port undestanding of threading . take example of 2 threads running indefinitely , non-threaded loop (all of them outputting console). the threading version import threading import time def a(): while true: time.sleep(1) print('a') def b(): while true: time.sleep(2) print('b') threading.thread(target=a).start() threading.thread(target=b).start() while true: time.sleep(3) print('c') i tried port asyncio based on documentation . problem 1 : not understand how add non-threaded task examples saw show ongoing loop @ end of program governs asyncio threads. i wanted have @ least 2 first threads ( a , b ) running in parallel (and, worst case, add third c thread well, abandonning idea of mixed thread , non-threded operations): import asyncio import time async def a(): while true: await asyncio.sleep(1) print('a') async def b(): w...

Floating point Exception in c++ because of divide statement -

i have searched google unable find solution problem. here code- #include <bits/stdc++.h> #include<algorithm> #include<cstdlib> #include<cstdio> using namespace std; long long buymaximumproducts(int n, long k, vector <int> a) { // complete function vector<pair<int, int>> p; long i; for(i=0; i<n; i++) { p.push_back(make_pair(a[i], i+1)); } sort(p.begin(), p.end()); if(k < p[0].first) return 0; long long sum=0,stocks=0; for(i=0;i<n;i++) { if((sum+p[i].first*p[i].second) <= k) { sum+=p[i].first*p[i].second; stocks+=p[i].second; } else break; } long long amtleft=k-sum; **stocks+=(long long)(amtleft/p[i].first);** return stocks; } int main() { int n; cin >> n; vector<int> arr(n); for(int arr_i = 0; arr_i < n; arr_i++){ cin >> arr[arr_i]; ...

Fileuploader in gridview in asp.net c# -

default.aspx <asp:gridview id="gridview1" visible="false" onpageindexchanging="gridview1_pageindexchanging" onrowupdating="gridview1_rowupdating" onrowediting="gridview1_rowediting" onrowcancelingedit="gridview1_rowcancelingedit" runat="server" horizontalalign="center" allowpaging="true" autogeneratecolumns="false" datakeynames="q_d" forecolor="#333333" cellspacing="0" cellpadding="4" width="100%" gridlines="none"> <columns> <asp:templatefield itemstyle-horizontalalign="center"> <headertemplate> <asp:checkbox runat="server" id="lqcheckall" autopostback="true" oncheckedchanged="lqcheckall_checkedchanged" /> <asp:imagebutton imageurl="~/icons/remove-icon-png-25.png" onclick=...

res.json() is a not a function in HttpClient Angular 2 -

i using angular http module before , method res.json() used work fine. have tried httpclient res.json() dosen't seem work . using res works can 1 tell me changed has happened in http client. return this.client.get('https://swapi.co/api/people/1/') .map((res:response) => { return res.json(); // using maps filter data returned form http call json dosn't work http client }).map(data => { return data; // using maps of maps filter data returned form map }).flatmap((jedi) => this.http.get(jedi['homeworld']) .map(res => { return res.json().name; // using flat maps combine data returned 2 observables 1 }).catch((error:any) => observable.throw(error.json().error || 'server error'))); i switched http client because of new interceptor can pointers welcomed thanks right, that's because new http client default calls res.json() ...

text - Why do we calculate cosine similarities using tf-idf weightings? -

suppose trying measure similarity between 2 similar documents. document a: "a b c d" document b: "a b c e" this corresponds term-frequency matrix b c d e 1 1 1 1 0 b 1 1 1 0 1 where cosine similarity on raw vectors dot product of 2 vectors , b, divided product of magnitudes: 3/4 = (1*1 + 1*1 + 1*1 + 1*0 + 1*0) / (sqrt(4) * sqrt(4)). but when apply inverse document frequency transformation multiplying each term in matrix (log(n / df_i), n number of documents in matrix, 2, , df_i number of documents in term present, tf-idf matrix of b c d e a: 0 0 0 log2 0 b: 0 0 0 0 1og2 since "a" appears in both documents, has inverse-document-frequency value of 0. same "b" , "c". meanwhile, "d" in document a, not in document b, multiplied log(2/1). "e" in document b, not in document a, multiplied log(2/1). the cosine similarity between these 2 vectors 0, suggesting 2 totally different documents....

php - mysql update multiple column in multiple rows -

i trying update multiple data in both rows , columns in table client_id = '5' , invoice_number = '11' my table tbl_particulars my code: <table class="table table-bordered"> <tr> <th>date</th> <th>car no.</th> <th>particulars</th> <th>rate</th> <th>amount</th> </tr> <?php $sql = "select * tbl_particulars client_id = '5' , invoice_number = '11'"; $query = mysql_query($sql); while($row = mysql_fetch_assoc($query)) { ?> <tr> <td width="200px" nowrap="nowrap"><table> <tr> <td>from<br> <input type="hidden" name="numbers" val...

Javascript undefined value instead of value -

so have these 2 loops. in first loop message says want say; hello herbert, hello peter . but in second 1 says; hello undefined . what difference between these 2 blocks of code, , why second 1 returns undefined ? let people = [ { name: "herbert", occupation: "vildstaed", language: ["finnish", "english", "german"] }, { name: "peter", occupation: "skalnstead", language: ["german", "livonian dialect"] } ]; for(var = 0; < people.length; i++){ alert("hello " + people[i].name) } for(let person in people) { alert("hello " + person.name) } for in loop return keys , not objects. second case person not 1 expect. can see showing person . let people = [ { name: "herbert", occupation: "vildstaed", language: [...

javascript - Button appearance not updating on class change -

when button clicked, background-color not become yellow intended nor clicked button's background-color revert red. goal change buttons' colors when clicked changing classes. when buttons' classes changed not change color. purpose of testfunction() updating color of buttons. purpose of testfunction2() adding onclick function buttons. <!doctype html> <html> <head> <title>test</title> </head> <style> .button { background-color: red; } .c { background-color: yellow; } </style> <body> <table> <tr> <td>test1</td> </tr> <tr> <td id="test1"> <button class="c">0</button> <button class="">1</button> <button class="">2</button> <button class=""...

c - Add nodes in a random position of a new list -

i'm facing how add nodes of single linked list in random position(without repetition of random numbers) of new list. thinking how can it. firstly, created array want save old numbers, can control if random number generated. secondly,the next step want do, add first node of old list in random position, sliding new list(empty). don't have idea how can it... how can slide old list, without ruin old list? node * generatenewlist(node*list,int size) { int array[size]; node*auxlist=null; auxlist=(node*)malloc(sizeof(node)*(size)); int cont,a; int i,j; for(i=0;i<size;i++) { cont=0; a=rand()%size; array[i]=a; for(j=0;j<size;j++) { if(array[j]==a) { a=rand()%size; } while(cont!=a) { cont++; auxlist=auxlist->next; ...

How to creat a C++ Makefile und use it -

i try write c++ programm on win10 mingw cant run makefile, try few ours , think understand of still not work.. hashtabelletest.o: main.o hashtabelle.o g++ -o hashtabelletest main.o hashtabelle.o main.o: main.cpp hashtabelle.cpp g++ -c main.o main.cpp hashtabelle.o: hashtabelle.cpp hashtabelle.h g++ -c hashtabelle.o hashtabelle.cpp hashtabelle.h clear: rm *.o *.exe as admin use mingw32-make says nothing done 'makefile.mak' i try edit the parts new still same thing as know little diffence in win,such there's no rm del.but u'd better wirte all: in both system.in linux,i use below format cc = g++ ld = g++ cflags = -wall -g -o0 lflags = all:main.elf clean: rm -rf *.o *.elf ########################## main.elf:main.o x.o y.o $(ld) -o $@ $^ $(lflags) %.o:%.cpp $(cc) -c -o $@ $< $(cflags)

java - bufferWriter can not write in new line -

i'm working java file , want write text file doesn't go new line. how can write in new line bufferwriter? public void setdata() throws ioexception{ file file = new file("schooldb.txt"); filewriter filewriter = new filewriter(file); bufferedwriter bufferedwriter = new bufferedwriter(filewriter); for(int j = 0; j < 5; j++){ school school = new school(); school = allschools.get(j); //set name bufferedwriter.write(school.getname()); //houses if(school.gethoused()) for(int = 0; < school.gethouses().size(); i++) bufferedwriter.write(school.gethouses().get(i).getname()); else bufferedwriter.write("0"); bufferedwriter.newline(); //courses if(school.gethouses().size() != 0) for(int = 0; < school.getcourses().size(); i++) bufferedwriter.write(school.getcourses().get(i).getname()); ...

connection string in asp.net core library project -

i have asp.net core library project. want add connection string in it. don't have startup class in this. need place connection string , how fetch it? please suggest. in dotnet core can manage configuration using json files, 1 in many ways configure application. according dotnet core configuration documentation can (copied link reference) using microsoft.extensions.configuration; using system; using system.io; // add nuget <package id="microsoft.extensions.configuration" , // <package id="microsoft.extensions.configuration.json" // .net framework 4.x use following path: //.setbasepath(path.combine(directory.getcurrentdirectory(), @"..\..")) public class program { static public iconfigurationroot configuration { get; set; } public static void main(string[] args = null) { var builder = new configurationbuilder() .setbasepath(directory.getcurrentdirectory()) .addjsonfile("appsetti...

javascript - _reactD3Components2.default is undefined -

i trying integrate d3 react making graphs. far have installed d3 , react-d3-components folder. versions got installed "d3": "^4.10.0" , "react-d3-components": "^0.6.6" . importing these dependencies code, doing this- import react 'react'; import reactdom 'react-dom' ; import $ 'jquery' ; import reactd3 'react-d3-components'; import * d3 'd3'; var axios=require('axios'); //var d3=require('d3'); var barchart=reactd3.barchart; class dataapp extends react.component{ componentdidmount(){ this.loaddata(); } loaddata(){ axios({ method:'get', url:'https://www.alphavantage.co/query?function=time_series_monthly&symbol=spy&interval=15min&outputsize=full&apikey=2qel3wc4kitibisr' }).then(function(response){ document.getelementbyid('data-div').innerhtml=json.stringify(response); }) } render(){ return( ...

how to check user is active on page in Angular 2 -

how can check mouse , key events in angular 2 globally, meant @ root level. want call 1 service when user interacting not idle application. please me , suggest solution on this. in top level component, create observable event of document object , invoke service, example: import 'rxjs/add/observable/fromevent'; import {observable} "rxjs/observable"; ... const clicks$ = observable.fromevent(document, 'click'); clicks$.subscribe(x => console.log('calling service here'));

javascript - getJSON fails when i try to load user JSON -

this question has answer here: how return response asynchronous call? 21 answers i have made chrome extension facebook, private liking. want is, whenever posted post, , person clicked private button, has been included me. on click of private button, want json data of poster posted post. tried json of own profile, not return anything. below code ! var btn = "<button class=\"nadddim\" >get json</button>"; var t = document.getelementsbyclassname("_sg1 _3qd4"); t[0].insertadjacenthtml('beforebegin', btn); document.getelementsbyclassname('nadddim')[0].addeventlistener('click',function(){ var fbjson; $.getjson( "https://www.facebook.com/profile.php?id=100004774025067", function( data ) { fbjson = data; }); console.log(fbjson); }); basically need user id , post,...

jdbc - Oracle to_timestamp produces error -

i trying value of time-stamp column using jdbc driver. following query works charm : to_char(update_date,'yyyy-mm-dd hh24:mi:ss.ff9 tzr') update_date however, instead of to_char, need timestamp values , if use following query in select statemnt, gives ota-01821-date format not recognized error. please can help? to_timestamp(update_date,'yyyy-mm-dd hh24:mi:ss.ff9 tzr') update_date the immediate cause of error tzr part of format mask, isn't valid plain timestamp. either convert timestamp with time zone with different function : to_timestamp_tz(update_date,'yyyy-mm-dd hh24:mi:ss.ff9 tzr') or omit time zone: to_timestamp(update_date,'yyyy-mm-dd hh24:mi:ss.ff9') but uodate_date timestamp (with [local] time zone), implicitly converting string using your session's nls_timestamp_tz_format setting , before explicitly converting string timestamp (with or without time zone). at best pointless, if nls setting doesn...

android - Going to another activity from dialog box -

i want go sign-in activity after confirming logout alert box, not working me. can me sort out? here navigation.java class final dialog mydialog = new dialog(this); mydialog.settitle("confirm logout"); mydialog.setcontentview(r.layout.logoutdialog); button yesoption = (button) findviewbyid(r.id.yes); button nooption = (button) findviewbyid(r.id.no); yesoption.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) { loginmanager.getinstance().logout(); intent login = new intent(navigation.this, signin.class); startactivity(login); finish(); } }); nooption.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) { mydialog.dismiss(); } }); mydialog.show(); } you need use dialog instances of button view custom layout. try it. final dialog mydialog = new dialog(this); mydialog.settitle("confirm logout"); myd...

n1ql - Couchbase convert epoch to ISO -

i'm struggling convert epoch iso datetime couchbase n1ql . couchbase stores etoch time milliseconds , need full iso8 format yyy-mm-ddthh:mm:ss.s. have tried: select date_part_millis(1463284740000, 'year'), date_part_millis(1463284740000, 'month'), date_part_millis(1463284740000, 'day') but returns json-like response. tries concatenate select date_part_millis(1463284740000, 'year') || date_part_millis(1463284740000, 'month') || date_part_millis(146328474000 0, 'day') but renders nothing back [ { "$1": null } ] any suggestion? in couchbase can store time number (in milliseconds) or string iso-8601 format. provides many date functions work on iso-8601 format described @ https://developer.couchbase.com/documentation/server/current/n1ql/n1ql-language-reference/datefun.html select millis_to_str(1463284740000); date_part_millis(date1, part [, tz]) extracts value of given date component epoch/...

Android kills foreground service when screen sleeps -

in app have timer service. use inside fragment , after calls startservice() , bindservice() move foreground. everything works fine on emulator, on tablet when turn screen off , device sleeps time, service gets killed. there 2 scenarious. if device sleeps 3 minutes , wakes able see notification doesn't updates. if device sleeps 10 or 15 minutes or more not able see notification when turn screen on. i heard it's because of battery consumption policy , on devices same service can live more time or doesn't killed depending on such settings, whether device charging , battery status. i thought start , shut down service when screen wakes , goes sleep respectively. thought broadcast receiver s can me action_screen_on , action_screen_off . unfortunately these actions protected, can registered explicitly (programmatically via calls registerreceiver() method). can't use them outside of app. also heard of powermanager , it's not idea use long time because ...

Can I make Visual Studio 2017 stop indenting braces for case? -

visual studio indents braces in case this: switch(variable) { case 0: { // code break; } } however better without indentation: switch(variable) { case 0: { // code break; } } i looking through options, didn't find 1 want. did miss or not there? under visual studio options >> texteditor >> c# >> code style >> formation >> indentation is looking . see several options under menu , set settings wish. in case , setting called "indent case contents"

algorithm - Trouble understanding a specific C implementation of Merge Sort -

i'm trying follow code step step still can't understand steps it's taking. void merge (int *a, int n, int m) { int i, j, k; int *x = malloc(n * sizeof (int)); (i = 0, j = m, k = 0; k < n; k++) { x[k] = j == n ? a[i++] : == m ? a[j++] : a[j] < a[i] ? a[j++] : a[i++]; } (i = 0; < n; i++) { a[i] = x[i]; } free(x); } void merge_sort (int *a, int n) { if (n < 2) return; int m = n / 2; merge_sort(a, m); merge_sort(a + m, n - m); merge(a, n, m); } here's simple example can see issues are. it's sorting integer array {4,3,2,1} . #include <stdio.h> #include <stdlib.h> void merge (int *a, int n, int m) { int i, j, k; int *x = malloc(n * sizeof (int)); (i = 0, j = m, k = 0; k < n; k++) { x[k] = j == n ? a[i++] : == m ? a[j++] : a[j] < a[i] ? a[j++] ...

android - How to implement Floating Action Button's speed dial mode? -

how can implement floating action button expanded or displayed in material design's ( https://storage.googleapis.com/material-design/publish/material_v_11/assets/0b8v7jimpsdi-zfr3dgtlujzad1u/components-buttons-fab-transition_speeddial_01.webm ) speed dial section here full page link ( https://material.io/guidelines/components/buttons-floating-action-button.html ) check out library. can create floating action button 1 in video. https://github.com/clans/floatingactionbutton android design library not providing default implementation of speed dial asking.

Unable To Install Any Version Of Java on Windows 7 (64-bit) -

note :- please read full. i unable install java se 8 tried, installer unpacked , installation goes on until mid-way, message displayed installation files corrupted. so, tried install new setup, didn't quite work out either. tried microsoft support on found troubleshooter didn't work either.i tried installing java se 7 , again same problem faced me. because said files corrupted , didn't specify did them suggest follow this: first of all: install java if have (it contains jvm) download java . then go here , choose se want install. suggest install jdk 8. download java se

android - Can not use colored icons for Slide Drawer -

Image
icons using here colored, not show on run. tried app:itemicontint="@null" in xml, no use. xml code: <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:id="@+id/home" android:title="@string/home" android:icon="@drawable/icon_home" app:itemicontint="@null"/> <item android:id="@+id/help" android:title="@string/help" android:icon="@drawable/icon_help"/> </menu> **this layout file slide drawer appear. have deleted unnecessary code make simple ** <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent > <linearlayout a...

android - Set CheckBox enabled if togglebutton is checked -

i created togglebutton push notification service (if button checked, notifications reveived). want, when check button, checkbox checkbox. if button isn't check, checkbox should disabled. i used code, not work. when togglebutton off, checkbox disabled. not work otherwise. togglebutton toggle = (togglebutton) findviewbyid(r.id.tooglenotifications); toggle.setchecked(pushbots.sharedinstance().isnotificationenabled()); toggle.setoncheckedchangelistener(new compoundbutton.oncheckedchangelistener() { public void oncheckedchanged(compoundbutton buttonview, boolean ischecked) { pushbots.sharedinstance().togglenotifications(ischecked); chicken.setenabled(false); } }); if (toggle.ischecked()) { chicken.setenabled(true); } i not sure trying implement enable/disable checkbox on toggle change, should that: toggle.setoncheckedchangelistener(new compoundbutton.oncheckedchangelistener() { pu...

mfc - Can a COM interface return a integer instead of a long? -

here class , associated interface: [guid("xx")] [comvisible(true)] [interfacetype(cominterfacetype.interfaceisiunknown)] public interface istudentitem { string type { get; set; } datetime week { get; set; } int study { get; set; } } [guid("yy")] [classinterface(classinterfacetype.none)] [comvisible(true)] public class studentitem : istudentitem { public string type { get; set; } public datetime week { get; set; } public int study { get; set; } } as can see, study defined int . but in mfc side, when using property, end long : long lstudynumber = 0; if(succeeded(studentitem->get_study(&lstudynumber))) oentry.istudypoint = static_cast<int>(lstudynumber); my dll in both 86x , 64x editions. there way get_study property return integer instead? why want this. use appropriate type makes sense data in os , bitness. you can use int. coms know __int3264 type in midl compiler , inside tlb (type libraries) ...

javascript - How do i check inBetween time using time zone Moment -

i'm trying time in between it's not working. "not business time!" let currenttime = moment().tz('europe/london'); let opening = moment('9:00am', 'h:mma'); let closing = moment('7:00pm', 'h:mma'); console.log(currenttime); console.log(opening); console.log(closing); if (currenttime.isbetween(opening,closing)) { opentext = "it's business time!" } else { opentext = "not business time!" } console output moment.parsezone("2017-08-20t16:57:06.117+01:00") moment("2017-08-20t09:00:00.000") moment("2017-08-20t19:00:00.000") make sure lib version 2.9.0+ reference make sure include: moment.js moment-timezone.js moment-timezone-with-data.js working example: http://jsfiddle.net/guw1s31q/1/

mysql - Python global name 'urls' is not defined Issue -

though urls defined, keep getting "global name 'urls' not defined" , url data not inserted mysql . suggestions on where? i'm making mistake here? # ! /usr/bin/python # description : script can collect urls tweets , records them research mysql db. __future__ import print_function import tweepy import json import mysqldb dateutil import parser words = ['security'] # credentails consumer_key = "" consumer_secret = "" access_token = "" access_token_secret = "" host = "192.168.150.94" user = "root" passwd = "blah" database = "tweets" def store_data(tweet_url): db = mysqldb.connect(host=host, user=user, passwd=passwd, db=database, charset="utf8") cursor = db.cursor() insert_query = "insert tweet_url (urls) values (%s)" cursor.execute(insert_query, (urls)) db.commit() cursor.close() db.cl...