Posts

Showing posts from September, 2011

java - How to authenticate to Mendeley using OAuth2 -

iam trying authenticate mendeley using java , library net.oauth. goal retrieve readership data mendeley add them our database of academic documents. unfortunatly getting 401 , following exception: net.oauth.oauthproblemexception @ net.oauth.client.oauthclient.invoke(oauthclient.java:246) @ net.oauth.client.oauthclient.invoke(oauthclient.java:143) @ net.oauth.client.oauthclient.getrequesttoken(oauthclient.java:101) @ net.oauth.client.oauthclient.getrequesttoken(oauthclient.java:77) @ net.oauth.client.oauthclient.getrequesttoken(oauthclient.java:116) @ org.mrdlib.mendeleycrawler.mendeleyconnection.defaultclient(mendeleyconnection.java:82) @ org.mrdlib.mendeleycrawler.mendeleyconnection.getreadership(mendeleyconnection.java:124) @ org.mrdlib.mendeleycrawler.mendeleyconnection.main(mendeleyconnection.java:190) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.ref...

monitoring - Tool chain for proprietary communication protocol -

i (the company rather) have protocol implementation uses can hardware (can transceiver). protocol not standard can protocol stack. possible use of off shelf can-bus monitors debugging , investigating data in bus? intend see bytes being transmitted , more importantly other information cycle time, frequency, delay, jitter (if any) , on. ofcourse more information , in-case of these above mentioned parameters missing, still acceptable. main purpose of project show proprietary implementation better (performance, bandwidth, speed, etc) standard can stack while still using can hardware (transceivers). i think commercial available can analyzers can need. if offer option programability, in order provide possibility make own interpretation of can frames. can-wiki offers list http://www.emtas.de/en/produkte/can-interpreter

Excel formula reference cell above last cell in range -

i'm trying set formula automatically calculate % change between added cell in range (which includes #n/a values @ bottom of range) , cell above it. i've been using formula obtain value of bottom not #n/a cell: lookup(2, 1/not(isna(g8:g19)), g8:g19) which working fine. first thought on how reach cell above use offset, so: offset(lookup(2, 1/not(isna(g8:g19)), g8:g19), -1, 0) but gives me error, think because lookup function returning value in cell rather cell reference. how should format function return value of cell above last non-n/a cell in range? try alternative seeking last non-error, numerical value in column g. =index(g:g, match(1e99, g:g))/index(g:g, match(1e99, g:g)-1) using match find last number in column returns row number index . simple matter subtract 1 row number.

Ansible. How to choose N hosts from group -

assume group has 10 hosts. how run playbook on n hosts 10. n arbitrary value 1 10. example: - hosts: groups['group_name'][1:3] works. but doesn't work if instead of 3 use variable, this - hosts: groups['group_name'][1:n] it random n, first n, last n ever. thank you. this work absolutely fine in ansible 2.1: --- - hosts: gather_facts: no tasks: - group_by: key=limited_selection when: play_hosts.index(inventory_hostname) < max_index | int - hosts: limited_selection gather_facts: no tasks: - debug: msg="i'm in limited selection group!" exec this: ansible-playbook -e max_index=3 playbook.yml or define max_index somewhere else.

Creating OneNote in a specific OneDrive folder -

i'm trying add onenote integration app using api. i'd create onenote file in specific subfolder of user's onedrive account - possible? post https://www.onenote.com/api/v1.0/me/notes/notebooks creates new notebook in /documents name provide in request body - i'd put somewhere specific. for simplicity, rest apis not allow type of customization , creates notebooks under documents folder. our feedback has found vast majority of users not care exact location of notebook long notebook , discover-able.

python - How to extract specific words from a list as the list length changes? -

let's assume have sample of following strings: string = 'http/1.1 abc-ad-sd-00 .sad.sdsd.der.net (server/1.2 [dsddsf did:t yy p ss]), http/1.1 asc-ad-sd-11 .sad.sdsd.der.net (server/1.2 [ gfef srfw:t reri pss ])' string1 = 'http/1.1 abc-ad-sd-01 .sad.sdsd.der.net (server/1.2 [dsddsf f u did:t yy p ss]), http/1.1 asc-ad-sd-13 .sad.sdsd.der.net (server/1.2 [ sff srfw:t reri pss ])' string2 = 'http/1.1 abc-ad-sd-002 .sad.sdsd.der.net (server/1.2 [dsddsf did:t yy p ss]), http/1.1 asc-ad-sd-14 .sad.sdsd.der.net (server/1.2 [ rts f srfw:t reri pss ])' string3 = 'http/1.1 abc-ad-sd-03 .sad.sdsd.der.net (server/1.2 [dsddsf did:t yy p ss]), http/1.1 asc-ad-sd-15 .sad.sdsd.der.net (server/1.2 [ tttts t srfw:t reri pss ])' here's did bold strings: if name == 'via': name = “id1” string = header_line.split(' ') b = (string[2].split('.')) value = b[0] headers[name] = value #----------# name_1 = “id2” string = he...

javascript - Firefox add-on get the DOM window which made an HTTP request -

i'm capturing http requests in firefox add-on sdk extension. need dom window associated request. however, i'm getting ns_nointerface error. here code: var httprequestobserver = { observe: function (subject, topic, data) { var httprequest = subject.queryinterface(ci.nsihttpchannel); var requesturl = subject.uri.host; var domwin; var asswindow; console.log('url: ', requesturl); try { domwin = httprequest.notificationcallbacks.getinterface(ci.nsidomwindow); asswindow = httpchannel.notificationcallbacks.getinterface(ci.nsiloadcontext) .associatedwindow; console.log(domwin); } catch (e) { console.log(e); } // console.log('tab: ', tabslib.gettabforwindow(domwin.top)); var hostname = wn.domwindow.getbrowser().selectedbrowser.contentwindow.location.host; console.log('host: ', hostname); }, observerservice() { ...

java - RecyclerView actions only edit only work on first position? -

so in recyclerview item allow user switch between eddittext , textview. works item in first position of recycler view, in second position switch ti edit text not switch textview. delete option works on positions however. here recyclerview adater package com.intellidev.mobitranscribe; import android.content.dialoginterface; import android.support.v7.app.alertdialog; import android.support.v7.app.appcompatactivity; import android.support.v7.widget.recyclerview; import android.util.log; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.edittext; import android.widget.textview; import android.widget.viewswitcher; import java.util.arraylist; public class noteitemadapter extends recyclerview.adapter<noteitemholder> { private arraylist<noteitem> noteitems; private string[] mnoteitemarray; private appcompatactivity context; public noteitemadapter(arraylist<noteitem> noteitemarraylist, appc...

python - MemoryError on Apache2 running Flask -

i'm running app on apache2 server using wsgi , flask on debian config. app python script gathers data database , gets pandas dataframe before displaying graphs on front-end. on local machine (running windows), can perform huge queries without issue 12gb available memory. when running same code on server (which has lot more memory), memoryerror python when hit 500mb in memory. i tried check limitation in limits.conf , ulimit -a , set unlimited. believe com flask's restrictions i'm not sure start looking... thanks in advance help. john

python - Pandas Dataframe: How to parse integers into string of 0s and 1s? -

i have following pandas dataframe. import pandas pd df = pd.read_csv('filename.csv') print(df) sample column_a 0 sample1 6/6 1 sample2 0/4 2 sample3 2/6 3 sample4 12/14 4 sample5 15/21 5 sample6 12/12 .. .... the values in column_a not fractions, , these data must manipulated such can convert each value 0s , 1s (not convert integers binary counterparts). the "numerator" above gives total number of 1s , while "denominator" gives total number of 0s , 1s together. so, table should in following format: sample column_a 0 sample1 111111 1 sample2 0000 2 sample3 110000 3 sample4 11111111111100 4 sample5 111111111111111000000 5 sample6 111111111111 .. .... i've never parsed integer output strings of 0s , 1s this. how 1 this? there "pandas method...

Is there any DateTime library which supports quarter of the year and week of the year Java? -

i using jodatime datetime class java project. not have support quarter of year , week of year . is there java library can used purpose? in java 8 datetimeformatter supports quarters using q format , week of year using w : localdate date = localdate.now(); datetimeformatter formatter = datetimeformatter.ofpattern("qqq w"); string text = date.format(formatter); results in third quarter , 31st week of year todays date (july 25th): "q3 31"

POST JSON object using Spring REST template -

i posting json object using spring rest template. works fine less data, posting more data throws request uri long error. final string url = getserviceurl() + "/rs/doc?param1=test"; resttemplate resttemp=getresttemplate(); httpheaders headers = new httpheaders(); headers.setcontenttype(org.springframework.http.mediatype.application_json); //set entity send httpentity<mybean> request = new httpentity<mybean>(mybean,headers); list<httpmessageconverter<?>> messageconverters = new arraylist<httpmessageconverter<?>>(); messageconverters.add(new mappingjacksonhttpmessageconverter()); messageconverters.add(new formhttpmessageconverter()); resttemp.getmessageconverters().addall(messageconverters); // send it! responseentity = resttemp.exchange(url, httpmethod.post, request, string.class); the request body should accept unlimited data in post m...

angular - wrapping angular2 material md-button inside a custom button -

i'm trying wrap material md-button inside custom-button , passing along the type of button want render via attribute. attribute gets passed along late in rendering pipeline material styles being applied. @component({ selector: 'custom-button', template: ` <button [attr.md-raised-button]="israisedbutton()"> <ng-content></ng-content> </button>`, directives: [md_button_directives] }) export class custombutton { @input('raised-button') public raisedbutton: boolean = null; public israisedbutton(): string { return (this.raisedbutton != null && this.raisedbutton != false) ? '' : null; } } my used this. <custom-button raised-button>button text</custom-button> as said attributes gets added button not rendered material raised input. any appreciated.

Run Cross compiled C app that uses shared library for android device -

i couldn't find working example following: i created shared library composed code below: foo.c: #include #include "foo.h" void foo(void) { printf("hello, i'm shared library\n"); } and foo.h interface: #ifndef __foo_h__ #define __foo_h__ void foo(void); #endif the "foo" code reside under subdirectory foo compiled using (i'll drop elaborated make options sake of simplicity): #cross_compile is: #/usr/local/toolchain/arm-2010q1/bin/arm-none-linux-gnueabi- cc := $(cross_compile)gcc $(cc) -fpic -c foo.c -o foo.o $(cc) -shared -o libfoo.so foo.o when building it- libfoo.so created successfully. main.c file: #include <stdio.h> #include "foo.h" int main(void) { printf("hello world\n"); foo(); return 0; } and build app using: $(cc) -c main.c -o main.o $(cc) main.o -lfoo -lfoo -o test so far- ok executable , pushed /data/local/tmp/. now, tried below without success (got ...

facebook - Trouble opening FB page from my android app -

Image
i using following code open facebook page android app. opening page using fb app page opened not fb page. more section. screenshots attached. public static string facebook_url = "https://www.facebook.com/localpakistanigamesandroid/"; public static string facebook_page_id = "localpakistanigamesandroid"; public string getfacebookpageurl(context context) { packagemanager packagemanager = context.getpackagemanager(); try { int versioncode = packagemanager.getpackageinfo("com.facebook.katana", 0).versioncode; if (versioncode >= 3002850) { //newer versions of fb app log.d("my","new version"); return "fb://facewebmodal/f?href=" + facebook_url; } else { //older versions of fb app log.d("my","old version"); return "fb://page/" + facebook_page_id; } } c...

MySQL 5.7 replication of session variable "sql_mode" fails -

mysql documentation v5.7 states about replication of variables : in mysql 5.7, following session variables written binary log , honored replication slave when parsing binary log, regardless of logging format: - sql_mode, (etc.) however feature not seem working. noticed in development setup , double checked fresh install of 1 master , 2 slaves mysql-sandbox . data replication works: $home/sandboxes/rsandbox_mysql-5_7_13/m master [localhost] {msandbox} ((none)) > use test; master [localhost] {msandbox} (test) > create table test1 (id int(11) unsigned not null); master [localhost] {msandbox} (test) > insert test1 values(1); master [localhost] {msandbox} (test) > select * test1; +----+ | id | +----+ | 1 | +----+ 1 row in set (0.00 sec) $home/sandboxes/rsandbox_mysql-5_7_13/s1 slave1 [localhost] {msandbox} (test) > select * test1; +----+ | id | +----+ | 1 | +----+ 1 row in set (0.00 sec) however replication of session variable sql_mode not wo...

reactjs - React - parent component with child in separate dom containers -

is possible have component child components mounted different dom objects? some pseudo-code explain wanna archieve: import childcomponent1 './components/childcomponent1'; import childcomponent2 './components/childcomponent2'; var myparentcomponent = react.createclass({ render: function() { <childcomponent1 />, document.queryselector('#component-1') <childcomponent2 />, document.queryselector('#component-2') } }); reactdom.render( <myparentcomponent />, //inherit dom mounts ); this might not right way handle though - i'm open suggestions. want this, make myparentcomponent take care of state values etc. if add multiple reactdom.render() won't have parent component. you can achieve using componentdidmount , componentdidupdate hooks manually render child components when parent component updates: class child1 extends react.component { render() { const {count, onclick} = th...

excel vba - How to add activeX buttons programmatically in VBA, filling all rows down a column -

my first post here, have been sourcing solutions , ideas website while now. collection of solutions , ideas. basically, have spread sheet application requiring first column, column a, filled "active x" buttons in every cell, looping through given quantity. have posted 1 such working solution below makes use of "form type buttons" , modules. exemplifies consider favored example working buttons. once operational column of buttons correspond relative data on same row, , when clicked open corresponding folders, , userforms in later developments. the second post uses range function, doesn't incorporate buttons interactive with. however, mouse click on range activate code within worksheet_selection change procedure...sorry stating obvious! what have been trying achieve version of code employing "activex" command buttons, after having studied great tutorials , poured on range of programing concepts, still fail miserably employ oleobjects. how add...

bash - Are there "starts with" aliases in ZSH? -

i defined several aliases folder use; e.g. alias x="cd /home/username/git/github/user/project" so typing x in terminal directly takes me project folder. i thought nice define alias use, if string starts alias; e.g. if defined starts-with-alias x="cd /home/username/git/github/user/project" typing x/abc would take me to: /home/username/git/github/user/project/abc using standard shell functions, like x() { cd /home/username/git/github/user/project/"$1"; } x take there, , x abc takes /home/username/git/github/user/project/abc . not asked for, close. disclaimer: tested under bash ; standard syntax may vary, zsh one well.

How to use Stylelint to prevent use of "max-width" in media queries -

i'd warn/error when using max-width in media queries , encourage mobile-first approach min-width . can warn/error on... @media (max-width: 50em) { padding: 1rem; } but allow... @media (min-width: 50em) { padding: 1rem; } the media-feature-name-blacklist , media-feature-name-whitelist rules can used in latest stylelint: "media-feature-name-blacklist": [ "^max-width", { "message": "use min-width mobile-first approach (media-feature-name-blacklist)", }, ], },

docker networking direct access to container -

Image
i try migrate multiple vm static ip container based solution. now i'm using vm static ip: i can ping , telnet vms telnet 10.48.0.10 5432 , telnet 10.48.0.11 5432 i want create single docker host allows me same : it great if can telnet 172.17.0.2 5432 , telnet 172.17.0.3 5432 i try via docker because want manage configuration. what proper way ? should use tcp proxy inside container manage ? the solution pretty simple. create network , bind host docker network create --subnet=10.0.0.0/24 -o "com.docker.network.bridge.host_binding_ipv4"="0.0.0.0" mynet then run container on mynet network docker run -ti --net=mynet --ip=10.0.0.30 busybox now computer if add route docker host (192.168.2.156) subnet : sudo route add -net 10.0.0.0 netmask 255.255.255.0 gw 192.168.2.156 you can ping container ( ping 10.0.0.30 )

iis - Deploying the ASP.NET Web API -

i creating first asp.net web api. created application, build them , ran application calling url http://localhost:35432/api/sample?id=1&id=83 , returns json file response. but dont see respect application on iis manager. find them or have set something. not sure how deploying application dev test server.

node.js - For loop in promise.then()? -

i need iterate between 2 values , create/touch files (i/o) on each iteration. i'm using fs-promise module asynchronously: const path = require('path'); const fsp = require('fs-promise'); function addpages(startat, pages, mode) { let htmlext = mode.html; let cssext = mode.css; fsp.readfile(path.join('.', 'templates', 'body.html'), { encoding: 'utf-8' }) .then((content) => { // return promise.all(() => {}).then().catch(); // this. (let = startat, endat = startat + pages; < endat; i++) { console.log(i); fsp.writefile(path.join('.', 'manuscript', `page-${i}`, `style.${cssext}`), '') .then(() => { console.log('yay!') }) .catch(console.log.bind(console)); // fsp.writefile(path.join('.', 'manuscript', `page-${i}`, `style.${cssext}`), ...

python - django custom validation not showing up on button click -

i wrote custom validation form in forms.py it's not working. doesn't show ("email not exist"), when press submit button looks refreshing page. appreciate help. here view.py: def delete(request): if request.method == 'post' , "deletebutton" in request.post: form = loginpagedelete(request.post) if form.is_valid(): deletedata = form.cleaned_data q = deletedata["emaild"] query = users.objects.get(email = q ) query.delete() fetch = users.objects.all() return render(request,'result.html',{'querydelete':fetch.values(),}) formdelete = loginpagedelete() return render(request,'delete.html',{"formdelete":formdelete,}) here template: <html> <head> <title>delete</title> </head> <body> {% if formdelete.errors %} <p style="color:red">please correc...

jquery - Calling REST request and handling REST response -

rest request post host:port/chaincode { "jsonrpc": "2.0", "method": "deploy", "params": { "type": 1, "chaincodeid":{ "path":"github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02" }, "ctormsg": { "function":"init", "args":["a", "1000", "b", "2000"] } }, "id": 1 } rest response { "jsonrpc": "2.0", "result": { "status": "ok", "message": "52b0d803fc395b5e34d8d4a7cd69fb6aa00099b8fabed83504ac1c5d61a425aca5b3ad3bf96643ea4fdaac132c417c37b00f88fa800de7ece387d008a76d3586" }, "id": 1 } i have set of request , response, , mention interface port 5000. how call rest req...

php - Instruction conditional if to checked double records -

Image
this question has answer here: check if row exists mysql 3 answers i have table: how can write instruction if , check records stored @ same time (in table column created_at ). example: if(created_at record key(it's column)='stan' same created_at key='stan_key' { return records key='stan' } several options this. here's version using exists : select * yourtable y1 y1.key = 'stan' , exists ( select 1 yourtable y2 y2.key = 'stan_key' , y1.created_at = y2.created_at)

c - array values not same after initializing -

i have written piece of code in c language in initializing array random numbers/characters. when print array values after initializing it, see value on every index equal last assigned value (value of last index). kindly tell problem in code? code: #include <stdio.h> #include <stdlib.h> #include <time.h> int main () { char *save[3][3] = { {" "," "," "}, {" "," "," "}, {" "," "," "} }; char x[2] = {'\0', '\0'}; int i, j, b; srand(time(null)); printf("assigned values (initializing):\n"); for(i=0; i<3; i++) { for(j=0; j<3; j++) { b = rand()%10; x[0] = b+'0'; save[i][j] = x; printf("%s ",save[i][j]); } } printf("\n\nvalues after initializing:\n"); for(i=0; i<3; i++) { for(j=0; j<3; j++) { ...

java - Getting jav ax.net.ssl.SSLHandshakeException when doing docusignapi handshade -

getting javax.net.ssl.sslhandshakeexception when doing docusignapi handshade trying use docusignapi login samples cert error. the following code sample docusign. sets signer , docusign configuration object. when doing setdefaultapiclient call error generated. exception in thread "main" com.sun.jersey.api.client.clienthandlerexception: jav ax.net.ssl.sslhandshakeexception: sun.security.validator.validatorexception: pki x path building failed: sun.security.provider.certpath.suncertpathbuilderexcepti on: unable find valid certification path requested target @ com.sun.jersey.client.urlconnection.urlconnectionclienthandler.handle (urlconnectionclienthandler.java:155) @ com.sun.jersey.api.client.client.handle(client.java:652) @ com.sun.jersey.api.client.webresource.handle(webresource.java:682) @ com.sun.jersey.api.client.webresource.access$200(webresource.java:74) @ com.sun.jersey.api.client.webresource$builder.get(webresource.java:509) @ com.doc...

php - How to Migrate and seed before the full test suite in Laravel with in memory database? -

i'm trying set test environment in laravel project. i'm using http://packalyst.com/packages/package/mayconbordin/l5-fixtures json seeding sqlite in memory database , calling: artisan::call('migrate'); artisan::call('db:seed'); in setup function executed before every single test can grow thousands in project. i tried setupbeforeclass didn't work. think there because createapplication method called in every test , reset whole application , wasn't loading fixtures json same reason. this how did in case else struggling same, created base testclase class inherits laravel's , did this: /** * creates application. * * @return \illuminate\foundation\application */ public function createapplication() { return self::initialize(); } private static $configurationapp = null; public static function initialize(){ if(is_null(self::$configurationapp)){ $app = require __dir__.'/../bootstrap/app.php'; $ap...

android - How to allow your app with usage access? -

from android lollipop, app wants access usage of other apps needs enabled security. rather manually enabling manually settings -> security -> apps usage access, want enable programmatically. cannot find clear answer anywhere. can me on one? try in activity: @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); if (!isaccessgranted()) { intent intent = new intent(settings.action_usage_access_settings); startactivity(intent); } } private boolean isaccessgranted() { try { packagemanager packagemanager = getpackagemanager(); applicationinfo applicationinfo = packagemanager.getapplicationinfo(getpackagename(), 0); appopsmanager appopsmanager = (appopsmanager) getsystemservice(context.app_ops_service); int mode = appopsmanager.checkopnothrow(appopsmanager.opstr_get_usage_stats, applicationinfo.uid, applicationinfo.packagename); return (mo...

GSAP SVG Animation - Firefox glitch -

i working on animation using gsap , working on both chrome , ie, firefox has following glitches: when cup fill color fills color disappears opposed staying there. looks if animation reverts original state. while big gear rotates around center other 2 seem rotate around 0,0. the animation can found at: http://codepen.io/anon/pen/wxjqqr <code> any or leads appreciated, thanks!

python - How to align entry and label in the same row within a scrollable frame? -

Image
my code using vertical scrolled frame (from here ). "name:ryan", , entry box not aligned in same row. wanted align entry box , label on same column, , messed around pack() method not able fix it. if __name__ == "__main__": class sampleapp(tk): def __init__(self, *args, **kwargs): root = tk.__init__(self, *args, **kwargs) self.label = label(text="choose info exclude (if any) on \n left." "write number of tags should \n associated information on right.") self.label.pack() self.frame = verticalscrolledframe(root) self.frame.pack(side=left) self.frame2=verticalscrolledframe(root) self.frame2.pack() buttons = [] resource=[] in range(10): buttons.append(checkbutton(self.frame.interior, text=str(i)+". "+ "button" )) butto...

json - GitHub API AJAX POST returning 422 -

i'm trying post issue via github api , keep getting 422 error. i've tried various approaches on past few days no luck - i'm hoping simple mistake can spot quickly? my call below - i'm using personal access token authorization. $.ajax({ type: "post", url: `https://api.github.com/repos/myusername/myreponame/issues?access_token=myaccesstoken`, contenttype: "application/json", datatype: "json", data: json.stringify({ "title": "found bug", "body": "i'm having problem this." }) }).done(function( data ) { console.log( data ); }); thanks in advance. fyi got work code below post github api (creating issue): $.ajax({ url: 'https://api.github.com/repos/username/reponame/issues', type: 'post', datatype: 'json', headers: { authorization: 'token my_personal_toke...

python - Close main Tkinter window binding a key -

i not understand why code not work: import tkinter class application (): def__init__(self): self.master = tkinter.tk() self.master.bind("<enter>", self.quit) self.master.mainloop() def quit (self): self.master.destroy() my_app = application() i keep receiving error: "quit() takes 1 positional argument 2 given". there way close main tkinter window binding key? thanks simply add variable quit method ("i","n",etc.), when bind event method, method must able handle said event parameter. import tkinter class application (): def __ init __ (self): self.master = tkinter.tk() self.master.bind("<enter>", self.quit) self.master.mainloop() def quit (self,n): self.master.destroy() #notice n variable doesnt other "handling" of event, when #it gets 2 arguments can handle 2 parameters without giving exception #the (old) meth...

javascript - How to properly set up datepicker attached to a button -

i working on django project using grappelli , trying create page mimics standard change form. page not based on model, adding in fields myself. however, having trouble using datepicker. whenever click button supposed show calendar, nothing happens. sure not including important. here current code: {% extends "admin/change_form.html" %} {% block javascripts %} {{ block.super }} {% endblock %} {% block content %} <div id="grp-content-container"> <form enctype="multipart/form-data" action method="post"> {% csrf_token %} <div> <fieldset class="module grp-module"> <div class="form-row grp-row grp-cells-1 dob"> <div class="field-box l-2c-fluid l-d-4"> <div class="c-1"> <label class="required" for...

ios - Should CIImage be Equatable? -

so, apple’s documentation says ciimage conforms equatable . take mean following unit test pass. however, doesn’t. i’m interested in why. func test_ciimageequalityshouldwork() { let bundle = nsbundle(forclass: prototypetests.self) guard let path = bundle.pathforresource("testimage", oftype: "png") else { return } guard let image = uiimage(contentsoffile: path) else { return } let thingy1 = ciimage(image: image) let thingy2 = ciimage(image: image) xctassert(thingy1 == thingy2) } the image exists, guard statements both pass, assert fails, aren’t equal. out of interest, i’ve tried creating uiimage twice , comparing too. fails. all nsobject subclasses conform equatable , , == function calls isequal: method on objects. isequal: method of nsobject compares object pointers, i.e. o1 == o2 holds if o1 , o2 refer same object instance. see example interacting objective-c apis : swift provides default implementations...

HTML and Python? -

i have website design can turn html needs python integration. in design static except 1 part has table of values needs updated every 15 minutes. have python code ready this, have no idea how combine python , html. my website function one: http://170.94.200.136/weather/inversion.aspx , including same table. check out: https://pypi.python.org/pypi/html i found useful. or can start using flask task. flask

ruby on rails - Setting root route in Sinatra -

i want able set root route particular index action. below have: get '/' redirect '/pokemons' end '/pokemons' @pokemons = pokemon.all erb :"pokemons/index" end it feels hacky though. wondering if there rails equivalency of `root to: 'some_controller#some_action' in sinatra. using sinatra::multiroute (from sinatra-contrib gem), specify both routes on 1 get: get '/', '/pokemons' see: http://www.sinatrarb.com/contrib/multi_route.html

cgo - converting go string to c string -

in program, have function takes in string argument, , returns string in len(resultstring) potentially 4 * len(argumentstring) . because using cgo c-file have imported project, , c function requires char * 4 times original length of string. is there 'efficient' way of initializing , converting go string c string? because right initializing byte array in go, , string ing that, , calling c.cstring on string. causing performance issues if length of string large enough. thanks!

android - How to Get Last Known Location in Fragment Class? -

i want create location-aware app , followed various tutorials on youtube. stumbled upon getting last known location tutorial google seems it's activity class. can't find tutorials uses fragment class. i want show marker on current location when fragment view created. here's code: import android.content.pm.packagemanager; import android.os.bundle; import android.support.annotation.nullable; import android.support.v4.app.fragment; import android.support.v4.content.contextcompat; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.toast; import com.google.android.gms.maps.googlemap; import com.google.android.gms.maps.mapview; import com.google.android.gms.maps.onmapreadycallback; import com.google.android.gms.maps.model.latlng; import com.google.android.gms.maps.model.markeroptions; import com.tugboat.tugboat.r; public class mapfragment extends fragment implements onmapreadycallback { private mapview m...

Binding ActiveX events within single file Javascript -

i'm trying simplify ie activex project single javascript file , i'm having trouble activex events hardware pieces the project has them defined move entire script tag js file , allow people add eventlistener event if need notified of it. the js file being added such <script id=clienteventhandlersjs language="javascript" src="./single.js"></script> the original synthax (html tag) is <script for="component" event="targetevent(args)" language="javascript">component_targetevent(args)</script> the modified synthax (single js file) is component.targetevent = function(args){} trying bind the event has not worked. have tried following approach still "uncaught referenceerror: component not defined" if leave original format in html, works, moving single js file causes referenceerror.

css - How to bottom align a button in bootstrap 4? -

my question more complex title, couldn't come better one. initial setup: i use bootstrap v4.0.0-alpha.2 , ripped out this simple sidebar . i'm not sure why , if it's relevant set flex: true in _library-variable-overrides.scss (i use css-burrito ) since set try out, i'm okay turning off. ;-) what want do: i have button in sidebar bottom aligned. ideally it's centered horizontally in sidebar , has 1em margin bottom. what code looks like: _shell.scss & _sidenav.scss : #shell-wrapper { padding-left: 0; transition: 0.5s ease; } #shell-wrapper.toggled { padding-left: 250px; #shell-content-wrapper { position: absolute; margin-right: -250px; } } @media(min-width:768px) { #shell-wrapper { padding-left: 250px; } #shell-wrapper.toggled { padding-left: 0; #shell-content-wrapper { position: relative; margin-right: 0; } } #shell-content-...

Emscripten Using libC Socket, Assertion failed: undefined -

i have problem example called "test_sockets_partial_client.c". expect read data server working, browser connect server, send data server, when server response console returns: assertion failed: undefined. non-emscripten version of client written in pure javascript websocket class, works great. someone have idea ? btw. server in c#, send client, byte[] send = new byte[5 + 2]; send[0] = 0x81; // last frame, text send[1] = 5; // not masked, length 5 send[2] = (byte)'x'; send[3] = (byte)'y'; send[4] = (byte)'z'; send[5] = (byte)'a'; send[6] = (byte)'b'; client.send(send); problem data type, raw sockets created through emscripten must binary. 0x81 text data, 0x82 binary data. send[0] = 0x82 ; // last frame, binary

css - Center button in Bootstrap navbar (outside collapse) -

i have button in navbar is: inline rest of navbar items (i.e. doesn't pushed next line); located outside of collapsed navbar section; and always positioned in center of page screen resolutions (including when right-side of navbar collapsed). i having particular problems with: centering button; and some of navbar items not working smaller screen resolutions (when navbar collapsed). below code. alternative css tried: .navbar-button { position: absolute; left: 0; width: 100%; text-align: center; white-space: nowrap; } but caused of other navbar links not work. subsequently tried make use of z-index , didn't seem work. body { padding-top: 50px; padding-bottom: 20px; } .section { margin-bottom: 30cm; } .navbar-button { display: inline-block; text-align: center; } <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-co...

XML deserialize iso 20022 pain.001.001.03 from xsd using c# -

Image
i want object xml file. in example using iso 2002 pain.001.001.03 i have downloaded schema from pain.001.001.03.xsd and xml file from pain.001.001.03.xml i have validated xml against xsd using tool validate xml i have generated class using xsd and using code below in order deserialize xmlserializer ser = new xmlserializer(typeof(customercredittransferinitiationv03), new xmlrootattribute { elementname = "document", namespace = "urn:iso:std:iso:20022:tech:xsd:pain.001.001.03", }); filestream myfilestream = new filestream("c:\\001.001.03\\pain.001.001.03.xml", filemode.open); customercredittransferinitiationv03 myobject = (customercredittransferinitiationv03) ser.deserialize(myfilestream); the code return null values xml has values <?xml version="1.0" encoding=...

c# - Why textBox in WinForms cant display double? -

using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.threading.tasks; using system.windows.forms; namespace p2_7_24_2016_ed_app { public partial class form1 : form { int win; int loss; int wincounter; int losscounter; public form1() { initializecomponent(); } private void buttonwin_click(object sender, eventargs e) { this.textboxwin.text = ""; ++win; ++wincounter; this.textboxwin.text = win.tostring(); } private void buttonloss_click(object sender, eventargs e) { this.textboxloss.text = ""; ++loss; ++losscounter; this.textboxloss.text = loss.tostring(); } private void buttonrate_click(object sender, eventargs e) ...

asp.net - C# Can't find reference system.web.ui -

Image
i'm using framework 2.0 , trying build project,but i'm getting lot of errors in aspx.designer.cs pages,example. protected global::system.web.ui.updatepanel updmenu; the error says name updatepanel doesn't exist in web.ui namespace,i think because framework doesn't support this?or it't other thing causing this? in references have system.web,i exlucluded , included multiple times , errors continues. you must use .net framework 3.5 or upper. https://msdn.microsoft.com/en-us/library/system.web.ui.updatepanel(v=vs.110).aspx

python - Neo4j Bolt StatementResult to Pandas DataFrame -

based on example neo4j from neo4j.v1 import graphdatabase, basic_auth driver = graphdatabase.driver("bolt://localhost", auth=basic_auth("neo4j", "neo4j")) session = driver.session() session.run("create (a:person {name:'arthur', title:'king'})") result = session.run("match (a:person) a.name = 'arthur' return a.name name, a.title title") record in result: print("%s %s" % (record["title"], record["name"])) session.close() here result of datatype neo4j.v1.session.statementresult . how access data in pandas dataframe without explicitly iterating ? pd.dataframe.from_records(result) doesn't seem help. this have using list comprehension resultlist = [[record['title'], record['name']] record in result] pd.dataframe.from_records(resultlist, columns=['title', 'name']) the best can come list comprehension similar...