Posts

Showing posts from March, 2013

javascript - click and run one function of two different function in one div in angular -

i create 2 div , each div had different angular function. want click 1 of them using ng-click. if 1 of div click, hope me running own function in case run both of function. code looks : html code : <div ng-controller="ctrl1"> <div ng-click="titi();" style="width:200px; height:200px; background-color:red;"> <div ng-click="toto();" style="width:100px; height:100px; background-color:yellow;">click me</div> </div> </div> and angular code : var app = angular.module('myapp', []); function ctrl1($scope) { $scope.toto = function(){ alert('toto'); }; $scope.titi = function(){ alert('titi'); }; } if click yellow div, show alert toto , titi. , if click red div, show alert titi. want when click 1 of them, run own function click. there wrong? please :( here click on inner element div propagated outer div. use $event.

node.js - Node + Q with expressjs - ordered promisses -

i want execute set of functions in order written , in end release request client. for example see mock code bellow: router.get('/dashboard', function(req, res, next) { var json = {items : 0} q.fcall( function(){ //first exec json.items+=1; } ).then( function(){ //scond exec json.items+=1; } ).then( function(){ //third exec json.items+=1; } ).finally( function(){ //do when other promises don res.json(json); }); } the function shoud executed when done. can done q? update think mislead you, , did not give information, because did not think relevant, is... bringing data via mongoose, , mongoose async asd well. goes this: q.fcall( function() { visitor.count(daterange, function(err, data) { json.newvisitors = data; }); }).then( function() { account.coun

sql server - .net SQL DateTime returning wrong value -

if use either select convert(datetime, deldate, 113), deldate it returns datetime: 21/01/2015 23:00:00 which correct, stored in db table datetime. when inserting db via datatable (row.item("deldate").tostring()) it returns 22/01/2015 00:00:00 i tried dim deldate datetime deldate = convert.todatetime(row.item("crmp_deliverydate").tostring()) and still returns 22/01/2015 00:00:00 can out, actual datetime. thanks

python - Extract string inside nested brackets -

i need extract strings nested brackets so: [ [ hello [ ] [what ] other side ] slim shady ] result (order doesn't matter) : this slim shady hello other side note, string have n brackets, , valid, may or may not nested. also, string doesn't have start bracket. the solutions have found online similar problem suggest regex, i'm not sure work in case. i thinking of implementing similar how check if string has valid parentheses: walk through string. if see [ push index on stack, if see ], substring there current spot. however, we'd need erase substring original string don't part of of outputs. so, instead of pushing pushing index stack, thinking of creating linkedlist go along, , when find [ insert node on linkedlist. allow delete substring linkedlist. would approach or there cleaner, known solution? edit: '[ [ hello [ ] [what ] other [side] ] slim shady ][oh [g[a[w[d]]]]]' should return (order doesn't matter) : this slim shady h

php - how to create array that will print_r like this: array( array('foo' => 'bar')) -

how create array print_r this: array( array('foo' => 'bar')) because this: $a = array( array('foo' => 'bar')) will print this: array( [0] => array ('foo' => 'bar')) print_r prints arrays showing indexes explicitly. there's no way customize this. if it's normal indexed array, show numeric indexes.

malloc'd C string created in c file being lost when bridging to swift file on specific input -

i making dictionary application written in swift , c. using c, .h , .c, search dictionary text file have specific traits, determined user inputs call dictionaryviewcontroller. method of passing input data c function , determining return char* fine however, on input, char* created not make swift file , nil value produced. how can sure swift can access memory allocated c file? //.c file char* searchdictionary(char* u_input) { char* returnvalue = malloc(sizeof(char)*largenumber); //implementation return (returnvalue); } //.h file char* searchdictionary(char* u_input); //.swift file var uin = userinput.text let uinn = (uin nsstring).utf8string var uinnn = unsafemutablepointer<int8>(uinn) var out = unsafemutablepointer<int8>.alloc(1) out = searchdictionary(uinnn) //out gets value returned searchdictionary dictoutput.text = nsstring(cstring: out, encoding: nsutf8stringencoding) i found out going on. when working c strings between swift , c, use nsasciistrin

google tag manager - When should variables be quoted in GTM custom html tag? -

i trying implement facebook pixel via gtm, , hitting few oddities. i implementing via custom html tag, , if dont quote variables, gtm debugger shows them google_tag_manager["<id>"].macro(\'gtm123123123\') in debugger, instead of value itself. if surround use of variable quotes, see value itself. if {{user email}} translated javascript code seeing, presume quoting isnt required? if need quote, how write code like? em: ({{user email}} || "").tolowercase(), which recommended? how decide? also debugger surrounds entire tag in '' expected? in custom html tags reference variables double brackets per example, without quotes. e.g. var useremail = {{user email}}; the preview mode debug panel showing non-executed version of custom html tag. '' wrapped around script in panel output expected. why variables not showing values, instead seeing internal gtm reference variable. if need test variable can temporarily include

reporting services - SSRS count duplicate values only -

Image
dears , my issue need count duplicated values using count expression in ssrs . all solutions on internet count distinct values. thanks enter image description here 1. sql query declare @tb table ([number] int null, [fruit] [varchar](50) null) insert @tb ([number], [fruit]) values (3, n'apple') insert @tb ([number], [fruit]) values (4, n'apple') insert @tb ([number], [fruit]) values (6, n'banana') insert @tb ([number], [fruit]) values (5, n'orange') insert @tb ([number], [fruit]) values (7, n'orange') insert @tb ([number], [fruit]) values (8, n'apple') insert @tb ([number], [fruit]) values (9, n'banana') select fruit,count(number) count @tb group fruit -------------------edited------------------- 2 . in ssrs

php - Inserting Value into database of hidden fields -

query if select 'select new parent category' dropdown, new textbox gets appear. wants insert value database. textbox hidden bydefault. html file <head> <script type="text/javascript"> $(document).ready(function() { $('#parentcat').change(function(){ if($('#parentcat').val() === 'create new parent category') { $('#other').show(); $('#catname').hide(); } else { $('#other').hide(); $('#catname').show(); } }); }); </script> </head> <table> <body> <form method="post" action="" name="form1" enctype="multipart/form-data" > <tr> <td><h4>add category</h4></td> </tr> <tr&g

distriqt - Add test In App purchase to live ios -

i want test new in-app purchase on live app before iap goes live. don't see way associate iap test flight version. is there anyway this? you should read "testing in-app purchase products" guide apple key points are: to perform testing in-app purchase products: set test user accounts within users , roles in itunes connect, detailed in creating sandbox tester accounts in itunes connect developer guide. you’ll need test user each territory want test app in. clear account information stored on test device. prevents actual user account automatically being used when testing. use test account credentials test purchase. you can setup sandbox test users in itunesconnect. following has detailed information. https://developer.apple.com/library/ios/documentation/languagesutilities/conceptual/itunesconnect_guide/chapters/settingupuseraccounts.html#//apple_ref/doc/uid/tp40011225-ch25-sw10 the products must real products ready go live next

Create a 'close/exit' option for a child frame that is created using tkinter in python -

i have created script using tkinter, brings child frame when press button. frame occupies full screen size on mac laptop. need create option exit/ or close new frame. best option that? -thanks from tkinter import * import tkfont class app(frame): def __init__(self, *args, **kwargs): frame.__init__(self, *args, **kwargs) self.apple = button(self, text="apple", command=self.write_apple) self.apple.pack(side=left) def write_apple(self): self.customfont = tkfont.font(family="helvetica", size=80) t = toplevel(self) t.overrideredirect(true) t.geometry("{0}x{1}+0+0".format(root.winfo_screenwidth(), root.winfo_screenheight())) l = label(t, text="this green apple.",font=self.customfont) l.pack(side="top", fill="both", expand=true) if __name__ == "__main__": root = tk() main = app(root) main.pack(side="top", fill="both", expan

css - set label text to span width with javascript -

i want set specified label text span width here code. help. function setbarwidth(labeltext, barelement, cssproperty, barpercent) { var listdata = []; $(labeltext).each(function () { listdata.push($(this).textcontent); }); var listmax = math.max.apply(math, listdata); $(barelement).each(function(index) { $(this).css(cssproperty, (listdata[index] / listmax) * barpercent + "%"); }); } setbarwidth(".style-1 span label", ".style-1 em", "width", 100); setbarwidth(".style-2 span label", ".style-2 span", "width", 55); textcontent dom property, $(this) jquery object. should use this.textcontent or $(this).text() . you can replace .each .map var listdata = $(labeltext).map(function() { return this.textcontent; }).get(); .get() @ end necessary convert jquery collection ordinary array.

jquery - Bootstrap-Select doesn't respond to dynamically added rows/content -

i have table row multiple select boxes on form input. i can clone row create new row. this. var counter = 1; $(document).ready(function() { $('#additemrow').click(function() { $('#itemmultiinputtable tr:last').clone(true,true).insertafter('#itemmultiinputtable tr:last'); $('[id^=item_number]:last').attr('id', 'item_number' + counter); $('[name^=item_number]:last').attr('name', 'item_number' + counter); $('[id^=select_product]:last').attr('id', 'select_product' + counter); $('[name^=select_product]:last').attr('name', 'select_product' + counter); $('.selectpicker').selectpicker('refresh'); counter += 1; return false; }); }); but on dynamically created rows, of 'select' boxes have selec

structural vhdl: creating a "main function" -

i create structural vhdl file implements "main" function. "top-level" file design , program runs code prog. assuming fulladd_pack contains fulladd component, how "link" 2 vhdl files? *i don't arguments in main in order work. -- design.vhdl library ieee; use ieee.std_logic_1164.all; use work.fulladd_pack.all; entity design port(cin : in std_logic; x,y : in std_logic_vector(15 downto 0); s : out std_logic_vector(15 downto 0); cout, on : out std_logic); end design; architecture struct of design signal c,temp : std_logic_vector(1 15); begin main: prog port map(cin,x,y,s,c,cin); end struct; -- prog.vhdl library ieee; use ieee.std_logic_1164.all; use work.fulladd_pack.all; entity prog port(cin : in std_logic; x,y : in std_logic_vector(15 downto 0); s : out std_logic_vector(15 downto 0); cout, on

python - Numpy octuple precision floats and 128 bit ints. Why and how? -

this question out of curiosity. noticed numpy test suite contains tests 128 bit integers , , numerictypes module refers int128 , float256 ( octuple precision ?), , other types don't seem map numpy dtypes on machine. my machine 64bit, yet can use quadruple 128bit floats ( but not really ). suppose if it's possible emulate quadruple floats in software, 1 can theoretically emulate octuple floats , 128bit ints. on other hand, until had never heard of either 128bit ints or octuple precision floating point before. why there reference 128bit ints , 256bit floats in numpy's numerictypes module if there no corresponding dtype s, , how can use those? this interesting question , there reasons related python, computing and/or hardware. while not trying give full answer, here go towards... first note types defined language , can different hardware architecture. example have doubles 8-bits processor. of course arithmetic involves multiple cpu instructions, making

javascript - HashLocationStrategy on Angular2 beta 7 -

i want know how handle hashlocationstrategy angular2 beta 7? code beta 3 not work anymore. what have: import {bootstrap} 'angular2/platform/browser'; import {component, provide} 'angular2/core'; import {app_base_href, router_providers, locationstrategy, hashlocationstrategy} 'angular2/router'; import {appcomponent} './app.component'; bootstrap(appcomponent, [ router_providers, provide(locationstrategy, {useclass: hashlocationstrategy}) ]); and error set base tag. hashlocationstrategy did not require base tag. exception: error during instantiation of locationstrategy! (routerlink -> router -> location -> locationstrategy).browserdomadapter.logerror @ angular2.dev.js:23083browserdomadapter.loggroup @ angular2.dev.js:23094exceptionhandler.call @ angular2.dev.js:1185(anonymous function) @ angular2.dev.js:12591ngzone._notifyonerror @ angular2.dev.js:13635collection_1.stringmapwrapper.merge.onerror @ angular2.dev.js:13539zone.r

javascript - Multiple properties in ReactJS inlined styles object? -

how write equivalent to css .class { display: flex; display: -webkit-flex; } but using inline styles in react? i'm looking like: javascript let styles = { display: ['flex', '-webkit-flex'] } your problem reactjs common problem still opened , waiting proper solution for webkit style, 1 solution concat values: let styles = { display: 'flex; display:-webkit-flex' } otherwise, more common solution create css named ' flex ' given classname property of element. third solution: use radium . believe big & tedious problem can try if have time... :)

html - Hide A Div With CSS Only -

is there way hide div css when click link. i'm making popup needs able close when there no js. i've tried various methods have not worked when button inside div needs hide. when button inside div needs hide. short answer: no, can't achieve when button inside element. thanks joseph marikle however, can achieve when button outside div. #hide { display: none; } label { cursor: pointer; text-decoration: underline; } #hide:checked ~ #randomdiv { display: none; } <input type="checkbox" id="hide" /> <div id="randomdiv"> div <label for="hide">hide div</label> </div>

wpf - How do i get the value of selected item from list box in windows phone application using c# -

i'm trying value of selected item list box , display message using messagebox.show(). xaml code list box <listbox x:name="lbtodolist" grid.row="1" width="350" margin="100,0,0,0"> <listbox.background> <lineargradientbrush endpoint="0.5,1" startpoint="0.5,0"> <gradientstop color="#ff060000" offset="0"/> </lineargradientbrush> </listbox.background> <listbox.itemtemplate> <datatemplate> <stackpanel orientation="horizontal"> <textblock x:name="listbox" grid.row="1" text="{binding salutationname}" /> </stackpanel> </datatemplate> </listbox.itemtempl

css - 404 errors after redeploy webapp minified (caching) -

Image
i'm facing fallowing problem webapp: every time have redeploy (aws), page not load correctly first time because (i believe) local cache has js , css files corresponding deploy. i'm using angular backed java , serving spring boot. when foce re-download (ctrl + r, e.g.), works fine. in attempt fix added following meta index.html: <!--setting content "0" tells browsers load page web server.--> <meta http-equiv="cache-control" content="max-age=0"/> <meta http-equiv="cache-control" content="no-cache"/> <meta http-equiv="expires" content="0"/> <meta http-equiv="expires" content="0"/> <meta http-equiv="pragma" content="no-cache"/> which apparently did not work. can do? maybe can cheat behaviour adding query files, somethink : <script src="myscript.js?build=mybuildversion"></script> <

mocking - Init function isn't calling when Reflux.createStore -

i have mocked store var action = reflux.createaction('action'); var mockfn = jest.genmockfn(); var store = reflux.createstore({ init: function () { console.log("init mock"); this.listento(action, this.onaction); }, onaction: function () { mockfn(); } }); export default store; and when component try listen store componentdidmount = () => { ... const deregstorelistener = conceptstore.listen( ({nodes,centroids}) => { ... } ) } it throw error typeerror: _index2.default.listen not function the strange behavior init function wasn't called. reflux.createstore didn't created store properly. why?

excel vba - AutoFilter Method of Range Class Failed VBA -

i having issue autofilter in vba. have data on 1 sheet deleted based on values entered in sheet. in other words, user inputs 2 values (greater "500" , less "-500") , autofilter deletes data on first sheet based on user inputs. sub autofilter() dim wksdest worksheet dim lastrow1 long dim lastrow2 long dim rng range dim rngdelete range application.screenupdating = false application.calculation = xlcalculationmanual set wksdest = worksheets("sheet2") worksheets("sheet2").select wksdest lastrow2 = .cells(.rows.count, "d").end(xlup).row set rng = range(cells(2, "d"), cells(lastrow2, "d")) rng.autofilter field:=2, criteria1:=">=" & worksheets("holders (corp)").range("e2").value, _ operator:=xland, criteria2:="<=" & worksheets("holders (corp)").range("f2").value set rngdelete = rn

How to retrieve a declared variable in sql server -

using code below (which found here ), variable 20 million rows being created. find stored variable. able locate tables i've created particular variable isn't visible. my end goal export variable , values in csv format. how make happen. declare @p_numberofrows bigint --we need 20 million rows select @p_numberofrows=20000000; base ( select 1 n union select n+1 base n < ceiling(sqrt(@p_numberofrows)) ), expand ( select 1 c base b1, base b2 ), nums ( select row_number() over(order c) n expand ) select n nums n<=@p_numberofrows --remove maximum recursion level constraint option (maxrecursion 0); well depending on how handling result set in application going create csv, there seem several ways go. first add variable count every row returned in select select n, @p_numberofrows numberofrows nums n<=@p_numberofrows or return 2 results sets, 1 data , 1 number of rows variable select n nums n<=@p_numberofrows select @p_numberofrows numberofrows

javascript - Play audio when clicking on button and redirect after sound is done playing -

i made simple site 4 buttons. if click 1 want play sound , when sound done playing (or after 'x' amount of seconds) want redirect. this code far. have no idea on how put in sound , delay. <html> <head> <link rel="stylesheet" type="text/css" href="/level1/style.css"> </head> <body> <img style= "top: 20px; left: 200px; height:900px; width: 800px position: absolute;" src="\images\border.jpg"> <img style= "position: absolute; top: 50px; left: 50px; height:120px; width: 120px;" src="\images\level1.jpg"> <a href="#"><img src="\images\1a1.jpg" onmouseover="this.src='/images/1a1g.jpg'" onmouseout="this.src='/images/1a1.jpg'" id="a1"> </a> <a href="\level1\index.html"><img src="\images\1a2.jpg" onmouseover="this.src='/images/1a2g.jpg

PHP array twice and value at the end -

i array append string , dismiss value if value "". somehow, resulting array this: array ( [0] => test1 [1] => test2 [2] => t3 [3] => t4 [4] => t5 [5] => t6 ) test1,test2,t3,t4,t5,t6 the php code: <?php include ('connserver.php'); if(isset($_post['submit'])) { //$query = $updatedby = $_post['username']; $shift = $_post['shift']; $date = $_post['currdate']; $machine = $_post['machine']; $timedown = $_post['timedown']; $timeup = $_post['timeup']; $downtimetype = $_post['dttype']; $tsdowntime = $_post['troubledt']; $prodowntime = $_post['prodowntime']; function is_notnull($var) {return !is_null($var);} switch ($downtimetype) { case "unscheduled": { $process = '-'; $description = $_post['description']; $actiontaken = $_post['details']; $remark = '-'; $sparepartstaken = $_p

html - Bootstrap Navbar not showing an un-ordered list -

i making navbar using bootstrap 3 , when put in ul tag , add list item doesn't show up. have tried wrapping in div class of container doesn't work. <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>bootstrap course</title> <link rel="stylesheet" href="styles.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mtjoasx8j1au+a5wdvnpi2lkffwweaa8hdddjzlplegxhjvme1fgjwpgmkzs7" crossorigin="anonymous"> </head> <body> <div class="navbar navbar-default navbar-fixed-top"> <div class="container"> <a class="navbar-brand" href="#"><img src="logo.png"></a> <div class="nav-collapse collapse navbar-responsive-collapse"> <ul class="n

javascript - NodeJs Error: spawn C:\Windows\system32\cmd.exe; ENOENT -

this script : var exec = require('child_process').exec; exec('dir', function(error, stdout, stderr) { // 'dir' example if (error) { console.error(`exec error: ${error}`); return; } console.log(`stdout: ${stdout}`); console.log(`stderr: ${stderr}`); }); and in console have : exec error: error: spawn c:\windows\system32\cmd.exe; enoent someone can me ?

extjs3 - extjs 3.2 horizonatal scrollbar for grid panel -

2 version, want display horizontal scroll bar grid panel. grid-panel binded panel, , in turn panel binded viewport. tried using auto-scroll property of grid-panel, didn't worked me. how can achieve this. add: style:"overflow-y:hidden;overflow-x: scroll;", container of grid

Why is TFS Rest API for fetching the TFVC changesets returning only 256 items? -

why tfs rest api fetching tfvc changesets returning 256 items. tried using $top more 256 results. no use. the api getting git repository commits working fine. i referring https://www.visualstudio.com/en-us/docs/integrate/api/tfvc/changesets sample request https://tfs.domain.com/tfs/defaultcollection/projectname/_apis/tfvc/changesets ?$searchcriteria.fromdate=2016-07-12t17:49:01&$skip=0&$top=500 i tried without $skip , $searchcriteria.fromdate also. please me understand how results. i managed resolve strange logic (thank msft guys rock :/). in case want changesets. 1) need first 256 changesets (i used orderby in case of different order in responses): <projectname>/_apis/tfvc/changesets?$top=256&orderby=id desc&searchcriteria.itempath=<your_path>&api-version=1.0 2) if have more 0 items in response last value of changesetnumber response. if 0 - got changesets. 3) next 256 items starting changesetnumber: <projectname>/_

php - How to pass data from one page to another on click -

i realize may begginer's question, upon searching around, nothing seemed solve problem. i need send information 1 page, page through button. haven't made code, don't know how works, know passes information other pages through onclick event. created page needs 1 information page, yet reason it's not working. it's sort of this: if (!empty($_get['short_proj_name'])){ $strqueryinfo = "select distinct proj_id,pcr projetos_main short_proj_name='".$_get['short_proj_name']."'"; $execinfo= mysql_query($strqueryinfo); while($info = mysql_fetch_array($execinfo)){ $strprojid = $info['proj_id']; $strpcr = $info['pcr']; } }else{ $strpcr = $_post['txtpcr']; } so code selects "pcr" , "short_proj_name" fields. need pass "pcr" field other page. here button it. <input type="submit" class="submit" onclick="window.

python 2.7 - Pysnmp openServerMode with IPv6 -

i try start snmp agent pysnmp. ipv4 , ipv6 bind, works pretty fine localhost ('127.0.0.1' , '::1') but when try use other ipv6 ip fetched interface, failed due [vagrant@test sources]$ sudo python snmp_agent.py enp0s8 traceback (most recent call last): file "snmp_agent.py", line 172, in <module> master_agent_startup(ifname=sys.argv[1]) file "snmp_agent.py", line 101, in master_agent_startup (get_ipv6_address(interface_name), snmp_agent_port)) file "/usr/lib/python2.7/site-packages/pysnmp/carrier/asyncore/dgram/base.py", line 50, in openservermode raise error.carriererror('bind() %s failed: %s' % (iface, sys.exc_info()[1],)) pysnmp.carrier.error.carriererror: bind() ('fe80::a00:27ff:fe9e:9c16', 8001) failed: [errno 22] invalid argument this output interface 'enp0s8': [vagrant@test sources]$ ifconfig enp0s8 enp0s8: flags=4163<up,broadcast,running,multicast> mtu 1500 ine

node.js - BodyParser data is undefined after AJAX call -

the body parser body {}. i've done research , made sure ajax data key set correctly make sure middleware set correctly well. here frontend ajax call $.ajax({ type:"get", url:"/api", data: {course:"math-226"}, success: function(data){ alert(data);} }); and here backend server.js file: 'use strict' const express = require('express'); const path = require('path'); const bodyparser = require('body-parser'); const alg = require('./app/algorithm.js'); const app = express(); app.use('/', express.static(path.join(__dirname, 'public'))); app.use(bodyparser.json()); app.use(bodyparser.urlencoded({extended: true})); app.get('/api', (req, res) => { console.log(req.body); alg.create(req.body.course, answer => res.send(answer)); }); let server = app.listen(3000, () => { let host = server.address().address; let port = server.address().port; c

styles - Android AppInvites API - How to customize with HTML -

i've implemented app invites intent starts has status bar color different 1 i've set activities. now according answer, customizable html cannot find documentation on how so... https://stackoverflow.com/a/35165179/4543112 edit : rumor or have idea if achievable , how ?

jooq sybase code generation issue -

i using sybase ase database. when trying generate code using jooq shows following warning.but no code generation done. in advance! //--------------------------------warning-----------------------------------// jul 19, 2016 5:49:17 pm org.jooq.tools.jooqlogger warn warning: no schemata loaded : please check connection settings, , whether database (and database version!) supported jooq. also, check case-sensitivity in configured <inputschema/> elements : [xfuse] jul 19, 2016 5:49:17 pm org.jooq.tools.jooqlogger info info: generating schemata : total: 0 -->config file------->>>><<<------->>> <?xml version="1.0" encoding="utf-8" standalone="yes"?> <configuration xmlns="http://www.jooq.org/xsd/jooq-codegen-3.8.0.xsd"> <jdbc> <driver>com.sybase.jdbc3.jdbc.sybdriver</driver> <url>jdbc:sybase:tds:192.168.xx.xx:5000/xfuse</url> <user>xxx&

python - Can I use same virtual environment on different computers -

on office computer, i've made virtualenv one-for-rule-them-all @ dropbox folder. want use environment both @ work , @ home. possible? (currently i'm not successful) look using relocatable option of virtualenv. full documentation, see virtualenv documentation on subject . one note of interest: also, not make packages cross-platform. can move directory around, can used on other similar computers. known environmental differences can cause incompatibilities: different version of python, when 1 platform uses ucs2 internal unicode representation , uses ucs4 (a compile-time option), obvious platform changes windows vs. linux, or intel vs. arm, , if have libraries bind c libraries on system, if c libraries located somewhere different (either different versions, or different filesystem layout). as alternative approach, manage project/setup dependencies setup.py requirements ( install_requires , setup_requires ), or pip requirements.txt file. more portable , cros

excel - Trouble pulling out any number from string -

i having trouble stripping numbers string. in excel, have many string fields may contain numbers. care number(s), rest of characters unwanted , discarded. number may in position, not set location. for example: '2 catch basins' or 'catch basins x2' i based code on so answer, can't seem work. error message 'application-defined or object-defined error'. option explicit function onlydigits(s string) string ' variables needed (remember use "option explicit"). ' dim retval string ' return string. ' dim integer ' counter character position. ' ' initialise return string empty ' retval = "" ' every character in input string, copy digits ' ' return string. ' = 1 len(s) if mid(s, i, 1) >= "0" , mid(s, i, 1) <= "9" retval = retval + mid(s, i, 1) end if next '

Python HTTPServer - get HTTP body -

i wrote http server using python, not know how http body. should http body? here code: from http.server import httpserver,basehttprequesthandler class myhttphandler(basehttprequesthandler): def do_get(self): print("connect ",self.client_address) print(self.headers) length = self.headers['content-length'] print(length) addr = ('',21567) server = httpserver(addr,myhttphandler) server.serve_forever() having request body in request not practice, discussed here: http request body instead, can change method post , check there basehttprequesthandler documentation: https://docs.python.org/2/library/basehttpserver.html especially part: rfile contains input stream, positioned @ start of optional input data.

Python Glueviz - is there a way to replace ie update the imported data -

i using glueviz 0.7.2 part of anaconda package, on osx. glueviz data visualization , exploration tool. i regularly regenerating updated version of same data set external model, importing data set glueviz. currently can not find way have glueviz refresh or update existing imported data set. i can add new data set, ie second more updated version of data model new import data set, not replace original, , not enable new data show in graphs set in glueviz in simple way. it seems solution plot updated data, start new session, , needing take time set plots again. tedious! as python running application, glueviz must storing imported data set somewhere. hence thinking work around replace existing data updated data. restart of glueviz, , reload of saved session, imagine not know difference , graph updated data set within existing graphs. problem solved. i not sure how glueviz python package stores data file, , python application best use update data file. as turns out,

ios - Filter two arrays Swift -

i have 1 empty array , 2 arrays data var resultsarray = [string]() var array1 = ["1","2","2","3","4"] var array2 = ["1","2","2","3","4","5","6"] my goal append resultsarray elements array2 don't match array1 ("5" , "6" in example). what's subtlest way so? thank you. use filter function var resultsarray = [string]() let array1 = ["1","2","2","3","4"] let array2 = ["1","2","2","3","4","5","6"] let filteredarray = array2.filter{ !array1.contains($0) } resultsarray.appendcontentsof(filteredarray) if collections contain unique items consider use set rather array

Incremental Development - Agile or Plan Driven -

i'm confused in incremental software methodology main difference between incremental development adopt plan driven approach , 1 adopt agile approach ? can explain me difference between 2 , if choice project? learning @ core of agile approaches. embraces fact impossible have enough information make detailed plan front. instead implementing, or possibly trying implement, first feature trigger valuable learnings. both implementation , usage , actual needs in field. i'm not sure "documentations important" means, dividing implementation along module boundaries cause number of unwanted effects: you can learn usage of complete system after modules done, a.k.a. late. drive unknown remaining amount of work after thought done. how know first module done? presumably based on guesswork should do, might right @ least wrong, causes unknown late modifications integration problems show after third module supposed finished all 3 drive late realizations problem

android - sendMessage() is not defined -

i trying create example know how handlers work. shown in code belwo, created workerthread runs ever , increment variable i. within run() method, want pass value of incremented variable textview shown in body of handler class. the problem is, line in there "new handler()" , "handler.sendmessage(m)" marked red please let me know how solve problem mainactivity public class mainactivity extends appcompatactivity { private final static string tag = mainactivity.class.getclass().getsimplename(); private textview mtvincr = null; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); this.mtvincr = (textview) findviewbyid(r.id.tvvalue); new workerthread().start(); } handler handler =new handler() {//error @override public void handlemessage(message msg) { int sentint = msg.getdata().getint("what"); mtvincr.settext("r:&qu

java - F.Promise<Result> and nested async promises -

i using f.promise in async action in playframework 2.4.6. able async calls dao work. able use "map" , "flatmap" not sure following situation. i have async call find , object database. if object found, want use parts of object issue async request update object in database. part of async update call in controller. not doing right though. i starting off following. f.promise<user> finduserpromise = userservice.findasync(id); f.promise<user> updateuserpromise = userservice.updateasync(updateduser); f.promise<result> resultpromise = finduserpromise.flatmap((founduser){ // update founduser passed in json criteria founduser.firstname = firstname; // etc... return updateuserpromise.map((updateduser) -> { return ok(json.tojson(u)); }); }); return resultpromise; this doesn't seem work. not want define updateduserpromise until response finduserpromise, because maybe user not found. if user not found, return f.promi

xamarin - Registering for remote notifications fails silently -

i trying implement push notifications our xamarin.ios app. i've followed multiple getting started guides , other tutorials, can't seem device token more. has worked before, , nothing significant changed, can't seem pinpoint problem here. appdelegate.cs [register("appdelegate")] public class appdelegate : uiapplicationdelegate, ireceiverdelegate { public override bool finishedlaunching(uiapplication application, nsdictionary launchoptions) { var gcmconfig = google.googlecloudmessaging.config.defaultconfig; gcmconfig.receiverdelegate = this; google.googlecloudmessaging.service.sharedinstance.start(gcmconfig); var nottypes = uiusernotificationtype.sound | uiusernotificationtype.alert | uiusernotificationtype.badge; var settings = uiusernotificationsettings.getsettingsfortypes(nottypes, null); uiapplication.sharedapplication.registerusernotificationsettings(settings); uiapplication.sharedapplica

php - Rendering html to pdf -

i new laravel. want convert html page pdf therefore using: https://github.com/barryvdh/laravel-snappy now controller using following code: $data = $this->getdata(); $html = view('myview', [ 'data' => $data] )->render(); $pdf = \app::make('snappy.pdf.wrapper'); $pdf->loadhtml($html); return $pdf->inline(); when dump or return $html variable, it's giving desire view on browser when convert not giving output. html page using bootstrap think after rendering normal html string. can tell missing here? i have tried $pdf->loadview() it's not working. take @ loadview function. try this: $data = $this->getdata(); $pdf = \app::make('snappy.pdf.wrapper'); $pdf->loadview('my.view', $data); return $pdf->inline(); and print what's returned laodview see if view correctly.

ios - How to check SQLite table is empty or not in Swift -

i using fmdb. need function tells table empty or not tried this. table empty writing somedata var count = shoppingpad.executestatements("select count(*) mytable") print("count",count) if(!count ) { print("empty table") } else { print("somedata") } executestatements update/insert statements. data out of database use executequery, returns resultset, have fetch actual data , integer value of first row. let result = database.executequery("select count(*) mytable", withargumentsinarray: []) if result.next() { let count = result.intforcolumnindex(0) if count > 0 { print("somedata") } else { print("empty table") } } else { print("database error") }

java - flush() does not flush on a Process OutputStream -

i tried multiple ways that: printing process-outputstream 1 second delay after each "flush()". flush doesn't seem work it's supposed to. can tell me why? 1 combined string when "close()" being called. there won't printed before "close()" comes action. context: should shut down minecraft server , run backup afterwards. bufferedwriter w = new bufferedwriter(new outputstreamwriter(process.getoutputstream())); w.write("say serverbackup begins in 3..."); w.flush(); thread.sleep(1000); w.write("say 2..."); w.flush(); thread.sleep(1000); w.write("say 1..."); w.flush(); thread.sleep(1000); w.write("say game over!!!!!!!!!!!!!..."); w.flush(); w.write("stop"); w.flush(); w.close(); process.waitfor(10, timeunit.seconds); //... as sanket gupte answered, have add '\n' @ end of messages, since read process's input stream .readline() (i suppose), print if \n appears, regardles

html - wp header logo over secondary nav -

i have tried few different things , on 2 websites manage (one i've created mimic preexisting , preexisting) having irregularities header logos on wordpress. on site have created, logo sits fine application of : header#top #logo img { height: 160px !important; position: absolute; z-index: 1000; top: -35px; } which seems work, when applied other site not? www.yourproactiveit.com 1 works , www.sydnic.com 1 not go above secondary nav, same code on each. you can fix adding body header#top #logo img { top: -15px !important; } you can set top: -15px value want, pull top use minus " - " sign. notice: can see in css file have top: -30 logo element forgot type px units.

r - Plot many categories -

Image
i've data follow, each experiment lead apparition of composition, , each composition belong 1 or many categories. want plot occurence number of each composition: df <- read.table(text = " comp category comp1 1 comp2 1 comp3 4,2 comp4 1,3 comp1 1,2 comp3 3 ", header = true) barplot(table(df$comp)) so worked me. after that, composition belong 1 or many categories. there's comma separations between categories.i want barplot compo in x , nb of compo in y, , each bar % of each category. my idea duplicate line there comma, repete n+1 number of comma. df = table(df$category,df$comp) cats <- strsplit(rownames(df), ",", fixed = true) df <- df[rep(seq_len(nrow(df)), sapply(cats, length)),] df <- as.data.frame(unclass(df)) df$cat <- unlist(cats) df <- aggregate(. ~ cat, df, fun = sum) it give me example: comp1 1 2 3 4 comp1

java - How can i create a RESTFul application which uses Apache Spark, specially Streaming at the back end -

i quiet new apache spark. want have restful service receives file (large file) apache spark process file in near real-time @ back-end. want implement in java. what suggested light weight framworks? how can pack application (distribution). have server (e.g. tomcat). should pack spark inside webservice ? how can run spark cluster programmatically? service , down on demand. is there samples follow kind of architecture or implementation? thanks use akka http implement rest services. complete working example of how integrate akka , spark killrweather .

Powershell: Get object value to int array -

i'm new powershell can please explain simple way copy values object basic integer array without copying original object. sorry if confusing, mean want capture object values , put them in integer array can simple arithmetic on values for example $computercpu = get-wmiobject win32_processor -computer "mycomputer" | ` select-object {$_.loadpercentage} on windows server 2008 vm @ work returns 2 values i want average tried $average = ($computercpu[0] + $computercpu[1]) / 2 this cannot work values not of type int. i tried casting values $average = ([int]$computercpu[0] + [int]$computercpu[1]) / 2 but results in cannot convert error. i know problem great if explain fundamental solution run problem lot , know there must defined solution or way avoid entirely. thanks. ps: if possible please don't provide alternative solution, want know how objects values integer array perform arithmetic on values. thanks. in addition ebgreen'

swift - Using an enum's default value as a dictionary key without explicitly casting to String -

if declare enum this: enum keys { case key_one case key_two } i can print , automatically converted string : print(keys.key_one) // prints "key_one" if make dictionary maps strings whatever (but let's choose strings again simplicity), think should able add key using keys.key_one key, right? wrong. var mydict = [string : string]() /// error: cannot subscript value of type '[string : string]' index /// of type 'keys' mydict[keys.key_one] = "firstkey" i can if explicitly convert keys.key_one string though: mydict[string(keys.key_one)] = "firstkey" print(mydict) // ["key_one": "firstkey"] so want without having wrap enum string() every time. i've tried few things doing extension off of dictionary using where keyword key , trying implement new subscript functions, can't work. what's trick? update solution i found solution ( see below ). i figured out ext