Posts

Showing posts from August, 2010

jquery - display 3 different bootstrap info icon on change function menu -

i have odd bug trying display tooltip depending on selected in change function (also tooltip info different each). menu has 3 possible choices. seems show/hiding tooltip not work correctly resorted using css opacity property. works 1 , not other. 1 knows why complicated on on change function? , how make work correctly. trying show matching tooltip each option of menu. $('#menu1').change(function() { if ($(this).val() == 'newhire') { // or this.value == '1' $("#iconnh").css({ opacity: 1.5 }); $("#iconup").css({

php - Delete Buddypress Cover Image Button -

i trying have button on users profile > cover image page says "remove cover image". theme using template override of cover image seen here: http://pastebin.com/xqppivys i know buddypress has option once user has uploaded cover image, option delete available after upload how can add button in allows them delete cover photo @ anytime instead of directly after upload? i know dont want edit core found action responsible this. there way can create button call action , remove users cover photo? in buddypress/bp-core/bp-core-attachments.php: /** * ajax delete cover image given object , item id. * * @since 2.4.0 * * @return string|null json object containing success data if cover image deleted * error message otherwise. */ function bp_attachments_cover_image_ajax_delete() { // bail if not post action. if ( 'post' !== strtoupper( $_server['request_method'] ) ) { wp_send_json_error(); } $cover_image_d

php - Connect Symfony to a Sybase Database -

just before started, have been trying figure out , have clicked every google link there , have read other questions on nothing worked me. is there way connect existant sybase ase database i've tried sqlanywhere , sqlsrv , pdo_dblib exceptions example attempted call function "sasql_connect" namespace "doctrine\dbal\driver\sqlanywhere". when use sqlanywhere i'm using symfony 2.8 php 5.5 on windows , tried php 5.6 on ubuntu , it's same thanks help your question low on specifics. apparently you're connecting sybase sqlanywhere? (and not sybase ase or sybase iq). also, other relevant details missing. anyway, sql anywhere, best use sa jdbc 4.0 driver (sajdbc4.jar), rather jconnect. more info, see http://dcx.sap.com/index.html#sa160/en/dbprogramming/choosing-jdbc-jdbc.html .

weblogic - Setting AuthenticatedSubject for all ressources -

i have web app running on weblogic 10.3. is possible make sure, authenticatedsubject in place resources? ideally setting default authentication apps, dont have modify every application's security settings. can enforce, user has authenticate himself once , keep him principal each request? i tried set authentication-provider in applications realm, not triggered. think have weblogic, resources have protected in realm. how that? everything explained in document : https://docs.oracle.com/cd/e13222_01/wls/docs103/pdf/security.pdf you have configure web-app secutiry contraint protect application , force users authenticated

JavaScript: Reference a functions local scope as an object -

when call function, local scope erected call. there way directly reference scope object? window reference global scope object. example: function test(foo){ var bar=1 //now, can access object containing foo, bar, arguments , //else within local scope this: magicidentifier.bar } alternately, have complete list of in local scope on top of custom variables? background: i'm trying down way of shifting global scope within function call, statement joke, call works little better, still breaks declared in function scope not in global scope, therefore declare these few cases in global scope, requires me know are. ie function execscript makes complete shift, solves problem ie. note: loading javascript dynamically, settimeout(code,1) simple effective hack achieve global scope, not execute immediately. no, there's no way reference variable object of execution context of function binding object of variable environment of execution context (that'

c# - User login not being authenticated using OWIN bearer tokens -

i'm working mvc app. login handle web api . the issue i'm facing when click on login button in mvc app api generating token along user info. can't display user information in view. the following code in accountcontroller of mvc app [httppost] [allowanonymous] [validateantiforgerytoken] public async task<actionresult> login(loginviewmodel model) { string token = token.gettoken(token.grant_type, model.email, model.password, token.client_id, token.client_secret); //token has appropriate data if debug if (!string.isnullorempty(token)) return redirecttoaction("index", "home"); return view(model); } then in view have @if (request.isauthenticated) { <p>@user.identity.getusername()</p> //this line blank } the api looks this public override async task grantresourceownercredentials(oauthgrantresourceownercredentialscontext context) { var allowedorigin = context.owincontext.get<string>(

List element removal occurring anyway after unsuccessful check in Python 2.7 -

i'm trying system of linear congruences solver moduli not coprime, requires me break each modulus down prime factorizations , compare them against each other create new system solvable. need break number down prime powers (ie 36 becomes 4*9 opposed 2*2*3*3) , compare against other modulus , remove overlapping prime powers (ie if 1 number has factor of 4 , other has factor of 2, remove factor of 2). for reason, when run code, many factors getting removed regardless of whether smaller powers of prime power in other modulus. example (i've included below), when take moduli pair 1000142 , 1002045, number 1002045, has factorization of 3 * 5 * 11 * 6073 returns [6073] after checks run against it, though 2 moduli have no prime powers in common. does know why might happening? i'm pretty sure is_prime , factorize methods correct - i've tested them extensively on ranges of numbers without issue. why items getting removed list when condition check fails? please ignore tot

javascript - Is WebAPI Body.json asynchronous? -

body.json returns promise . is method asynchronous avoid blocking on reading large inbound data streams? does settimeout(samplestream, 0) repeatedly until end of stream found? is .json() asynchronous? yes. that's why returns promise. is method asynchronous avoid blocking on reading large inbound data streams? yes. receive response right after headers arrived, , receiving body might take time. does settimeout(samplestream, 0) repeatedly until end of stream found? not exactly. doesn't use settimeout , reads stream repeatably getting promises next chunk - check reading bytes readablestream yourself. , importantly, happens on background task without concerns javascript. note on section tells: because reader grants exclusive access, actual mechanism of how read cannot observed. implementations use more direct mechanism if convenient.

linux - Cut partial element from specific column in print output -

for while i've been using simple command extract data netstat show how many connections server coming specific ip. i'm trying migrate command, while adding bit more detail, using ss i'm getting bit stuck on how remove element specific column. what have far following: ss -t 2>/dev/null | awk -v ofs='\t\t' '{print $4, $5}' | sort | uniq -c | sort -nr and output similar to: 1 local address:port 1 172.31.6.21:imaps 124.170.xxx.xxx:47498 1 172.31.6.21:imaps 124.170.xxx.xxx:47122 the problem have here cannot work out how consolidated values each source ip ignores ":port" factor. i've tried few things using cut command, affects first column, output not precise desired. the type of output want able see be: 1 local address:port 22 172.31.6.21:imaps 124.170.xxx.xxx 31 172.31.6.17:http 134.162.xxx.xxx the local

javascript - Is "bower install" a good idea for release builds? -

i have experienced problems jenkins server since yesterday: bower install fails download dependencies github repositories. far know may depends on connection issues server (jenkins). how can avoid kind of risks? should commit dependencies along project , write specific task (gulpjs/gruntjs) works in locale?

zsh - Can 'docker-compose down' be somehow prevented from running in production? -

i don't want possible run docker-compose down in production. ever. there way overwrite command either in zsh or otherwise throw error if run on production server? we tried alias command else no avail. i hope you're not doing security purposes? can control user can , cannot manage docker services (and therefore docker-compose) adding/removing them docker group. if want prevent accidentally running docker down , can write wrapper script: #!/bin/bash arg in "$@";do if [[ "$arg" = "down" ]];then >&2 echo "error: 'docker-compose down' has been disabled!" exit 1 fi done /usr/local/bin/docker-compose "$@" # adapt actual path docker-compose binary if different put docker-compose in location in $path , e.g. $home/bin/docker-compose and make executable. exit warning stderr if command line contains down . however, not prevent malicious intents , necessary permissions call re

javascript - Sum with jquery not working -

i have lot of labels shown on page. want sum values , store them in final_cpa . html : <label class="tmpcpa">32.1</label> js : function calculate_final_cpa() { var final_cpa = 0; var allfilled = false; $('.tmpcpa').each(function () { if ($(this).val() != 0) { final_cpa += parseint($(this).text()) || 0; allfilled = true; } else { allfilled = false; } }); console.log(final_cpa); console.log(allfilled); } var run = setinterval(calculate_final_cpa, 500); however final_cpa 0 , allfilled remains false . that because label don't have value attribute .val() function return empty string, have use .text() instead text content inside label element : if ($(this).val() != 0) { should : if ($(this).text() != 0) { note : rayon mentioned in comment below text() return string better c

python - Pandas changing cell values based on another cell -

i formatting data 2 different data sets. 1 of dataset reflects observation count of people in room on hour basis, second 1 count of people based on wifi logs generated in 5 minutes interval. after merging these 2 dataframes one, run issue each hour (as "10:00:00") has data original set, other data (every 5min "10:47:14") not include data. here how merge dataframe looks: room time con auth capacity % count module size 0 b002 mon nov 02 10:32:06 23 23 90 nan nan nan nan` 1 b002 mon nov 02 10:37:10 25 25 90 nan nan nan nan` 12527 b002 mon nov 02 10:00:00 nan nan 90 50% 45.0 comp30520 60` 12528 b002 mon nov 02 11:00:00 nan nan 90 0% 0.0 comp30520 60` is there way me go through dataframe , find information regarding "occupancy", "occupancycount", "modul

php - Create an array of key difference using two array -

how can find key deference array using 2 arrays first array : $array_1 = array('300','200','500'); second array : $array_2 = array('500','300','200'); $array_2 generating applying rsort $array_1 then want generate array of key comparing value of $array_1 , key of $array_2 .output array of $key_array = ('1','2','0'); use array_flip() on $array_2 convert keys values , vice versa. can find original keys. $flip_2 = array_flip($array_2); $key_array = array_map(function($el) use ($flip_2) { return $flip_2[$el]; }, $array_1); demo

json - Python query SQLite map values to column names -

i creating python script query sqlite db file. have connected sqlite db file , ran select query retrieve data. the issue output missing column names. import sqlite3 lite import sys import json con = lite.connect('example.db') con: con.row_factory = lite.row cur = con.cursor() cur.execute("select * devices") rows = cur.fetchall() rowarray_list = [] row in rows: t = (row['id'], row['name'], row['type']) rowarray_list.append(t) j = json.dumps(rowarray_list) rowarrays_file = 'rowarrays.js' f = open(rowarrays_file,'w') print (f, j) here output of script. <_io.textiowrapper name='rowarrays.js' mode='w' encoding='utf-8'> [[1, "example1", "computer"], [2, "example2", "server"], [3, "example3", "server"] below output r

python - pymongo why we can use a dot to get a collection instance? -

from pymongo import mongoclient dbc = mongoclient("localhost").test.test just snippet above, can use . instead of get_database("test") , get_collection("test") database instance or collection instance. despite convenience, wonder makes syntactic sugar happen? there __getattr__() magic method making dot notation/attribute lookup happen. let's source code. mongoclient class defines __getaattr__ method , instantiates database class name: def __getattr__(self, name): """get database name. raises :class:`~pymongo.errors.invalidname` if invalid database name used. :parameters: - `name`: name of database """ if name.startswith('_'): raise attributeerror( "mongoclient has no attribute %r. access %s" " database, use client[%r]." % (name, name, name)) return self.__getitem__(name) def __getitem__(self, name):

angularjs - Javascript String array with ng-repeat -

i have js array of strings: for(var =0; i<db.length; i++) console.log(db[i]); and output: dbname:rf,dbstatus:true dbname:rt,dbstatus:false and want loop on ng-repeat: $scope.dbarray = db; in html: <ul> <li ng-repeat = "line in dbarray"> {{line.dbname}} - line.dbstatus </li> </ul> the loop not work now. ideas? you missing curly braces on second line.dbstatus output of js array doesn't json or array me. dbname:rf,dbstatus:true dbname:rt,dbstatus:false should more [{ dbname:rf,dbstatus:true }, { dbname:rt,dbstatus:false }] that on problem, ng-repeat not work. have @ plunker

jquery - Pop-up on form validation failed -

i using below code validate certaim field. var x = document.forms["myform"]["obs"].value; if (x == null || x == "") { alert("all fields mandatory.."); return false; } i try replace alrt action modal 2 buttons : return field , leave empty try zebra dialog. useful plugin. http://stefangabos.ro/jquery/zebra-dialog/ var x = document.forms["myform"]["obs"].value; if (x == null || x == "") { $.zebra_dialog('all fields mandatory..', { 'type': 'question', 'title': 'custom buttons', 'buttons': ['return field', 'leave empty'], }); return false; }

apache - Reading file from different directory with htaccess -

i want this: if request comes domain.com/photos/1.jpg should read file new_photos/1.jpg directory. url should still same. tried line this: rewriterule ^photos/(.*)$ new_photos/?$1 it doesn't work. how can fix it? edit: my full htaccess file: rewriteengine on rewritecond %{http_host} ^www\.(.+)$ [nc] rewriterule ^(.*)$ http://%1/$1 [r=301,l] rewritecond %{request_uri} ^/system.* rewriterule ^(.*)$ index.php/?$1 [qsa,l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.+)$ index.php/?$1 [qsa,l] rewritecond %{http_host} ^app.domain.com$ rewriterule ^robots\.txt$ robots-subdomain.txt if file in /new_photos dir ,you can use : rewriterule ^photos/(.*)$ new_photos/$1 [nc,l]

Substitute dataset coordinates in xarray (Python) -

i have dataset stored in netcdf4 format consists of intensity values 3 dimensions: loop , delay , wavelength . named coordinates same dimensions (i don't know if it's or bad...) i'm using xarray (formerly xray) in python load dataset: import xarray xr ds = xr.open_dataset('test_data.netcdf4') now want manipulate data while keeping track of original data. instance, would: apply offset delay coordinates , keep original delay dataarray untouched. seems done with: ds_ = ds.assign_coords(delay_corr=ds_.delay.copy(deep=true) + 25) substitute coordinates delay delay_corr relevant dataarrays in dataset. however, have no clue how , didn't find in documentation. would know how perform item #2? to download netcdf4 file test data: http://1drv.ms/1qhqtry the method you're looking xr.swap_dims() method: ds.coords['delay_corr'] = ds.delay + 25 # use assign_coords ds2 = ds.swap_dims({'delay': 'delay_corr'})

sql server - get table without Added column in sql query -

Image
i have process table in sql server database this: i need select process if rolename exists in roletable this: select id,workflowxml ( select m.c.value('@rolename','nvarchar(max)') rolename,p.* process p outer apply p.workflowxml.nodes('/workflow/tasks/task[@type="start"]/taskusers/taskuser') m(c) ) pro pro.rolename in (select * roletable) in select rolename adds process . need process table. can add process fields ( id,workflowxml ) query. if change process table design should edit query. not good. is there way select process table in query without adding process fields this? select pro ( select m.c.value('@rolename','nvarchar(max)') rolename,p.* process p outer apply p.workflowxml.nodes('/workflow/tasks/task[@type="start"]/taskusers/taskuser') m(c) ) pro pro.rolename in (select * roletable) thanks.

android - How to send event from Activity to service with greenrobot event bus? -

simple eventbus.getdefault().post() bring exception not main thread. how send event activity service greenrobot event bus? chronometer = (chronometer)findviewbyid(r.id.chrono); chronometer.setbase(systemclock.elapsedrealtime()); chronometer.setonchronometerticklistener(new chronometer.onchronometerticklistener() { @override public void onchronometertick(chronometer arg0) { long countup = (systemclock.elapsedrealtime() - arg0.getbase()) / 1000; string astext = (countup / 60) + ":" + (countup % 60); log.e("astext", "astext" + astext); chronometerevents event=new chronometerevents(); event.settime(astext); bus.post(event); } }); public class chronometerevents { private string time; public chronometerevents() { } public string gettime() { return time; } publi

objective c - delete and Update Data in Core Data in iOS -

hi newbie in core data in ios, have implemented 4 textfields namely name,age,company,address. when user enter data saving data in core data. nsmanagedobjectcontext *context = [appdelegate managedobjectcontext]; nsmanagedobject *newcontact; newcontact = [nsentitydescription insertnewobjectforentityforname:@"device" inmanagedobjectcontext:context]; [newcontact setvalue: _name.text forkey:@"name"]; [newcontact setvalue: _address.text forkey:@"address"]; [newcontact setvalue: _age.text forkey:@"age"]; [newcontact setvalue:_company.text forkey:@"company similarly able fetch , display data in these textfields. appdelegate *appdelegate = [[uiapplication sharedapplication] delegate]; nsmanagedobjectcontext *context = [appdelegate managedobjectcontext]; nsentitydescription *entitydesc = [nsentitydescription entityforname:@"device" inmanagedobjectcontext:context]; nsfetchrequest *req

logic - How to add up numbers in a nested array javascript -

just working on project , tried few different solutions no results. me how add numbers in nested array? use reduce? or loop? function balance(arr) { if(typeof item == 'number') { return arr;enter code here } else { return arr + balance(item); } } is maybe hoping for? function balance(arr) { return arr.reduce(function(sum, item) { if(typeof item == 'number') { return sum; } else { return sum + balance(item); } },0); } console.log(balance([1,2,[3,4],5]));

caching - Why skiplist memory locality is poor but balanced tree is good? -

a guy once challenged antirez(author of redis) why redis use skip list implementation sorted sets in ycombinator : i looking @ redis yesterday , noticed this. there particular reason chose skip list instead of btrees except simplicity? skip lists consume more memory in pointers , slower btrees because of poor memory locality traversing them means lots of cache misses. suggested way improve throughput when guarantee each command's durability (at end of wiki page): http://code.google.com/p/redis/wiki/appendonlyfilehowto also, have thought accommodating read-only traffic in additional thread way utilize @ least 2 cores efficiently while sharing same memory? then antirez answered: there few reasons: 1) not memory intensive. it's basically. changing parameters probability of node have given number of levels make less memory intensive btrees. 2) sorted set target of many zrange or zrevrange operations, is, traversing skip list linked l

asp.net mvc 4 - Redirecting to an Action Method from another Action Method in the same controller -

i newbie in asp.net , doing web page application in mvc4 login functionality. index action method looks this- public actionresult index() { var pagemodellist1 = new dataaccesslayer.dataaccess().getpageinfo(); viewdata["menulist"] = pagemodellist1.pagemodellist; return view(); } and login action method looks like- [httppost] public actionresult login(loginmodel model, string returnurl) { if (modelstate.isvalid) { var pagemodellist1 = new dataaccesslayer.dataaccess().getpageinfo(model.username,model.password); viewdata["menulist"] = pagemodellist1.pagemodellist; return redirecttoaction("index", "mycontroller"); } modelstate.addmodelerror("", "login failed"); return partialview("_login", model); } what need is, when login successfully, redirecttoaction("index", "deimos&

python - where can I get all names of connections in the graph API -

import facebook token = 'your token' graph = facebook.graphapi(token) profile = graph.get_object("me") friends = graph.get_connections("me", "friends") the second parameter in method get_connections() name if connection, found documentation of graph api ( http://facebook-sdk.readthedocs.org/en/latest/api.html ) not information how list names of connections exist in graph. thank you! always use official api reference, existing connections in there: https://developers.facebook.com/docs/graph-api/reference for example: https://developers.facebook.com/docs/graph-api/reference/user/ (scroll down "edges")

php - SOAP Magento create product -

i push information database magento website. @ end of the soap documentation on catalog_product.create , there example of how connect soap , how create product. here problem, first line not working: $client = new \soapclient($host."/api/v2_soap/?wsdl"); this failing , return error: soap-error: parsing wsdl: couldn't load 'xxxxxxxx/api/v2_soap/?wsdl' : failed load external entity "xxxxxxxxxxx/api/v2_soap/?wsdl" i tried other url work, not find on these methods , don't know how use them. example, soap/default?wsdl&services=bundleproductlinkmanagementv1 depending on server configuration, might need use index.php: $client = new \soapclient($host."index.php/api/v2_soap/?wsdl"); i've double checked on of own magento installs , wsdl appear.

Random sample from a very long iterable, in python -

i have long python generator want "thin out" randomly selecting subset of values. unfortunately, random.sample() not work arbitrary iterables. apparently, needs supports len() operation (and perhaps non-sequential access sequence, that's not clear). , don't want build enormous list can thin out. as matter of fact, possible sample sequence uniformly in 1 pass, without knowing length-- there's nice algorithm in programming perl (edit: "reservoir sampling", @user2357112!). know of standard python module provides functionality? demo of problem (python 3) >>> import itertools, random >>> random.sample(iter("abcd"), 2) ... typeerror: population must sequence or set. dicts, use list(d). on python 2, error more transparent: traceback (most recent call last): file "<pyshell#12>", line 1, in <module> random.sample(iter("abcd"), 2) file "/usr/local/cellar/python/2.7.9/framew

How to access the fields from the form data in symfony 3 -

i want use how access username , password fields below code. appbundle\entity\masteruseraccount object ( [id:appbundle\entity\masteruseraccount:private] => [firstname:appbundle\entity\masteruseraccount:private] => [lastname:appbundle\entity\masteruseraccount:private] => [username:appbundle\entity\masteruseraccount:private] => test [password:appbundle\entity\masteruseraccount:private] => 123456 [createdby:appbundle\entity\masteruseraccount:private] => [updatedby:appbundle\entity\masteruseraccount:private] => [createdat:appbundle\entity\masteruseraccount:private] => [updatedat:appbundle\entity\masteruseraccount:private] => [status:appbundle\entity\masteruseraccount:private] => ) $data = $form->getdata(); $username = $data['username']; i'm getting below error following error cannot use object of type appbundle\entity\classname array the data out of symfony form entity . c

Go Heroku Tutorial: No such file or directory: runtime.h -

i'm working on golang heroku tutorial right now, , i'm @ step: https://devcenter.heroku.com/articles/getting-started-with-go#prepare-the-app when execute following: go github.com/heroku/go-getting-started/cmd/... i error: # runtime/cgo /tmp/go-build867338420/runtime/cgo/_obj/_cgo_defun.c:4 6c: no such file or directory: runtime.h here go environment: goarch="amd64" gobin="" gochar="6" goexe="" gohostarch="amd64" gohostos="linux" goos="linux" gopath="/home/crystal/go/" gorace="" goroot="/usr/lib/go" gotooldir="/usr/lib/go/pkg/tool/linux_amd64" term="dumb" cc="gcc" gogccflags="-g -o2 -fpic -m64 -pthread" cxx="g++" cgo_enabled="1" what potentially issue here?

mysql - Why does this join return [ ] No Properties -

i stumped this. i trying join records 2 tables. easy enough. here query; return player::join('played_games', 'played_games.playerid', '=', 'players.id') ->where('players.teamid', '=', $team->id)->get(); if remove clause array of objects expect try add where, array no properties. also, if drop join, clause me records looking for. don't seem work together. what missing? thanks. edit the join method performing inner join on played_games , players tables , method returns collection of matching records. this laravel 5.2 app (should have mentioned that!)

Why do std::cout and printf() not print between usleep() delays? -

i have program supposed print "hello, world!" in scrolling text. using unistd.h library usleep() function, , i'm using std::cout print characters standard output: #include <iostream> #include <stdio.h> #include <unistd.h> char hello[13]={'h','e','l','l','o',',',' ','w','o','r','l','d'}; int main (){ for(int i=0; i<14; i++){ std::cout<<hello[i]; //it prints entire string after usleep(100000); //100000 ms, should print char after } //every 100 ms. } you might need flush output stream.

javascript - Cannot upload file using bootstrapValidator Ajax -

i have problem upload file. using bootstrapvalidator ajaxsubmit form validation. insert data in database work well, not file uploaded. using code : html: <form action="target.php" method="post" enctype="multipart/form-data" name="myform" id="myform"> <div class="form-group"> <label class="control-label col-sm-3">username</label> <div class="col-sm-8"> <input type="text" class="form-control" id="username" name="username" > </div> </div> <div class="form-group"> <label class="control-label col-sm-3">description</label> <div class="col-sm-8"> <input type="text" class="form-control" id="descrip

performance - RESTful API in PHP - optimising successive requests? -

i'm working (for first time) on developing php application driven php restful api (probably using peej/tonic). coming application direct access might make 20 different database calls during course of page load, trying reconcile fact 20 api calls = 20x handshakes (which can improved guzzle persistent connections) 20x connections database. i believe better programming , planning, can required api calls down 4-5 per page. @ point: a) not worth considering latency of 5x database connections + 5x handshakes per page load on account of other available optimisations? b) there existing method can mitigated i've far failed find? c) believe violates principles of restful programming if had single api method gathered information other api endpoints (for instance, suppliers x=y products supplier), there documented method internal api interaction (particularly within peej/tonic or other frameworks). thank wisdom in advance. remember client should "making 'a

java - ZonedDateTime to UTC with offset applied? -

i using java 8 zoneddatetime looks 2013-07-10t02:52:49+12:00 i value z1.format(datetimeformatter.iso_offset_date_time) where z1 zoneddatetime . i wanted convert value 2013-07-10t14:52:49 how can that? is want? converts zoneddatetime localdatetime given zoneid converting zoneddatetime instant before. localdatetime localdatetime = localdatetime.ofinstant(z1.toinstant(), zoneid.of("utc")); or maybe want users system-timezone instead of hardcoded utc: localdatetime localdatetime = localdatetime.ofinstant(z1.toinstant(), zoneid.systemdefault());

histogram program gives strange output C++ -

Image
i have been writing code produce horizontal histogram. program takes user input of range of numbers vector. asks user lowest value want histogram begin at, , how big want each bin be. example: if lowestvalue = 1 , binsize = 20 , vector filled values {1, 2, 3, 20, 30, 40, 50} print like: (bin) (bars) (num)(percent) [ 1-21) #### 4 57% [21-41) ## 2 28% [41-61) ## 2 28% here of code so: void printhistogram(int lowestvalue, int binsize, vector<double> v) { int binfloor = lowestvalue, binceiling = 0; int numbins = amountofbins(binsize, (int)range(v)); (int = 0; i<=numbins; i++) { binceiling = binfloor+binsize; int amoinbin = amountinbin(v,binfloor, binsize); double perinbin = percentinbin(v, amoinbin); if (binfloor < 10) { cout << "[ " << binfloor << '-' << binceiling << ") " << setw(20) << left &l

etl - SSIS Design pattern for Multiple XLSB File sheets to multiple tables -

there xlsxb files , each of these consists of varying number of sheets (consists of upto 9 sheets) .all sheets of different structure.the requirement laoad specific named sheet data corresponding table.the specific named sheet may or may not appear in xlsb files. example: 1st xlsb file consists of 9 sheets( sh1,sh2,...,sh9) 2nd xlsb file consists of 6 sheets(sh1,sh5,sh6,sh7,sh9,sh2) 3rd xlsb file consists of 3 sheets(sh5,sh7,sh9) idea sh9 colleted in on table called table_sh9.all sh5 has in table_sh5 ssis design pattern can followed this. to have dynamic recommend script task. can openxml , closedxml read data. https://closedxml.codeplex.com/ i read header determine table loading to, create datareader input , feed datareader sqlbulkcopy. i have similar solution automatically create tables me , use datastreams library -> https://www.csvreader.com/

cordova - TFBuild access local file system -

Image
i'm trying setup continuous integration build service tfs/tfbuild. i trying build cordova app ios , android, therefore need sign apk/ipa. i need p12 certificate file ios , keystorefile android. i not want check in therese files in vcs, there ways store them local in system of build agent , give cordova local paths? if trying set path using relative path cloned repository, if using predeifned variables $(agent_homedirectory). any way of accessing local filesystem agent runs? cordova task uses relative path keystore/p12 file found: but can place keystore/p12 file in build agent , add "copy files" task before cordova build task copy certificate file cloned repository folder before cordova build task start , can set relative path in cordova build task. following task copys "test.log" file "e:\a1" folder "hello" folder in repository folder:

python - scrapy: Download html for external links -

need crawl internal external urls on site. once first external url crawled not want crawl external site. url might youtube.com result in crawling youtube.com completely. below code written want. not able add item (external url) in resultant set. import urlparse import scrapy scrapy.contrib.spiders import crawlspider, rule scrapy.contrib.linkextractors.sgml import sgmllinkextractor class propertiesitem(scrapy.item): url = scrapy.field() #html = scrapy.field() class examplespider(crawlspider): name = "examplespider" allowed_domains = ["9value.customer360.co"] start_urls = ["http://9value.customer360.co/"] rules = ( rule(sgmllinkextractor(allow=(), restrict_xpaths=('//a',)), callback="parse_items", process_links="filter_links", follow= true), ) def filter_links(self, links): link in links: if self.allowed_domains[0] not in link.url: item = prope

java - Geopoint function distance not working in FieldExpression -

i using google app engine , storing geopoints in searchable document index. when search locations using distance function example " distance (mygeopoint, geopoint(35.2, 40.5)) > 100" search returns expected documents. in returned results, want find out distance of each of mygeopoint passed in geopoint, added "distance" fieldexpression in queryoptions looks field expression doesn't evaluated , search returns field html empty value. ensure building fieldexpression correctly, tried replacing expression other expression, example (count(someotherfield)) , works , returns correct data. looks wrong usage of distance function. know wrong usage of distance function in fieldexpression? supposed work, correct? or distance functions not supported fieldexpressions? alternatively, there other way distance between point of interest locations matching search query? my sample code: // use search api indexspec indexspec = indexspec.newbuilder().setname(

angularjs - Web Api & Angular js -

i facing problem while calling service using $http. opening .aspx page using iframe , on page load want call service written in controller $http taking full path of page , path of web api service shown below. http://localhost:50802/tst00111cfg/app/dispatchnotify/api/dispatchnotifyservice/getworkorders and want in below manner http://localhost:50802/tst00111cfg/api/dispatchnotifyservice/getworkorders my controller code dbsrvc.getdatfromservice('api/dispatchnotifyservice/getworkorders', $scope.workorder).then(function (result) { debugger; }); please me out in this. dnapp.service('dbsrvc', ["$http", "$q", function ($http, $q) { var getdataservice = function (url, val) { debugger; var deferobj = $q.defer(); $http({ url: url, method: 'get', data: val }).then(function (data) { deferobj.resolve(data); }); return deferobj.promise; }; var postdataservice = function (url,

Python Matplotlib Box plot -

Image
this dataframe: {'parameter': {0: 'a', 1: 'a', 2: 'a', 3: 'a', 4: 'a', 5: 'a', 6: 'a', 7: 'a'}, 'site': {0: 's1', 1: 's2', 2: 's1', 3: 's2', 4: 's1', 5: 's2', 6: 's1', 7: 's2'}, 'value': {0: 2.3399999999999999, 1: 2.6699999999999999, 2: 2.5600000000000001, 3: 2.8900000000000001, 4: 3.4500000000000002, 5: 4.4500000000000002, 6: 3.6699999999999999, 7: 4.5599999999999996}} i trying plot boxplot of parameter site. easiest way it? additional question if have more 1 parameter, easiest way plot boxplot using matplotlib parameter? thank you you're going want use dataframe.boxplot method , group "parameter" , "site" columns. import matplotlib.pyplot plt pandas import dataframe df = dataframe({'parameter': ['a',]*8, 'site': ['s1

android - how to access multiple images from server i have used glide library but i take much time 2 load images in gridview -

how access images server , url in android implement instagram application confusion how show thumbnails in grid view.after clicking on thumbnail show full images using view pager swap images. i had implement problem images loading taken 2 times loading in grandview , after click on image show image in view page taken 2 times. i thought requires fast net speed in project maximum 700 images. please know please share thought. while calling glide.load() set resize options. app using hell lot of images. using fresco , works charm.

(bootstrap) modal does not show -

i learning make basic modal shows on click of link. can explain me why code below not work? upon clicking, nothing happens. also, have include bootstrap css in head? notice when not included, modal not hidden. if include it, overwrites web page css. here fiddle link: https://fiddle.jshell.net/skljx4cy/#&togetherjs=m9br7ehjae and code: <!doctype html> <html dir="ltr" lang="en"> <head> <meta content="text/html; charset=utf-8" http-equiv="content-type"> <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"> <script src="https://code.jquery.com/jquery-1.10.2.js"></script> <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> <script> function loadmodal() { $('#settingsmodal

Java Quartz Scheduler - getScheduledFireTime returning incorrect value -

i have following sample quartz job retrieves web page. import java.io.bufferedreader; import java.io.inputstreamreader; import java.net.httpurlconnection; import java.net.url; import org.quartz.job; import org.quartz.jobexecutioncontext; import org.quartz.jobexecutionexception; public class samplequartzjob implements job { public void execute(jobexecutioncontext context) throws jobexecutionexception { system.out.println(context.getjobdetail().getkey().tostring() + " started"); system.out.println("scheduled fire time: " + context.getscheduledfiretime()); system.out.println("fire time: " + context.getfiretime()); try { sendget(); } catch (exception e) { e.printstacktrace(); } system.out.println(context.getjobdetail().getkey().tostring() + " completed"); system.out.println(); } private void sendget() throws exception { string url

vba - Inserting values into previously null fields, locking them -

i'm working in ms access 2013 , want write vba code button made on form. want code 2 things: insert values designate null fields , lock fields in form. accmdfreezecolumn doesn't seem appropriate since doesn't refer form. current thought use framework: sub buttonlockform1_click() dim intresponse integer intresponse = msgbox( _ prompt:="are sure want lock form?", _ buttons:=vbyesno + vbquestion + vbdefaultbutton2, _ title:="lock form?") if intresponse = vbyes ... ... else: if intresponse = vbno exit sub end if end sub any can provide appreciated! i'm guessing mean controls on form (like textboxes). null , empty strings different in vba btw. put inside if (and dim @ top obviously) dim ctl control each ctl in me.controls if isnull(ctl.value) or ctl.value = "" _ ctl.value = "value want save" if ctl.name <> "name of control don't want lock, buttons" _ c

javascript - cross domain ajax call in chrome extension -

i making small extension test apis. while making ajax calls throughs error. refused load script 'http://localhost:8080/acton-demouser/user1?callback=jquery2210009971836116164923_1456851818933&format=json&_=1456851818934' because violates following content security policy directive: "default-src 'self' blob: filesystem: chrome-extension-resource:". note 'script-src' not explicitly set, 'default-src' used fallback. while ajax call url : http://localhost:8080/acton-demouser/user1 manifest.json : { "name": "ajax helper", "version": "1.0", "description": "my first chrome extension.", "manifest_version": 2, "browser_action": { "default_icon": "icon.png", "popup": "popup.html", "default_popup": "popup.html" }, "app": { "background": {

javascript - Addinf event listeners for Dynamically added elements - HTML/JS -

i trying add event listeners html elements have been dynamically added using javascript. have div in main page <div id="someid"></div> and on click of button eventlistener as document.getelementbyid("someid").innerhtml = "<input type='button' id ='ad' value='add' style='height:30px; width:90px'/>" document.getelementbyid("ad").onclick = notherfunc; and function like function notherfunc(){ alert("working") } but isn't working. there way bind button function? you need use technique called " event delegation ". essentially, need bind click handler element exists , see if element clicked element expecting. document.getelementbyid("someid").addeventlistener("click", function (e) { if (e.target.id === "ad") { notherfunc(); } });

mysql - Ruby and mysql2: Looping Until Connection is Error Free -

context : writing simple dynamic query in ruby using mysql2 gem. attempt: #!/usr/local/bin/ruby require "mysql2" puts "please enter title of report:" title = gets.chomp mysql2::client.default_query_options.merge!(:as => :array) puts "please enter host, username, password , database in order:" hst = gets.chomp user = gets.chomp pass = gets.chomp db = gets.chomp begin mysql = mysql2::client.new(:host => hst, :username => user, :password => pass, :database => db) rescue mysql2::error => e puts e.errno puts e.error retry puts "error: please try again." puts "enter host, username, password , database:" hst = gets.chomp! user = gets.chomp! pass = gets.chomp! db = gets.chomp! end puts "successfully accessed #{db}!" note that: rescue mysql2::error => e puts e.errno puts e.error works mysql gem, but: rescue mysql2::standarderror => e puts e.errno pu

javascript - subtract time between two values set in localstorage -

i have quiz program written in vanilla js. supposed log time takes complete it. what achieve how long takes user answer questions subtraction 2 variables (strings). if possible. when user has stated name , presses button "start quiz" currrent time logged in localstorage so: var storename; var d = new date(); var h = gethours(); var m = getminutes(); var s = getseconds(); var starttime = h + ":" + m + ":" + s; var endtime = h + ":" + m + ":" + s; var result; var storage = { storename: storename, starttime: starttime, endtime: null, result: result }; the tricky part not know how subtract starttime endtime time took answer questions. quiz on in minutes, use hour redundant. when user has clicked "submit" answer on last question want time logged in ls endtime. i hope have not been unclear , thank in advance time. thank you. instead of storing string date, directly store time in milliseconds