Posts

Showing posts from September, 2011

javascript - Grid filtering pass result to function -

on page fiddle have grid. in $scope.myitems have data. i want observe data. after type in name field "enos", want records contain string ("enos"). the grid works, want print data using console log, because after filtering data want pass data function. i tried use $scope.watch it's not working. .module('myapp', ['trnggrid']) .controller("mainctrl", ["$scope", function ($scope) { $scope.myitems = [{name: "moroni", age: 50}, {name: "tiancum", age: 43}, {name: "jacob", age: 27}, {name: "nephi", age: 29}, {name: "enos", age: 99}]; $scope.$watch('myitems', function(newvalue) { console.log(newvalue); }); }]); when type sth field console log isn't working. answer can found documentation http://moonstorm.github.io/trnggrid/release/#/glo...

Active Directory data into SQL table -

how extract active directory info (username, first name, surname) , populate sql table results? many thanks scott the way large ad environment: nightly batch process runs adfind (freeware tool) execute ldap query , dump out csv files bcp (built-in sql command line tool) bulk import csv files import tables in sql database stored procedure (executed osql ) take data import table , add/update records in main tables we pull 145k users, 80k groups, 130k computers 10 domains in 2 hours start finish. includes pulling accurate lastlogon information users , computers requires hit each domain controller. without that, process takes 30 minutes.

oracle - how do you configure unix ODBC on a Linux server -

i have downloaded, build , configured unixodbc-2.3.2.tar i installed: oracle-instantclient12.1-odbc-12.1.0.2.0-1.x86_64.rpm oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm oracle-instantclient12.1-sqlplus-12.1.0.2.0-1.x86_64.rpm i configured /usr/local/etc/odbcinst.ini follows: [oracle] description = oracle odbc connection driver = /usr/lib/oracle/12.1/client64/lib/libsqora.so.12.1 setup = fileusage = libsqora.so.12.1 file exists: file /usr/lib/oracle/12.1/client64/lib/libsqora.so.12.1 /usr/lib/oracle/12.1/client64/lib/libsqora.so.12.1: elf 64-bit lsb shared object, x86-64, version 1 (sysv), dynamically linked, not stripped i configured odbc.ini file: [prd_db] driver=oracle description=prod database trace=yes servername=//prddb01:1521/dbp01_svc1 when use prd_db credentilas connect using isql: isql prd_db i connection error. user name , password accurate , can connect using sql developer. what missing? need configure odbc connection in linux server....

statistics - R - list of 20,000 addresses in one county and I want to make a density map by block -

i have dataframe 20k addresses in 1 county , ideally want make block-level map colored how many of addresses located in blocks. darker colors = more addresses. have done rudimentary mapping never quite this. imagine might need use census data block information or maybe not? any tips on how started this? thanks!

Batch Script robocopy exclude files but not in every folder -

i trying copy contents of c:\ drive 1 computer new computer. trying copy user files , not system files. code far. @echo off cls @echo type old computer name set /p asset= @echo. @echo user's aiu? set /p useraiu= robocopy.exe \\%asset%\c$\ c:\ /s /z /xjd /xj /xa:sh /xa:t /xd "dir1" "dir2" /xf *.dll *.log *.txt *.exe /log+:"\\server\path\%asset%-to-%computername%-transfer.log" /np /fp /v /tee i have exclude hidden files, system files , temporary files. wanted exclude .dll .log .txt .exe files root of c not folders being transferred. is possible exculde files root of c still transfer them if exist in folders? you use xcopy doesn't copy hidden files or system files. add /e parameter copy empty folders. add /c parameter ignore errors. xcopy %src% %dest% /exclude:extlist.txt /s extlist.txt .dll\ .txt\ .exe\ .log\ .tmp\ edit: misunderstood question. didn't realize copying networked computer. xcopy won't work then...

db2 - Read in a file that contains multimple "CLOB" formatted data fields -

reading in file contains multiple "clob" formatted data fields (fields formatted text values 32k bytes in size). text includes end of line characters, our standard import wizards confused , think they've reached end of line , start importing next record. option remove eol characters within text, import data. is additional methods work, in db2 system? you need find character never part of data fields. let's suppose caret symbol never there, can use field delimiter. need place around each data field, try importing specifying following modifiers: modified chardel^ delprioritychar , way new line symbols fall inside pair of carets ignored when searching end of record. if import wizard not allow specify modifiers, you'll need run db2 import command manually.

regex - Negative look-ahead assertion in list.files in R -

i try list files in directory not start "camera1", end ".png". doing so, using regular expression in list.files in r. exclude "camera1", tried use negative lookahead, doesn't work. mistake? ;) list.files(pathtodirectory, pattern = "^(?!camera1).*\\.png") i error: invalid 'pattern' regular expression in advance :) looks default engine doesn't lookarounds, need use perl. works: dat <- c("camera1.png", "camera2.png", "hello.png", "boo") grep("^(?!camera1).*\\.png", dat, value=t, perl=t) # [1] "camera2.png" "hello.png" but doesn't: grep("^(?!camera1).*\\.png", dat, value=t) # invalid regular expression '(?<!camera1)\.png', reason 'invalid regexp' so, what want: grep("(?<!camera1)\\.png", list.files(), perl=t, value=t)

jquery - Header Button Hover Colour -

i 2 weeks new web development , in process of making website. have been trying hover on header button working can't find solution. here code. html: <!doctype html> <html lang="en"> <head> <title>home</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" type="text/css" href="style.css"> <link href='http://fonts.googleapis.com/css?family=pt+sans' rel='stylesheet' type='text/css'> <script src="http://timthumb.googlecode.com/svn/trunk/timthumb.php"></script> </head> <body> <div class="banner"> </div> <div class="nav"> <ul> <li><a class="active" href="#">home</a></li> <li><...

ember.js - EmberData Setting value prevents future autoloads of data after model save -

in emberdata calling model.save() causes model persisted via whatever adapter in place. if adapter returns data (such json api) model updated data. i have stumbled upon sequence not true. in voucher system checkout process vouchercode entered on order model. when 'apply' button pressed order saved via order.save() , voucher submitted server. if voucher code valid vouchervalue field populated number. if voucher code invalid 422 error returned standard errors object per http://emberjs.com/api/data/classes/ds.errors.html now, here things go awry. if code entered returns vouchervalue of 300 controller property calculates discount. discount: function () { var discount = this.get('model.vouchervalue'); // calculation return discount; }.property('model.vouchervalue') if, whatever reason, user enters invalid code return error described above. server removes discount , sets vouchervalue 0 as error response not contain updated data in cat...

Tomcat resource JNDI to mysql non default port, Spring Web app -

i have configured resource in server.xml: <resource name="readconnection" auth="container" type="javax.sql.datasource" username="user" password="pass" url="jdbc:mysql://adresip:7777/database" driverclassname="com.mysql.jdbc.driver" initialsize="20" maxwait="5000" maxactive="500" maxidle="50" validationquery="select 1" poolpreparedstatements="true" removeabandoned="true" /> i'm using non-default port: 7777. in front of mysql database there haproxy accept connection on port 7777 , forward connection mysql instance (on standard port, other ip) problem is: - can connect mysql database via port 7777 using mysql workbanch - webapp cannot connect via 7777 if change in haproxy port 7777 3306 web app can connect database(via haproxy) - without changes in...

jquery - how to make button in ionic + css -

i need design toolbar in ionic .i able make tool bar not similar in below pic.in given image buttons small height , small font .second thing second button bigger than rest .in given image button have different width .can make same button in ionic tried in ionic not able make same above how make same type of toolbar in ionic show in image here code ![<html ng-app="ionicapp"> <head> <meta charset="utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"> <title>tabs example</title> <link href="//code.ionicframework.com/nightly/css/ionic.css" rel="stylesheet"> <script src="//code.ionicframework.com/nightly/js/ionic.bundle.js"></script> </head> <body> </body> <ion-view> <ion-header-bar align-title="center" class="bar-balanced"> ...

OCaml - Compile OCaml and C code that uses Ctypes -

i'm trying learn how call routines in c directly ocaml code, using ctypes library. i have basic example 2 files: hello.ml , hello.c . hello.ml looks this: open ctypes open foreign let hello = foreign "hello" (float @ -> returning void) ;; let () = hello 3.15 ;; hello.c looks this: #include <stdio.h> void hello(double x) { if ( x > 0) printf("hello!\n"); } how compile these 2 files 1 executable? the process of manually compiling/linking code scary me , don't understand well. use makefile template compile code because that's easy. here's example use on os x. in simple.c int adder(int a, int b) { return + b; } and in simple.ml open ctypes open foreign let adder_ = foreign "adder" (int @-> int @-> returning int) let () = print_endline (string_of_int (adder_ 1 2)) then clang -shared simple.c -o simple.so ocamlfind ocamlopt -package ctypes.foreign -c...

sql server 2008 - ConnectionManager details revert back -

i have connectionmanager called: database1. want change connection string database1. therefore follow these steps: double click on connection manager database1 change server, database, username , password. these connection however, when build project settings revert old connection. why this?

jquery - Adjust the height of table column based on the content inside it -

how adjust height of td based on iframe height. tried height:auto , doesn't work. each iframe has different content , hence height differs i using content carousel switch between 1 iframe other. initially happens content carousel animates automatically switching between each iframes. , lands @ first iframe. user can use carousel navigation switch between iframes. <td class="tabcontainer"> <div id="multipleiframe"> <iframe></iframe> <iframe></iframe> <iframe></iframe> <iframe></iframe> </div> </td> below code using change height of each iframe , td height. settimeout(function() { $("#multipleiframe iframe").each(function() { var heightiframe; heightiframe = $(this).contents().height(); $(this).css({ "height": heightiframe }); var tabheight; tabheight = heightiframe + 50; $(".tabcontainer").css({"height":tabheight+"px"}) }...

apigee SOAP validation -

i'd validate soap request wrapped in mtom via apigee soap message validation against wsdl file. when submit request header content-type: multipart/related; type="application/xop+xml";start=" http://tempuri.org/0 ";boundary="uuid:4fa9f99a-7f53-4ac6-84ff-05655e9af89c+id=22";start-info="text/xml" the validation policy seems pass-through / not trigger. put bogus info envelope, not fail. i've seen post mentioned in order soap validation policy trigger, header must specify content-type: "application/xml". if so, mtom wrapping causes problems since request body not pure xml: ex. mtom wrapper: --uuid:4fa9f99a-7f53-4ac6-84ff-05655e9af89c+id=22 content-id: http://tempuri.org/0 content-transfer-encoding: 8bit content-type: application/xop+xml;charset=utf-8;type="text/xml" so, long-winded (sorry) way ask quesiton: how use soap message validation policy in apigee if expects pure xml , have mtom wrapper? side no...

jquery - How to add an event listener when an element is transformed? -

i'm developing responsive website using bootstrap 3 many features, 1 of them when website displayed on mobile drop down menu displayed ( on desktop have normal menu , on mobile version transform collapsing drop down menu) problem need event listener able listen when normal menu transformed collapsing drop down menu, there way that? many thanks. html code: <div class="container-sm visible-sm visible-xs container visible-md visible-lg"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="sr-only">left menu</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <div class="navbar-collapse collapse"> <div id="sidenavbox" class=...

node.js - Confusing object from findById operation -

i don't know if javascript syntax error or bad use of loopback. when execute filter model , print (company object) company.findbyid(companyid, { include: 'markers' }, function(err, company) { console.log(company); }); the console shows me output (it's good) { id: '85', name: 'myname', ruc: '45453453232', logo: 'https://res.cloudinary.com/dphutkz4b/image/', location: 'bolivia', imagead: 'http://res.cloudinary.com/dphutkz4b/image/upload/', markers: [ { id: '104', valuelk: 666, position: '-12.101419,-77.033414', city: 'glasgow', district: 'ate', banner: 'http://res.cloudinary.com/dphutkz4b/image/', companyid: '85' } ] } but when print property markers object instead of console.log(company); console.log(company.markers); the output whole function , cause problem when want use in .jade file function (condorrefresh, cb) { if (...

php - organizing search results based on longest match -

i have database table contains project keywords. each project has several keywords. in web application, user can perform search entering multiple keywords search for. if user enters (for example) 4 keywords, want return search result list of projects. projects should ordered based on longest matches first. first projects listed ones matched on 4 keywords, followed projects matched on 3 out of 4 keywords, etc. what query can write return results? this rough idea of think query like: select projectid project_keyword keyword = '*keyword1*' or keyword = '*keyword2*' or keyword = '*keyword3*' but want projectid matches 3 keywords displayed first (if any), followed projectid matched 2 out of 3 keywords, etc. projectid don't have matching keywords not returned. example: projectid keyword --------- ------- 456 salsa 456 guacamole 456 tamale 511 salsa 511 tamale 511 burrito 511 tac...

xml - XSLT contains error -

i apologize crude explanation, i'm new xml , xslt. patience. here's challange, i'm trying build transformation csv creates new line each instance of employee's benefit enrollments. so, if they're enrolled in 2 plans, line gets created each plan. same being done thier dependents. xml, how loop through different nodes , pick right data? while trying make sure don't make lines dependents aren't enrolled in benefit, came across error: description: xpty0004: sequence of more 1 item not allowed first argument of contains() ("system_id", "dependent_id", ...) i see there more 1 id type in dependent element, don't want specifiy 1 use because need scan both of them. here's xml: <report> <employee_id>111111</employee_id> <last_name>allen</last_name> <first_name>amy</first_name> <benefit_elections> <benefit_type>accident</benefit_type> ...

java - Hadoop Mapper is failing because of "Container killed by the ApplicationMaster" -

i trying execute map reduce program on hadoop. when submit job hadoop single node cluster. job getting created failing message "container killed applicationmaster" the input used of size 10 mb. when used same script of input file 400 kb, got succeded. failing the input file of size 10 mb. the complete log displayed in terminal follows. 15/05/29 09:52:16 warn util.nativecodeloader: unable `load native- hadoop library platform... using builtin-java classes applicable submitting job on cluster... 15/05/29 09:52:17 info client.rmproxy: connecting resourcemanager @ /0.0.0.0:8032 15/05/29 09:52:18 info input.fileinputformat: total input paths process : 1 15/05/29 09:52:18 info mapreduce.jobsubmitter: number of splits:1 15/05/29 09:52:19 info mapreduce.jobsubmitter: submitting tokens job: job_1432910768528_0001 15/05/29 09:52:19 info impl.yarnclientimpl: submitted application application_1432910768528_0001 15/05/29 09:52:19 info mapreduce.job: url track job...

css - sliding in a dropdown inside a div with overflow hidden -

i'm creating sliding animation dropdown inside div, "overflow:hidden" of div preventing show dropdown list when click on dropdown open it. i'm aware "overflow:hidden" lets me slide dropdown off without adding width page... question: how can keep both sliding animation , able show dropdown menu when it's open?

java - AES decryption after sending message to IP address -

so making app sends secure messages specified ip address. using aes encrypt message , part works great. able encrypt message , decrypt before send message. however, when try decrypt message has been recieved server, can not decrypt it. gets displayed in it's encrypted form. i error "java.lang.numberformatexception: invalid int: "ne"" , think may have character encoding or something? string altered in way when sent on network? here snippets may related issue. public static string encrypt(string seed, string cleartext) throws exception { byte[] rawkey = getrawkey(seed.getbytes()); byte[] result = encrypt(rawkey, cleartext.getbytes()); return tohex(result); } public static string decrypt(string seed, string encrypted) throws exception { byte[] rawkey = getrawkey(seed.getbytes()); byte[] enc = tobyte(encrypted); byte[] result = decrypt(rawkey, enc); return new string(result); } public static byte[] tobyte(stri...

microsoft bits - Download image from a website using Batch -

i have .bat file supposed download image website , save somewhere on computer using bitsadmin, whenever try run it, error: display: job type: download state: error priority: normal files: 0 / 1 bytes: 0 / unknown unable complete transfer. error file: http://website.com/pictures/picture.png -> c:\ error code: 0x80190194 error context: 0x00000005 i have no idea means love it. here current code (the website in real code else, example) @echo off && set /p name=name: bitsadmin /transfer job /download /priority normal c:\users\user\downloads\%skin%.png c:\%name%.png pause thanks. solved. trying save in restricted save path.

Yodlee refresh on an already-active MFA account -

re: yodlee site -based api a) know when adding mfa account supposed trigger /jsonsdk/refresh/startsiterefresh. if account added , active, , want trigger manual refresh new data, /jsonsdk/refresh/startsiterefresh correct api use? b) when use /jsonsdk/refresh/startsiterefresh manual refresh, not want trigger whole mfa flow, want pull new data if possible. refreshmode specify "mfa" or "normal"? i ask this, because used "mfa" mode , failed 522 (timeout) error due new security question. when yodlee runs nightly refresh, same condition result in 506 or 518; not 522. maybe supposed specify "normal" "mfa" accounts manual refresh? you need not pass refresh mode in startsiterefresh api. when call api siteaccountid response tell if mfa required or not. below fields can used response. "siterefreshmode":{ "refreshmodeid":1, "refreshmode":"mfa" } depending on refreshmode ca...

ios - Flexible horizontal constraints between UIImageViews -

Image
i have layout 4 image views equi-distant each other in 1 row in screen shot below. widths , heights of image views proportional width , height of parent view. i have tried loads of combinations on constraints can never them equi-distant. best way tackle this?

Chrome Plugin: pop-up alert when some web elements changed after refreshing -

there available plugins chrome can act auto page refresher. if want check if specific elements in website have changed or not (e.g. element inside table) after refreshing, there available plugin can act (or firefox plugin)? or there way learn how develop such plugin? lot. p.s. no experience developing chrome plugin, little bit knowledge in c++ , java

github - Take local file to remote git forcefully -

every changes pushed except have file name completecontroller.cs c in upper case in in git repo showing completecontroller.cs c in lower case. you're on windows, hence filesystem case insensitive. hence can't trust case see on filesystem. to fix can try git mv -f <name-on-your-filesystem> <name_with_the_correct_case> so if understood clearly, should be git mv -f completecontroller.cs completecontroller.cs

Polymer 0.5 auto-binding template "template-bound" event 1.0 equivalent -

in polymer 0.5 auto-binding template fired "template-bound" event. document.queryselector('#app').addeventlistener('template-bound', function () {}) what polymer 1.0 equivalent? i have found solution this: update 1.0 syntax: template-bound > dom-change can see change in commit of starterkit https://github.com/polymerelements/polymer-starter-kit/commit/eba941318b2816a2e9285d4214eb9a1a937781c9

java - javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to resolve named mapping-file [hibernate.hbm.xml] -

i need add hibernate mapping resource file spring context. didn't know how can stuff? <context:annotation-config /> <bean id="myemf" class="org.springframework.orm.jpa.localcontainerentitymanagerfactorybean"> <property name="datasource" ref="projectmanagerdatasource" /> <property name="packagestoscan" value="com.ads" /> <property name="jpavendoradapter"> <bean class="org.springframework.orm.jpa.vendor.hibernatejpavendoradapter" /> </property> <property name="jpaproperties"> <props> <prop key="hibernate.hbm2ddl.auto">update</prop> <prop key="hibernate.dialect">org.hibernate.dialect.mysql5dialect</prop> <prop key="hibernate.show_sql">true</prop> ...

html - Make text in drop down menu white -

this website.. when hover on nav items , drop down list appears, want drop down list have white text permanently, not turn white. also if knows how make when hover on menu items black line appears under word not whole background of word goes black? http://opax.swin.edu.au/~9991042/ddm10001/brief_2/amalfi%20coast/www_root/ #nav { padding: 50px; width: 924px; height: 100px; float: none; } #nav ul { list-style: none; margin-left: 5px; width: 1000px; display: table; } #nav { text-decoration: none; color: #161717; } /*hide sub menu*/ #nav li ul { display: none; } /*show , position*/ #nav li:hover ul { display: block; position: absolute; margin-left: 0px; margin-top: 0px; } /*main nav*/ #nav li { width: 140px; font-size: 14px; display: inline-block; -webkit-transition: ease 0.3s; } #nav li:hover {} /*sub nav*/ #nav li li { color: white; display: block; background-color: black; font-siz...

c# - Like clause and prepared statement -

this question has answer here: parameterized queries , in conditions 4 answers i trying make sql request clause, using prepared statement. here code : using (sqlconnection connection = new sqlconnection(connectionstring)) { connection.open(); string query = "select top 10 field table field '@pseudopart%'"; using (sqlcommand command = new sqlcommand(query, connection)) { command.parameters.addwithvalue("@pseudopart", pseudopart); using (sqldatareader reader = command.executereader()) { if (!reader.hasrows) return possiblematch; while (reader.read()) { possiblematch.add(reader["field"].to...

Understanding queue arithmetic in data structures -

when element inserted in queue, rear = rear + 1 . when element deleted queue, front = front + 1 when queues implemented using arrays. now, initially, both front = rear = -1 indicating queue empty. when first element added, front = rear = 0 (assuming array 0 n-1). now, if assume condition front = 0 , rear = n-1 implying queue full. when few elements removed front pointer changes. let front = 5 , rear = 10 . hence, array locations 0 4 free. when wish add element now, add @ location 0 , front points it. locations 1, 2, 3 , 4 free. but, when next time try insert element, compiler throw error saying queue full. since front = 0 , rear = n-1 . how insert @ remaining locations , understand queuing arithmetic better? i understand how front = rear + 1 acts condition checking if queue full? you want think circularly here in terms of relative, circular ranges instead of absolute, linear ones. don't want hung on absolute indices/addresses of front , rear . they...

javascript - Archiving File on Client's Computer -

my problem need find way archive file uploaded client , placed folder onto client’s machine using web app created in c# asp.net. web app has upload feature in use sends file server , clients manually archive file, no work necessary on uploading automating archiving. from i've read online path of client side files uploaded cannot seen server due security web browser , servers cannot download file directory chooses other download directory determine client. is there way around these issues, i’ve heard rumors might possible using javascript although have no experience using javascript. thank time. check out demo zip.js project: http://gildas-lormeau.github.io/zip.js/demos/demo1.html you have in fact 3 options: zip on client side using js , upload server memory zip on client side using things running on client side java applet / flash or silverlight make click once application install browser zip files , upload server (probably elaborated... simple issue...

Create a new play scala project shows error in eclipse -

Image
i new play framework(scala) ,i created new project using activator new sample play-scala command, sample project name.then ran project using activator run command .when ran activator eclipse command showed [error] not valid command: eclipse (similar: help, alias) [error] not valid project id: eclipse [error] expected ':' [error] not valid key: eclipse (similar: deliver, licenses, clean) [error] eclipse so internet suggestions added addsbtplugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.5.0") this line sample project's plugins.sbt file.this fixed not valid command error when imported project eclipse showed object index not member of package views.html error please me fix error plugins.sbt // play plugin addsbtplugin("com.typesafe.play" % "sbt-plugin" % "2.4.0") // web plugins addsbtplugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0") addsbtplugi...

angularjs - Submit Form in Angular Modal -

i have modal lives in url /admin.brands/edit , here code: <%@page language="java" contenttype="text/html; charset=utf-8" pageencoding="utf-8"%> <%@taglib tagdir="/web-inf/tags" prefix="tags"%> <%@taglib uri="/web-inf/tlds/fields.tld" prefix="fields"%> <div class="row-fluid sortable"> <div class="box span12"> <div class="box-content"> <form class="form-horizontal" name="brandform" action='/admin.brands/update' data-toggle="validate" method="post"> <fields:form formname="brand.id.form"> <input type="hidden" name="brandid" value="{{item.brandid}}"/> </fields:form> <fields:form formname="brand.form"> <div class="section-hea...

android - Square SurfaceView(aspect ratio of 1:1) for a custom camera implementation (Like Instagram) -

i working on app @ moment. client requires camera preview square. tried overriding onmeasure in surfaceview implementation , setting @override protected void onmeasure(int widthmeasurespec, int heightmeasurespec) { super.onmeasure(widthmeasurespec, heightmeasurespec); setmeasureddimension(getmeasuredwidth(), getmeasuredwidth()); } this not work well, preview stretched or compressed. can guide me needs done 1:1 aspect ratio. have read getting supported preview sizes none of them in required 1:1 aspect ratio.

python - Pass expression as named argument name -

i´m using dateutil.relativedelta() has named arguments corresponding time_unit in age -tuple , code relative time looks like: def time_delta(age): = datetime.fromtimestamp(int(time.time())) if age.time_unit == "seconds": relative_time = - relativedelta(seconds=int(age.value)) elif age.time_unit == "minutes": relative_time = - relativedelta(minutes=int(age.value)) elif age.time_unit == "hours": relative_time = - relativedelta(hours=int(age.value)) elif age.time_unit == "days": relative_time = - relativedelta(days=int(age.value)) elif age.time_unit == "weeks": relative_time = - relativedelta(weeks=int(age.value)) elif age.time_unit == "months": relative_time = - relativedelta(months=int(age.value)) elif age.time_unit == "years": relative_time = - relativedelta(years=int(age.value)) is there way in python 2.7 make one-liner...

matlab - Simulink UDP Send Callback -

how can access callbacks "udp send" block (from instrument control toolbox) in simulink? i want send udp data fast available in simulink. after short amount of time running simulink model simulation stops "an asynchronous write in progress". send whenever status of block '{idle}', haven't found way access information. i tried write function myself in matlab script within simulink model, code generation not supported udp class. as far know, udp send block doesn't give access that. however, can use coder.extrinsic(function_name_1, ...) build own matlab block.

gruntjs - grunt-contrib-copy syntax for process option confusion -

Image
i'm trying replace placeholders in different files copy. gruntfile works fine, adding in process option replacements, it's not working. below relevant section of gruntfile: grunt.initconfig({ copy: { js: { files: [{ expand: true, cwd: 'src/wp-content/themes/pilau-starter/', src: ['**/*.js'], dest: 'public/wp-content/themes/pilau-starter/' }], options: { process: function ( content ) { console.log( content ); content = content.replace( /pilaubreakpointlarge/g, breakpoints.large ); content = content.replace( /pilaubreakpointmedium/g, breakpoints.medium ); return content; } } }, } }); the paths can understood in context of code on github: https://github.com/pilau/starter (the public directory isn't ...

How can I display a shared label on button click using highstocks? -

i using d3 , highstocks produce set of linked trends. have produced radar chart in d3 html5 range slider allowing travel along timeseries. my html5 range slider has date value in milliseconds. i can highlight points in highstocks this: vibchart.highcharts().series[0].data[index].setstate('hover'); vibchart.highcharts().series[1].data[index].setstate('hover'); vibchart.highcharts().series[2].data[index].setstate('hover'); vibchart.highcharts().series[3].data[index].setstate('hover'); vibchart.highcharts().series[4].data[index].setstate('hover'); but display shared tooltip series. how can that? i tried this: vibchart.highcharts().tooltip.refresh([vibchart.highcharts().series[1].points[index]]);

javascript - Change the x3dom model with a button click -

i have 2 x3d files namely 1.x3d , 12.x3d , want use button load them onto canvas code doesn't seem work . see loading icon in top left model doesn't change . here code : - <!doctype html> <html> <head> <meta http-equiv='content-type' content='text/html;charset=utf-8'></meta> <link rel='stylesheet' type='text/css' href='http://www.x3dom.org/x3dom/release/x3dom.css'></link> <script type='text/javascript' src='http://www.x3dom.org/x3dom/release/x3dom.js'></script> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(){ $("x3d > scene > inline").attr("url", "1.x3d"); }); }); </script> ...

Hiding android.R resources in Android Studio 1.3+ autocomplete -

Image
is possible configure android studio display @drawable resources inside project folder? the project i'm working on industry project , requires me use r resources. looking through as's 'code completion' section, didn't find setting allows hide sdk resources , use app/lib resources instead: the implemented feature, mentioned stefma, not works other way: allows library developers hide of resources aar package , show selected portion of resources, aka public recources . chris banes made intro in feature here .