Posts

Showing posts from June, 2010

connection - Crate.io: Can't connect remotely -

i've installed crate db on virtual machine ubuntu (xenial). since want connect both vm , windows host, i've tried set vm's ip on both params in crate.yml: network.host network.publish_host the rest of parameters can see in crate.yml but won't trick (i err_connection_timed_out error when try connect "my_vms_ip:4200" windows host pc) , can't find way around on crate.io nor on google. would of have idea? thanks lot nb: i'm running crate 2.0.7

python - Play square wave SciPy and PyAudio -

i'm trying play square waves generated using scipy pyaudio error typeerror: len() of unsized object which kind of strange because square wave object should have size, right? rate = 48000 p = pyaudio.pyaudio() stream = p.open(format = pyaudio.paint16, channels = 2, rate = rate, output = true) # ... inside loop wav = signal.square(2*math.pi*freq*t) wav = wav.astype(np.int16) stream.write(wav) # crash here the crash happens on first iteration of loop, suppose loop not problem. i same error. however, omitting information, assume these imports: import pyaudio import math import numpy np scipy import signal and that freq = 440 it looks variable iterating t , it's scalar. might have reasons this, don't think how scipy.signal meant work. if use vector t instead: t = np.linspace(0, 2) then signal.square(...) , stream.write(wav.astype(np.int16)) work without problems.

java - Filter a ListView with custom adapter and custom row in a fragment -

i have listview custom adapter in fragment. works fine i'm trying implement way filtering list when typing in edittext (i've tried searchview did not work either). each row has 2 edittexts , imageview. in oncreateview : lst=(listview)rootview.findviewbyid(r.id.lst); lst.settextfilterenabled(true); mainad = new marrayadapter(getactivity(),r.layout.row,downlist); //it's more complicated listview populated correctly lst.setadapter(mainad); lst.settextfilterenabled(true); edit = (edittext) rootview.findviewbyid(r.id.txtexample); edit.addtextchangedlistener(new textwatcher() { @override public void beforetextchanged(charsequence charsequence, int i, int i1, int i2) { } @override public void ontextchanged(charsequence charsequence, int i, int i1, int i2) { mainad.getfilter().filter(charsequence.tostring()); } @override public void aftertextchanged(editable editable) { } }); return rootview

oracle - Procedure: commit after 10000 records -

create or replace procedure testing begin insert t3 select * t2; insert t1 select * t4; commit; exception when other rollback; end; this work fine t2 - 3 millions t4 - 3 millions total have 6 million record , due reason temp space gets filled want commit after every 10000 record inserted . how do? i use bulk collect , forall . see incremental commit processing forall , bulk processing bulk collect , forall examples can adapt tp case.

android - Possible to read sensor values of phone just by bluetooth? -

when connect bluetooth speakers or external device connecting them using android/iphones bluetooth settings. android os doing this. example: iphone bluetooth menu these bluetooth speakers not need additional app required download work speakers. phone seems recognize bluetooth device's profile headset/speaker , automatically gives audio output speaker. is possible replace bluetooth speakers device read sensor values (gps,gyro,etc). example, pair device through phone's bluetooth settings menu , have sensor values of phone given device. from reading device have have "health device profile" in order read sensor information, have no idea kind of chip use, or if possible. any insight, suggestions, or knowledge million. thank you! yes possible, experience anadafruit board, , accidently ordered ble addon. ble(bluetooth low energy) nice low power uses, optimized bluetooth use doesnt take battery either. so yes possible.

javascript - ReactJS, rendering base64 string in <img> tag gives error ERR_INVALID_URL -

i attempting render few server generated images (matplotlib graphs specific) reactjs module without saving files on server. approach took use base64 generate image string. when time comes render image in react component, use: render(){ const chart1 ="data:image/png;base64," + this.props.matchplot1 return <div> <img src={chart1} /> </div> } but unfortunately greeted with: get data:image/png;base64,b'iv... ...cyii=' net::err_invalid_url in javascript console. understand, somewhere along line the resulting html thinks i'm specifying external hyperlink, when in fact want use actual decoded base64 string image. have seen solutions angular (img ng-src="") , react-native (image /), haven't found solution reactjs. i using reactjs 15.1.0 , jsxtransformer v0.13.3 client-side rendering. webserver, if relevant, flask python3. any help, or alternate strategy produce image without saving copy on server appreciat

Array doesnt Update in JavaScript -

i have code. need see in array y objects assigned inside statement (increase , decrease). in first console.log can see array updated in second it's empty. function myfunction() { var y = new array(2); $.getjson('../docs/natures.json', function(data) { var nature = document.getelementbyid("nature").value; for( var = 0; i< data.natures.length; i++) { var x = data.natures[i]; if((nature.localecompare(x.name)) == 0) { y=[x.increase]; console.log(y[0]); y.push(x.decrease); console.log(y[1]); break; } } console.log(y); <!- first -> }); console.log(y); <!- second -> } my json file : {"natures":[ { "name":"some name", "increase": "some increase", "decrease": "some decrease" }, {...} ]} my results i

java - FileNotFound: Access Denied -

i have new windows 10 machine. tomcat throwing error - filenotfoundexception - access denied while writing application log. able create folders or save file in same path when try programmatic, throwing error access denied when checked 'canwrite()' on path returning true. canwrite:true java.io.filenotfoundexception: c:\users\<user>\logs (access denied) i tried giving 'full control' folder didn't help. any pointers ? thanks! reboot , retry (i have seen exact same in windows domain environment. after reboot works.); is tomcat started service, or standalone app? check user own tomcat process; if both failed, try delete log folder, see if other process locks log folder; at last, can use process monitor ( https://docs.microsoft.com/en-us/sysinternals/downloads/procmon ) drill internal data windows, see happens.

angular - angular2 upload a safeUrl(using domSanitizer) image to firebase storage -

i'm reading image file , wanted upload firebase storage. i'm using function read image data: readimage2(inputvalue: any): observable<any> { var file:file = inputvalue.files[0]; const objecturl = window.url.createobjecturl(file); var myobs = observable.create((observer) => { observer.next({imageurl: this.sanitizer.bypasssecuritytrusturl(objecturl)}) }) return myobs } then, i'm using tostring() method on imageurl convert string , using firebase.storage().ref(`images/${this.guid()}`).putstring(image) to upload image. however, uploads string value not image. how convert safeurl obtained after using sanitizer blob or can upload firebase?

vb.net - Using Canvas in order to BringToFront elements in WPF -

following codes okey. <dockpanel> <canvas> <button name="button6" canvas.left="60" canvas.top="10" height="100" width="100" panel.zindex="1"/> <button name="button5" canvas.left="60" canvas.top="10" height="100" width="100" panel.zindex="2"/> <button name="button4" canvas.left="60" canvas.top="10" height="100" width="100" panel.zindex="3"/> <button name="button3" canvas.left="60" canvas.top="10" height="100" width="100" panel.zindex="4"/> <button name="button2" canvas.left="60" canvas.top="10" height="100" width="100" panel.zindex="5"/> <button name="butto

c - Segmentation fault after resizing array -

i'm trying implement algorithm, sorts words length of 100 chars alphabetically. idea each word fgets(), check if length under 100 chars , if so, put array of strings after resizing it. now i'm getting segfault in line 37, supposed use strcpy() put string string array. i'm pretty sure resizing of array responsible error, since segfault occurs @ 2nd word (or 2nd iteration of while-loop) #include <stdlib.h> #include <stdio.h> #include <string.h> #include <errno.h> int cmpstr(const void* a, const void* b){ const char* aa = *(const char**)a; const char* bb = *(const char**)b; return strcmp(aa,bb); } int main(int argc, char* argv[]){ //buffer array check word length char barray[102]; char* buffer = barray; //main array pointer char** list; list = (char**)calloc(1, sizeof(char*)); //if calloc fails if(list == null){ perror("calloc() fails @ main array"); return -1; }

asp.net mvc - Asp MVC Routing not working Properly -

i'm new mvc framework; i'm trying learn. i'm trying redirect login home page [httppost] public actionresult login(register model) { studentdbhandle db = new studentdbhandle(); datatable dst = db.login(model); if (dst.rows.count==1) return redirecttoaction("index","student"); else { viewbag.message = "login failed"; return view(); } } it says "no route in route table matches supplied values." so added route in routeconfig file public static void registerroutes(routecollection routes { routes.ignoreroute("{resource}.axd/{*pathinfo}"); routes.maproute( name: "login", url: "{controller}", defaults: new { controller = "register", action = "login", id = urlparameter.optional } ); routes.maproute( name: "homepage", url: "{controller}/{action}/{id}",

c++ - `CreateFile` for UWP in visual studio not available in <Windows.h>? -

still familiarizing myself vs, wanted use method createfile in 1 of source files uwp app building compiler says 'createfile': identifier not found... included header <windows.h> . tried in console application template , works. suggestions? header: #pragma once #include <windows.h> #include <string> #include "pch.h" typedef std::basic_string<tchar> tstring; class serial { public: serial(tstring &commportname, int bitrate = 115200); ~serial(); private: handle commhandle; int write(const char *buffer); }; source: #include "pch.h" #include "serial.h" serial::serial(tstring &commportname, int bitrate) { commhandle = createfile(commportname.c_str(), generic_read | generic_write, 0, null, open_existing, 0, null); } serial::~serial() { closehandle(commhandle); } int serial::write(const char *buffer) { dword numwritten; writefile(commh

javascript - Font awesome icons and toggling -

good afternoon, i've added font awesome icons website , great. want toggle between fa-angle-up , fa-angle down when user clicks accordion content. this javascript doing job fine: $(function() { $('a').click(function() { $(this).find('i').toggleclass('fa-angle-down fa-angle-up'); }); }); the problem i'm having other icons have been inserted on page within tag toggling show fa-angle- down when click them. one, example, should not toggle: <i class="fa fa-envelope"></i> how can toggle fa-angle icons without toggling other icons in tags? thank you. $( "a" ).toggle(function() { console.log( "first handler .toggle() called." ); $(this).find('i').removeclass('fa-angle-up'); $(this).find('i').addclass('fa-angle-down'); }, function() { console.log( "second handler .toggle() called." ); $(this).find('i').removeclass(&#

Mobile Storage in Angular -

i started work on mobile angular application. there possible way store data encrypted such token, usernames , passwords, , other needed data. cookie , localstorage data can handled 3rd party applications. thanks cookies can handled if not encrypt data can encrypt , decrypt using ng2-web-cryptography unique key. the angular-2-local-storage library can used store data on mobile side. encryption can provided ng2-web-cryptography library using enterprise level encryption (aes-cbc, aes-ctr, aes-gcm, rsa-oaep). to encrypt data in cookie or local-storage using token generated backend. https://www.npmjs.com/package/angular-2-local-storage local storage. https://www.npmjs.com/package/ng2-web-cryptography encryption. in below link, can see encryption types , difference. https://diafygi.github.io/webcrypto-examples/ this library supports aes-gcm , ecdsa , hmac , sha-256 , sha-384 , sha-512 , ecdh , pbkdf2 , aes-kw , rsa-oaep , aes-ctr , aes-cbc , aes-cfb , rsassa

excel - Copy and paste to a closed workbook -

my question possible copy , paste closed workbook , save csv? first workbook active though suppose copying (from closed workbook) , pasting (to closed workbook) ideal not essential. i'm sorry if silly question wondering save cpu unnecessary hardship , having open many excels. the code below tends work enough though stumped how achieve pasting specific csv saving required active. that being said can copy closed workbook active 1 though require opposite. any appreciated :). option explicit sub copytoarchive() dim wb1 excel.workbook set wb1 = workbooks.open("c:\users\excel.xlsx") dim wb2 excel.workbook set wb2 = workbooks.open("c:\users\csv.csv") wb1.sheets("sheet1").range("a1:z10000").copy wb2.sheets("sheet1").range("a65536").end(xlup).offset(1, 0).pastespecial _ paste:=xlpastevalues, operation:=xlnone, skipblanks:=false, transpose:=false wb1.close savechanges:=true end

php - Creating PDF from HTML facing a few issues -

Image
i creating pdf using php imagick, passing html php , generating pdf. font not looking fine , facing issues in pdf. difference image here: html , pdf files in google drive: https://drive.google.com/open?id=0b9iyq9nffmokz245lvzkz2xjnuu update : i using imagick module version 3.4.1. spelling mistake. command have: $orientation = 'landscape'; exec('wkhtmltopdf --lowquality --page-height 200 --page-width 155 -b 3 -l 3 -r 3 -t 6 --page-offset -1 --orientation '.$orientation.' '.' /directory/pdf/'.$_post['uid'].'.html'.' /directory/'.$name);

reflection - Understanding Java annotations -

i've looked around bit, , i'm failing understand parts of how java annotation work. all examples i've seen far create annotation, have main method runs through classes in project using reflection. stuff , make annotation work. however i'm failing understand how works if want make annotation project jar can include in project, jackson, guice, hibernate, etc. main method wouldn't work in case, right? i've looked tutorials on how make annotation done jar project can include, haven't found yet. ideally i'd able use inside web framework such spring or play. there 2 main kinds of annotation want think about. first kind runtime annotation. example @jsonignore in jackson. class test { @jsonignore private int num; private string str; } when user passes test library code code, use getclass() inspect annotations , magic. is, when user does mylibrary.dosomething(something) you call something.getclass() , loop on annotations som

SQL Server database redesign ideas -

Image
i have table contains list of menu items. menu item table related 5 other tables menu content table, menu download table. right got new requirement add 1 more layer saying each menu can associated multiple technical codes. looking optimized db restructuring without affecting existing data. menu table: menuid menuname ---------------- 1 menu1 2 menu2 menu content table: menucontentid menuid menucontent --------------------------------- 1 1 contentsss 2 2 content2 now need add new relation techcode . each menuname can have 2 versions. application in production. thinking optimized way redesign database , application. first approach adding code , adding tech_code menuitem table , group based on code. menuid code menuname tech_code ------------------------------- 1 m menu1 2 m menu2 b 3 menu3 menucontentid menuid menucontent --------------------------------- 1 1

php - Check if variable with a number stored as contains a decimal point -

i'm checking if custom field has decimal, , adding ".0" if doesn't. for reason, keep getting incorrect outputs: adds decimal either way. function containsdecimal( $value ) { if ( strpos( $value, "." ) !== false ) { echo "$value.0"; } else { echo "$value"; }} and call: <?php containsdecimal(the_field('carbs-g')); ?> <?php containsdecimal(the_field('fiber-g')); ?> with carbs-g = 1.2 , fiber-g = 0... this returns: 1.2.0 , 0.0 when use call correct results: <?php containsdecimal(1.2); ?> <?php containsdecimal(0); ?> this returns: 1.2 , 0.0 your logic backwards :-) you adding ".0" when number has decimal (the strpos result isn't false). should adding when strpos result is false (the number doesn't have decimal). function containsdecimal( $value ) { if ( strpos( $value, "." ) === false ) { echo "$value.0";

Firebase+Javascript Convert anonymous account to permanent - Error: response is not defined -

i'm trying build site user can first login anonymously using firebase , convert account permanent signing in facebook. i'm following instructions given @ https://firebase.google.com/docs/auth/web/anonymous-auth i'm getting following error "uncaught referenceerror: response not defined". tried converting account using google sign in error "googleuser not defined". doing wrong? this code:- <html> <body> <button onclick = "anonymouslogin()">anonymous signin</butto> <button onclick = "facebooksignin()">facebook signin</button> <button onclick = "facebooksignout()">facebook signout</button> </body> <script> function anonymouslogin(){ firebase.auth().signinanonymously().catch(function(error) { // handle errors here. var errorcode = error.code; console.log(errorcode) var errormessage = error.me

javascript - React Router Redux - Component never renders -

Image
i'm trying latest react-router-redux (v5) working, never renders component. 1 gets rendered home (/). breakpoints in other routes components never hit. i've removed connect(mapstatetoprops, mapdispatchtoprop)(component) call (and did simple component) - still nothing rendered. the route in browser bar changes. if import projects in index.js, rid of routing , nav, renders fine. i've copy pasted documentation @ https://github.com/reacttraining/react-router/tree/master/packages/react-router-redux unless there incompatibility i'm not aware of? the code packages.json "react": "15.5.4", "react-dom": "15.5.4", "history": "^4.6.3", "isomorphic-fetch": "^2.2.1", "prop-types": "^15.5.10", "react-redux": "^5.0.6", "react-router": "^4.1.2", "react-router-redux": "^5.0.0-alpha.6", "redux": "^3

powershell - Adding an auto-incrementing number to a file name string -

i powershell script modify name of file increment number every time. this file name: abc-0.2.0.1-snapshot-barista.zip . want write syntax increment every time mentioned below: abc-0.2.0.2-snapshot-barista.zip abc-0.2.0.3-snapshot-barista.zip abc-0.2.0.4-snapshot-barista.zip abc-0.2.0.5-snapshot-barista.zip abc-0.2.0.6-snapshot-barista.zip abc-0.2.0.7-snapshot-barista.zip abc-0.2.0.8-snapshot-barista.zip abc-0.2.0.9-snapshot-barista.zip abc-0.2.0.10-snapshot-barista.zip abc-0.2.0.11-snapshot-barista.zip and on … use regular expression replacement callback function: $name = 'abc-0.2.0.4-snapshot-barista.zip' [regex]$re = '(.*?\.)(\d+)(-snapshot-.*\.zip)' $cb = { $a, $b, $c = $args[0].groups[1..3].value '{0}{1}{2}' -f $a, ([int]$b+1), $c } $re.replace($name, $cb)

javascript - Scroll Event - Seamless Translation Displacement -

adding event listener element scroll event (and wheel too?) i'm trying use displacement (n.scrollleft , n.scrolltop) position element in such way appears not scroll. example, freezing table headers in table when scrolling down stay on top. i think there fundamental difference between browsers on how scroll event used because in chrome looks good, safari , firefox event seems fire bit late (page scrolls, headers snap shortly after). seamless on chrome, jittery on safari & firefox: var container = document.queryselector('#container'); var table = document.queryselector('table'); var topheaders = [].concat.apply([], document.queryselectorall('tbody th')); container.addeventlistener('scroll', updatetabletranslations, false); container.addeventlistener('wheel', updatetabletranslations, false); function updatetabletranslations(e){ var x = container.scrollleft; var y = container.scrolltop; topheaders.foreach(function (topheade

css - How to style first and last element in the selected date range in JQuery datepicker? -

Image
i can't solve 1 thing, how can style first , last element of selected date range in jquery ui datepicker? have code: $(document).ready(function() { // jquery datepicker settings $(function() { $("#datepicker").datepicker({ numberofmonths: 3, showbuttonpanel: false, mindate: 0, beforeshowday: function(date) { var date1 = $.datepicker.parsedate($.datepicker._defaults.dateformat, $('#start-date').val()); var date2 = $.datepicker.parsedate($.datepicker._defaults.dateformat, $('#end-date').val()); if (date >= date1 && date <= date2) { return [true, 'ui-state-selected-range', '']; } return [true, '', '']; }, onselect: function(datetext, inst) {

javascript - How auto sort checkbox list in html -

this question has answer here: how sort checkboxes class, value, , checked 1 answer in html form default checkbox , other add dynamically when check checkbox after checkbox order in list shuffled. how sort in as-sending order when load page. html code here: <div class="checkbox-list" style="width: auto; height: 100px; overflow-y: scroll;"> <label><div class="checker" id="uniform-ch2"><span><input type="checkbox" id="ch2" name="data[chk_name][]" value="further review"></span></div>further review</label> <label><div class="checker" id="uniform-ch3"><span><input type="checkbox" id="ch3" name="data[chk_name][]" value="hot doc"></span></div>h

ios - Why would I put data in the app's documents folder instead of the group container? -

my ios app going have extension. i'm planning share documents & database extension creating app group , putting files group's container, per official guidelines. are there downsides keeping of app's data in group container? is there reason leave data in app's folder instead of group folder, seeing might used or written extension in future?

java - Place marker at latitude and longitude of centre of map -

had issue needed place marker @ exact centre of map screen , looked @ lot of questions , answers not wanted do. app allows user move map , once crosshairs in centre of map @ desired location, tap button , marker appears @ location. map.getprojection().fromscreenlocation met needs did not have coordinates not implement solution. so answer in same situation. so soltuion use getcameraposition method follows. , fired button r.id.addmarker in xml. findviewbyid(r.id.addmarker).setonclicklistener( new view.onclicklistener(){ @override public void onclick(view view) { if(mymap != null){ double mylat = mymap.getcameraposition().target.latitude; double mylng = mymap.getcameraposition().target.longitude; latlng markerpoint = new latlng(mylat, mylng); mymap.addmarker(new markeroptions().position(markerpoint)).settitle

postgresql - Select physically last record without ORDER BY -

an application inherited me oriented on "natural record flow" in postgresql table , there delphi code: query.open('select * thetable'); query.last(); the task fields of last table record. decided rewrite query in more effective way, this: select * thetable order reportdate desc limit 1 but broke workflow. of reportdate records turned out null. application oriented on "natural" records order in table. how physically last record selection without order by? to physically last record selection, should use ctid - tuple id, last 1 - select max(ctid). smth like: pond93=# select ctid,* t order ctid desc limit 1; ctid | t --------+------------------------------- (5,50) | 2017-06-13 11:41:04.894666+00 (1 row) and without order by : pond93=# select t t ctid = (select max(ctid) t); t ------------------------------- 2017-06-13 11:41:04.894666+00 (1 row) its worth knowing can f

imacros Extract all text without href -

need extract text1,text2,text3 (i mean text, until text9 in category) <h4>category:</h4> <p><a href="">text1</a>, <a href="">text2</a>, <a href="">text3</a></p> my imacros code extract text1 tag pos=r1 type=a attr=txt:* extract=txt q : how extract text in category ? thanks to expand on javascript comment, how go it: extractcategory.js content // play macro reading category data iimplay("foo.iim"); // last extracted value, i.e. p content var pcontent = iimgetextract(); // parse p using regex, first find tag pairs , drop surrounding tags var result = pcontent.match(/<a(.*?)<\/a>/g).map(function(val){ return val.replace(/<\/?a>/g,'').replace(/<a.+>/g,''); }); // pass generated string macro work iimset("passed_var", result); iimplay("bar.iim"); next extractcategory.js, foo.iim conten

Joint expectations in Python or R - Cross Validated

$x$ , $y$ bivariate distributed $n(0,1)$ correlation coefficient of $p$. is there way find expectation of $f(x)*g(y)$ - let $f(x)$ function of $x$ integrable differentiable $e[f(x)*g(y)]$? $g(y) = 1$, if $y>c$. $g(y) = 0$, otherwise is there way in python? or in other language r? i aware of multivariate_normal() function under scipy.stats . import scipy.stats st = st.multivariate_normal() is there way can use combined other method? it great if can me analytical solution also. example can take $$ f(x) = exp(x)$$ you can rather approximate expected value of $f(x)g(y)$ using simulation. instance, here r code simulate expected value of $x^2e^y$ $\rho = 0.2$ using 1 million samples: # parameters calculation f <- function(x) x^2 g <- function(y) exp(y) rho <- 0.2 # approximate expectation library(mvtnorm) set.seed(144) simulated <- rmvnorm(1e6, c(0, 0), rbind(c(1, rho), c(rho, 1))) mean(f(simulated[,1]) * g(simulated[,2])) # [1] 1.713411 simil

bash - ansible - if statement and redirect to a file with shell module doesn't work -

i understand it's best use ansible modules as possible, reason, being forced use shell module. i have date_list file list of dates: 20170811 20170802 20170812 , on.. i need compare dates ansible time shell module: - name: read file date , compare server date , redirect file shell: | if [ {{ item.split('\n')[0] }} -lt ${{ gv_remote_date.stdout }} ]; echo {{ item.split('\n')[0] }} >> final_output fi args: executable: /bin/bash with_lines: "{{ date_list.stdout_lines }}" i no output @ all. in debug: can see it's switching items nothing in final_output file. why not use native when statement: - name: read file date , compare server date , redirect file shell: echo {{ item }} >> final_output args: executable: /bin/bash when: item | int < gv_remote_date.stdout | int with_items: "{{ date_list.stdout_lines }}" or (to make idempotent): - lineinfile: dest: final

stanford nlp - What is the correct approach to extract information from multiple sentences using Apache Open NLP? -

test data: $$ <rate of interest> <buy/sell> following on <date> <code1> <decription1> <number1> <code2> <decription2> <number2> <code3> <decription3> <number3> this means, applied following 3 codes (each provided code, description , number). in first line applies of them. which approach/model should use extract information in behaviour described above? i have tried running named entity recognition. having them broken in 4 sentences, used <start:common> following <end> suggest common information. can suggest better approaches, pick, either in apache opennlp/stanford nlp or other tool?

Excel Web Query Parameters Error -

Image
i'm having troubles adding parameters web query reads currency rates. parameter: date format updates daily (yearmonthday) in cell ("a1") - ["datums"] url: http://www.bank.lv/vk/ecb.xml?date= ["datums"] error - in url: error - in excel: excel - parameter:

Getting Bitmap from Image using Glide in android -

i want bitmap image using glide. doing following - bitmap chefbitmap = glide.with(myactivity.this) .load(chef_image) .asbitmap() .into(100, 100) .get(); it used work previous glide version. not work in gradle - "compile 'com.github.bumptech.glide:glide:4.0.0'" i want use dependency because latest version. can me in regard. in advance. you should add in dependencies{ compile 'com.github.bumptech.glide:glide:4.0.0' compile 'com.android.support:support-v4:25.3.1' annotationprocessor 'com.github.bumptech.glide:compiler:4.0.0' also, give permission in manifest.xml

javascript - RxJS performance numbers at animation speeds -

anyone have numbers/resources on rxjs performance when events happen @ animation-like speeds (e.g @ least 20 times second)? i'm looking refactor javascript simulator (which performs simulation steps @ least 20 times second) using events , listeners , i'd know if it's feasible use rxjs event queue/listener solution (so don't have write own). i'm curious how scales when have hundred things listening on observable give me idea on how structure view updates (whether should keep few listeners , keep map of set of view elements need updating or keep simple having each element register listener). google searching got me this: is rxjs faster imperative? and results bit concerning (10x slower plainer code still additional .005ms per event system 1 listener). i'd run own experiments well, scalability info (not performance other things bookkeeping , garbage collection) who's used rxjs on real project considerable number of listeners useful. i'

Google Sheet importxml - How to retrieve only the 1st value? -

=iferror(importxml(b1, "//title/text()"),a1) i'm using google script input above c1 , fill down. it works fine when there 1 title in each result, returns error when there more 1 : error array result not expanded because overwrite data in c2 how can limit result first title tag found, or (probably better) modify iferror handle array 'error'? =iferror(importxml(b1, "(//title/text())[1]"),a1) or =array_constrain(iferror(importxml(b1, "//title/text()"),a1),1,1) mark answer, if solves problem.

swift - How to to hide switch from cell? -

how hide switch cell when barbutton title edit change done how possible? override func setediting(_ editing: bool, animated: bool) { super.setediting(editing,animated:animated) if self.isediting{ self.editbuttonitem.title = "done" tableview.setediting(true, animated: true) tableview.reloaddata() } else{ self.editbuttonitem.title = "edit" tableview.setediting(false, animated: false) } } in setediting method can access visible rows way tableview.visiblecells.foreach{ cell in //define custom cell class if let customcell = cell as? yourcustomcellcalss{ //call here method show/hide switch or whatever have hiding customcell.hideswitch() } } but change visible rows, need add checking self.isediting in cellforrowat method rows dequeued after scrolling show/hide switch if code differs custom cell implementation, please add more of code in question let me kno

c# - ProjectOxford Emotion -

i have been trying use emotion detection algorithms microsoft project oxford. however, client exception telling me image big or small. where can find documentation tells me dimensions use? from documentation jpeg, png, gif(the first frame), , bmp supported. image file size should larger or equal 1kb no larger 4mb. the detectable face size between 36x36 4096x4096 pixels. faces out of range not detected. so need picture between 1kb , 4mb in size , 36x36 4096x4096 in resolution.

c# - How to change Button Content Inside ListView based on bit values -

i have button inside list view default text "subscribe" if tap on button need change button text unsubscribe (i'm getting bit value service.) , vice versa using mvvm pattern . please share code piece of code same. thanks in advance

XAMPP Fatal error after switching to php -

i'm have created simple webpage myself. clickdummy works perfect. want add php simple login mechanics. i'm using xampp this. after modified file endigs html php, got following error: warning: unknown: failed open stream: no such file or directory in unknown on line 0 fatal error: unknown: failed opening required 'p:/services/it-services/50_application_services/60_auszubildende/nicolo/website/entwurf_3/index.php' (include_path='c:\xampp\php\pear') in unknown on line 0 i googled error, none of solutions worked me. have made custom vhost. httpd-vhosts.conf: <virtualhost localhost:80> documentroot p:\services\it-services\50_application_services\60_auszubildende\nicolo\website\entwurf_3 servername localhost serveradmin lhn2@bfh.ch <directory p:\services\it-services\50_application_services\60_auszubildende\nicolo\website\entwurf_3> options indexes followsyml

Customized map that is similar to of Pokemen Go or Waze in iOS -

i'm going implement customized map of pokemen go or waze style. have searched much, can't find right answers. can use mapbox that? give me examples? i'm not sure if it's possible , easy? help me! thanks maybe can have on apple base class mkmapview . provide best user experience , better flexibility. if read mapbox , googlemaps docs understand provide overlay of mkmapview. these providers usefull if want use sdk specific reason (like google direction api) or if want have map quickly. if need more specific behaviours limited scope. example, custom clusters more tricky google maps (google-maps-ios-utils doesn't provide enough flexibility) mkmapview.

Ruby - SQLite3 - set pragmas from code -

i using ruby sqlite3 (1.13.11) on macos (ruby 2.0.0-p247) create few databases application. need set pragmas, not sure doing right thing. set pragma synchronous = off db = sqlite3::database.new("test.db") db.synchronous 2 db.synchronous = 0 db.synchronous 0 this seems work, when open test.db db browser sqlite , synchronous still set full . i have tried db.execute("pragma synchronous = off") with same result. is synchronous associated connection? case pragmas ?

python - What curve_fit to use in scipy for this dataset? -

Image
i trying fit curve set of data points: def func(x, a, b, c): return * np.log(-b * x) + c #return * np.exp(-b * x) + c xdata = np.array(x) ydata = np.array(y) popt, pcov = curve_fit(func, xdata, ydata) plt.scatter(xdata, ydata, label='data') plt.plot(xdata, func(xdata, *popt), 'r', label='fit') plt.xlabel('x') plt.ylabel('y') plt.legend() plt.show() the data set contains 50 points. 2 of them outliers. generated 2 plots of data , fitted curve: first 1 contains outliers , other plot excludes outliers: however, both curve fits contain many nan values, why red fitted line small. got values of 1 each variable in popt . tried both log , exp fits seen in code above are there better curves exponential or log fits can try? edit: definition of func comes before curve_fit call

jenkins use other variables in my own shared library -

i'm writing own shared library. want use global variable in code. how can make happen ? i.e. write class. class mywork { build() { // here want use global docker(which docker-plugin) docker.dosomething { } } } enable library in 'global pipeline libraries' (i add library 'pipeline-shared-lib') create shared-library (with necessary structure) src/net/kukinet/utils.groovy package net.kukinet; def myvar = 1 def sayhello() { print ('hello') } create pipeline job , create object jenkinsjob.groovy #!groovy // need enabled in jenkins configuration ( in: manage jenkins) @library('pipeline-shared-lib') import net.kukinet.* node (){ u = new net.kukinet.utils(); stage('preperations') { print(u.myvar) u.sayhello() } }

python - ValueError: invalid literal for float(): "320" for a normal string -

i encountered strange problem: try turn string float , str this: str(float(tmp[1])/100) # tmp[1] contain str but throw out valueerror: invalid literal float(): "320" so try this: try: line_split[list_index] = str(float(tmp[1])/100) except: print >> sys.stderr, repr(tmp[1]) also, same error, , print '"320"' any help? thanks! the issue might sort of non-printing character that's present in value using. looks you're using python 2.x, in case can check them this: print repr(tmp[1]) you'll see in there that's escaped in form \x00. these non-printing characters don't show when print directly console, presence enough negatively impact parsing of string value float.

call definite folder name and value in dictionary in Python -

i want write function copy structure , content of 1 root folder 1 (that contains of files in initial folder , function must compare files , directories , copy if not exists in destination folder). name of folders dict.values(). def copy_tran(reg_dir): z_folders = os.listdir(reg_dir) png_folder = r'c:\users\tei\desktop\temp' png_subfolders = os.listdir(png_folder) dir in z_folders: pngdir in png_subfolders: path_dir2 = os.path.join(png_folder, pngdir) path_dir = os.path.join(reg_dir, dir) transp_basename = os.path.basename(path_dir)[4:] png_basename = os.path.basename(path_dir2)[4:] if transp_basename == png_basename: region in dict.values(): if not os.path.exists(png_folder + '\\' + 'reg_' + ('%s' % (region))): os.mkdir(png_folder + '\\' + 'reg_' + ('%s' % (region)))

How does Kafka guarantee sequential disk access? -

i'm newbie kafka. when read documentation of kafka, saw kafka performing because of sequential disk access . but how possible? in java(or else), if use file i/o, os handle appropriately. however, can't know if os store files want store in multiple sectors or in contiguous sectors. so, kafka cannot sequential disk access occurs in opinion. am true or not? kafka not always access disk sequentially things make more disk access often sequential. kafka messages stored in larger segment files (1gb each default) , since kafka messages not deleted when consumed (like in other message brokers) kafka not end creating fragmented filesystem on time continuously creating , deleting many variable length files. instead creates segment files , appends file until reaches 1gb (a configurable limit). when messages in segment expire delete entire 1gb segment. means these 1gb sections of disk laid out contiguous blocks. recommended best practice keep these kafka commit log files

postgresql - Can't find my mistake - INSERT has more target columns than expressions -

i struggling understand made mistake. sql table java code making sql call what have checked : values of parameters amount of parameters : i'm correctly trying update of columns of sql table. tried code on sql table (with different columns) , works flawlessly. rewrote whole sql request twice , i'm still getting error. exact error message i'm getting (translated): error : insert has more target columns expressions. : function pl/pgsql insupd_ref_zone_type_link1(), line 17 @ sql instruction thanks reading, cyborgforever edit : can't open links, code below : sql table : -- table: public.ref_zone_type_link1 -- drop table public.ref_zone_type_link1; create table public.ref_zone_type_link1 ( modified_by text not null, modified_from text not null, modify_date timestamp(6) time zone not null, zonetype_id bigint not null default nextval('ref_zone_type_link1_zonetype_id_seq'::regclass), documentsubtype_id bigint not null,

python - Django get model by querystring -

i want user able pass querystring in url https://example.com/models?id=232 . query string optional. https://example/models should work too. im trying this: def myview(request, model): context = { 'model': model, } if request.get.get('id', none) != none , model.objects.get(pk=request.get.get('id', none)).exists(): id = request.get.get('id', none) context['id'] = id return render(request, 'tests.html', context) else: return render(request, 'tests.html', context) s going on in code above: want check if there query string (which models id) , if there exists model. bu tmy code not work. if both of these requirement not satisfied should load tests.html without id , without errors. how can that? id should number looking forward answers :d you getting error attributeerror: 'modelname' object has no attribute 'exists

asynchronous - How to calculate the execution time of an async function in JavaScript? -

i calculate how long async function ( async / await ) taking in javascript. one do: const asyncfunc = async function () {}; const before = date.now(); asyncfunc().then(() => { const after = date.now(); console.log(after - before); }); however, not work, because promises callbacks run in new microtask. i.e. between end of asyncfunc() , beginning of then(() => {}) , queued microtask fired first, , execution time taken account. e.g.: const asyncfunc = async function () {}; const slowsyncfunc = function () { (let = 1; < 10 ** 9; i++) {} }; process.nexttick(slowsyncfunc); const before = date.now(); asyncfunc().then(() => { const after = date.now(); console.log(after - before); }); this prints 1739 on machine, i.e. 2 seconds, because waits slowsyncfunc() complete, wrong. note not want modify body of asyncfunc , need instrument many async functions without burden of modifying each of them. otherwise add date.now() statement @ beginning , end of

python - How to spread a column in a Pandas data frame -

i have following pandas data frame: import pandas pd import numpy np df = pd.dataframe({ 'fc': [100,100,112,1.3,14,125], 'sample_id': ['s1','s1','s1','s2','s2','s2'], 'gene_symbol': ['a', 'b', 'c', 'a', 'b', 'c'], }) df = df[['gene_symbol', 'sample_id', 'fc']] df which produces this: out[11]: gene_symbol sample_id fc 0 s1 100.0 1 b s1 100.0 2 c s1 112.0 3 s2 1.3 4 b s2 14.0 5 c s2 125.0 how can spread sample_id in end this: gene_symbol s1 s2 100 1.3 b 100 14.0 c 112 125.0 use pivot or unstack : #df = df[['gene_symbol', 'sample_id', 'fc']] df = df.pivot(index='gene_symbo