Posts

Showing posts from April, 2011

unix - Give access to ec2 AWS user only to specific files -

i'm trying connect amazon using aws , user created in ec2. unfortunately, can't connect in filezilla user using key, default aws user. how should go this? if created user on ec2 command adduser use new user filezilla set password user passwd command. use same username/password combination filezilla to use filezilla ssh key pairs generate new key pair new user ssh-keygen command. put public part in new user's .ssh/authorized_keys file. ensure authorized_keys has correct permissions , owner. convert private key pem or ppk format , load filezilla see https://wiki.filezilla-project.org/howto

jquery - CSS - bevel square and turn -

Image
i need edit css square shown below. please advice how combine transform skew , rotate? from: to: my atempt: jsfiddle .square { background: #fff; border:2px solid red; height: 200px; width: 200px; margin:100px; transform: skewx(-30deg) rotate(45deg); } thanks let's consider need : rotate (z-axis) - square rotated @ 45° angle, need handle this. easiest angle notice. rotate (x-axis) - it's difficult discern exact angle need rotate backwards, may need play this angle right. applying transforms with being said, can use transform property along appropriate browser implementations of : .special-rotate { -ms-transform: rotatex(45deg) rotatey(0deg) rotatez(45deg); -webkit-transform: rotatex(45deg) rotatey(0deg) rotatez(45deg); transform: rotatex(45deg) rotatey(0deg) rotatez(45deg); } this give looks following example, should point can determine values looking : #square { margin: 0 auto; height: 200px;

multithreading - Ways to end a worker process in a thread in Python 3 -

i wondering ways end worker thread in python 3. if @ code sample this question worker has while true loop in , see q.task_done() called. why worker automatically ended? specifically interested in: what options exist end workers infinite loop? it seems options call break or return not sure if kill thread. to clear want thread die when task has completed , not see ways kill thread documented anywhere. #!python3 import threading queue import queue import time # lock serialize console output lock = threading.lock() def do_work(item): time.sleep(.1) # pretend lengthy work. # make sure whole print completes or threads can mix output in 1 line. lock: print(threading.current_thread().name,item) # worker thread pulls item queue , processes def worker(): while true: item = q.get() do_work(item) q.task_done() # create queue , thread pool. q = queue() in range(4): t = threading.thread(target=worker) t.daemon =

c# - Catch Exception and rethrow with a new message preserving actual type -

i have catch (exception ex) , change message, , rethrow it. if throw new exception(newmessage, ex); , lose runtime type of exception, right? if throw; , can keep runtime type message doesn't change. since i'm catching, don't know derived type ex may be, can't construct proper type. and of course, if throw ex; lose stack trace. is there way reformat message of ex , rethrow without losing stack or runtime type information, without resorting weird brittle reflection hacks? since have eliminated reasonable solutions problem, answer remains "no, can't this". message of exception read-only. cannot set using "brittle reflection hacks", since property virtual , therefore not required come backing field @ all, particular exception type. following class should demonstrate impossibility of demand: sealed class ozymandiasexception : exception { public override string message => "look upon message, ye mighty, , despa

Xcode header search path not working for an include relative to another header -

i have file in project #including header file #import "core.hpp" in header search paths, put path: ./opencv2.4.9/osx/include recursive and works, xcode can find core.hpp though don't reference in project. core.hpp 's full path is: ./opencv2.4.9/osx/include/opencv2/core/core.hpp the problem inside of core.hpp , there #include #include "opencv2/core/types_c.h" xcode cannot find header. i have played every build setting find, no avail. it's odd because have working in 1 of our projects, in new test project i'm making, can't seem work of build settings matching (as far can tell) this closest question find related mine: xcode 4 c++ header file relative path header but problem cannot change #include "opencv2/core/types_c.h" , because it's not header finally figured out. changed header search path to ./opencv2.4.9/osx from ./opencv2.4.9/osx/include i found modifying opencv header, ,

c# - Creating a new AuthorizationHandler/IAuthorizationRequirement that uses a service -

i trying create new authorization requirement, must use 1 of services declare in configureservices, , have no idea how pass service new requirement in same method declaring service. public class newrequirement: authorizationhandler<newrequirement>, iauthorizationrequirement { private irepository _repository; public newrequirement(irepository repository) { _repository = repository; } protected override void handle(authorizationcontext context, newrequirement requirement) { //code uses _repository here } } this works fine, when try add policy in startup.cs this: public void configureservices(iservicecollection services) { ... services.addsingleton<repositorycontext>(); services.addscoped<irepository, repository>(); services.configure<authorizationoptions>(options => { options.addpolicy("newrequirement", policy => policy.requirements

laravel array to string conversion (implode doesn't work) -

hi guys i'm having trouble update function in laravel (i'm not using relationship (hasmany belongto ) laravel's uses since it's learning project , didn't work used sql statement, error on $menu_id line public function update($session,$date, request $request) { /* * */ //fetch new plats edited $titles = $request->input('plats'); // fetch menu id $menu_id=$this->menu->menuid($session,$date); //$id=implode("",$menu_id); //dd($id); foreach ($titles $ds) { $plats_id=$this->menu->getplatsid($ds); db::update("update menu_items set id_plats='$plats_id' id_menu= '".$menu_id."' "); } i tried implode function gave me stdclass error thank public function menuid($session,$date){ return db::select(db::raw("select id menu

algorithm - Converting Kinematics Equations to Matlab -

Image
perhaps isn't programming question math question. here goes. imagine making roller coaster powered motor on vehicle. vehicles have fixed force value can achieve using motor. in section of roller coaster want traverse half loop 1 one of favorite video games: rollercoaster tycoon! as go around half loop, don't know speed or how long take go around it. however, can figure out based on engine acceleration, mass, , acceleration due gravity maximum possible acceleration @ point along half loop be. let's not muddle discussion numbers, instead assume we've got acceleration vs position curve available. looks this: i have derived formula velocity function of acceleration vs position curve , initial velocity. kinematic equation v^2 = 2*a*p i can derive velocity function of position. v = sqrt(2 * [integral of a=f(p) wrt position]) which in matlab can doing: v = sqrt(2.*abs(trapz(pos, acc))); i getting velocity of every point along track following code (acc ,

html - next and previous buttons using php -

this question exact duplicate of: implementing next , buttons slideshow 2 answers i'm reposting question because got 1 answer didn't work or @ all. i'm trying make php slideshow , i'm done need implement next , buttons thought going easy, apparently can't increment indexes in php? $sql = "select pic_url pic_info"; $result = $conn->query($sql); $count = 0; $dir = "http://dev2.matrix.msu.edu/~matrix.training/holmberg_dane/"; $source = "gallery.php"; if ($result->num_rows > 0) { // output data of each row $pic_array = array(); while ($row = $result->fetch_assoc()) { $pic_array[$count] = $row['pic_url']; $count++; } $index = 1; echo "<img src= ' $dir$pic_array[$index]' />"; echo "<a href= '$dir$pic_array[$index + 1]'&

python - fastest way to change texte appearance in a QTextEdit object -

for python3/pyqt4 project, i'm looking fastest way change text appearance of several words in qtextedit object. text not written in html (it's pure text string), read-only , made of several words. each word has special 'attribute' defined in code, defining appearance when word hovered over. the appearance of words sharing same attribute must change when 1 of these words hovered over. i need speed since : i did more or less same program the words' appearance changed when user clicked on them , guess code slow used hover events. (see details below) it's python project based on pyqt4, not c++ 1 based on qt. any appreciated ! more details : i can see 2 ways achieve goal : (1) write text in editor, detect word mouse "flies over", other words highlighted , painfully select them, 1 one, inserting html code modify appearance. it's painfully part find complex , slow : there fastest way ? (2) writing text html 1 , work css since qtex

python - looping over a dataframe and fetching related data from another dataframe :PANDAS -

i have dataframe having transaction data of customers. columns mailid,txn_date,city. have situation have consider customer's 01jan2016 , each of mailid in have fetch txn data base file , considering last 12 month data(txn date between last txn date , -365days timedelta) finding out max transacted city name. sample base dataframe #df maild txn_date city satya 2015-07-21 satya 2015-08-11 b satya 2016-05-11 c xyz 2016-06-01 f satya 2016-06-01 satya 2016-06-01 b as need cust 2016-01-01 did d = df[['mailid', 'txn-date']][df['txn_date'] >= '2016-01-01'] now each mailid in d have fetch each of last 12month transaction data base dataframe df , calculate max city transacted. using loop like x = d.groupby(['mailid'])['txn-date'].max().reset_index() #### finding last transacted date find out 12 month date x['max_city'] = 'n' ## giving default value 'n' idx,row in x.iterrows(

jsf - Two h:commandButton in the same h:form: one works, the other doesn't -

i have .xhtml piece of code: <h:inputtext value="#{boardmbean.logintoadd}"/> <h:commandbutton action="#{boardmbean.adduser}" immediate="true" process="@this" value="adicionar"/> (...) <h:commandbutton action="#{boardmbean.edit}" value="salvar" class="btn btn-large"/> the second h:commandbutton works fine, i.e., submits form correctly. in other hand, first, instead of calling adduser() method boardmbean , refresh page , nothing happens. i'm using jsf 2.2 , application running on jetty. managed bean is: import java.io.serializable; import javax.faces.bean.managedbean; import javax.faces.bean.requestscoped; import javax.faces.bean.viewscoped; @managedbean(name="boardmbean") @requestscoped public class boardmbean extends generalcontroller<board> implements serializable { /** login of new user of board. */ private string logintoad

sql - Tools to cleanup a mySQL database that is already normalized? -

i have mysql database, need cleanup data in. i looking see if there tools clean normalized tables @ 1 time. example: user table includes codes make , model make table has makes consolidate model table has models consolidate doing manually nightmare: change references in model table (example delete redundant models "b" , "c", leaving model "a" now users referencing models "b" or "c" need manually changed reference model "a" changing make more difficult, since models have moved remaining make , user tables updates, etc. are there tools out there make simple, perhaps graphical? presumably make , model each have id , description, , there several make , model records either identical or equivalent descriptions consolidate. if descriptions identical, write update statement set foreign key column equal first id of primary key column based on join on description. if descriptions not

c++ - Is for(auto i : unordered_map) guaranteed to have the same order every time? -

when iterate on std::unordered_map range based loop twice, order guaranteed equal? std::unordered_map<std::string, std::string> map; std::string query = "insert table ("; bool first = true; for(auto : map) { if(first) first = false; else query += ", "; query += i.first; } query += ") "; query += "values ("; first = true; for(auto : map) { if(first) first = false; else query += ", "; query += i.second; } query += ");" in example above, resulting string should in form. therefore, important both times, order of iteration same. insert table (key1, key2, key3) values (value1, value2, value3); is guaranteed in c++? the iteration order of unordered associative containers can change when rehashing result of mutating operation (as described in c++11 23.2.5/8). not modifying container between iterations, order not change. although specification doesn't explicitly state rehashin

App Engine: Using f1-micro instance but getting billed for g1-small instance -

we have flexible environment (node.js) running 1 f1-micro (1 vcpu, 0.6 gb memory) instance. when @ billing history, can see billed "compute engine small instance 1 vcpu" price of g1-small instance. we're still in 60 days free trial period, still using credit. but i'm wondering why billed g1-small instance if using f1-micro? to answer own question: got billed "compute engine micro instance burstable cpu" (f1-micro) correctly end of month. seems there delay between consumed , shown under "costs in month". app.yaml: runtime: nodejs env: flex manual_scaling: instances: 1 resources: cpu: .5 memory_gb: 0.90 disk_size_gb: 10 skip_files: - ^(.*/)?.*/node_modules/.*$ env_variables: ...

cocoa touch - Is initWithNibName and initWithCoder method of UIView or UIViewController? -

it seems saw them in both. funny given not inherit 1 another. have common ancestor, 1 owns initwithcoder , iniwwithnibname? so gives? also in uiviewcontroller reference class initwithcoder not mentioned @ all -(id)initwithcoder:(nscoder *)adecoder { //nsstring * superclass =nsstringfromclass([self superclass]) ; self = [self initwithnibname:nil bundle:nil]; if (self) { } return self; } questions should start search in reference docs. initwithnibname:bundle: method of uiviewcontroller , no other class (other classes extend uiviewcontroller ). initwithcoder: method declared in nscoding protocol. class (and there many) conform nscoding protocol have initwithcoder: method. both uiview , uiviewcontroller implement nscoding protocol means both classes have initwithcoder: .

Deploying to Azure Web App from Travis CI -

i trying deploy solution travis azure web app. i've followed this post , created local git repository deployment in azure, deployment credentials. i have in .travis.yml deploy: provider: azure_web_apps skip_cleanup: true verbose: true which gives error error: unable push unqualified destination: master destination refspec neither matches existing ref on remote nor begins refs/, , unable guess prefix based on source ref. i have dug around, , found need call git push origin master:refs/heads/master in order initialise repository, i've no idea put in .travis.yml i write whole git push part myself, seems negate purpose of travis azure functionality. very late answer here, imagine solution add following .travis.yml : before_deploy: "git push origin master:refs/heads/master"

python - How to avoid the impact of verbose logging? -

how can 1 buffer verbose logging statements (i.e. logging.debug("...") ) until end of python process? require custom logger? my current setup uses config file similar scott's (windows python2.7)

sql - SQLite renumber ID using cycle -

hello have table many inserted row. need renumber row id , order them. i have found code not work me. set @i = 100; update "main"."categories" set id = (@i := @i +1) "name" = "white"; alter table "main"."categories" auto_increment = 1 so using code above expected renumbered records have name - white , start insert them 100 increment 1. not work me. maybe there problem in code maybe difference between sql , sqlite query. this how created table: create table categories (id integer primary key, name text, free numeric) i hope there made solution how because don't want manually :) that code not standard sql. sqlite not have many programming constructs because designed embedded database more natural have logic in host language. if want in sql, try following: first, create temporary table have autoincrement column can used counting: create temporary table new_ids(i integer primary key, old_id inte

node.js - Using var in nodejs to search a json file -

this question has answer here: dynamically access object property using variable 10 answers so im trying search json file tried , didn't return value. var info = json.parse(body); // file website var itemforjson = item.market_hash_name; // item name try use in json depitems[i].value = parseint(info.itemforjson); // has number use parseint(info[itemforjson]) on last line.

excel VBA - Macro to click to the next page in IE -

i cannot figure out how click "next 100" button on page: http://www.sec.gov/cgi-bin/browse-edgar?action=getcompany&cik=0000898293&type=&dateb=&owner=exclude&count=100 specifically section: <form> <table border="0" width="100%"> <tbody><tr> <td>items 1 - 100&nbsp;&nbsp;<a href="/cgi-bin/browse-edgar?action=getcompany&amp;cik=0000898293&amp;type=&amp;dateb=&amp;owner=exclude&amp;start=0&amp;count=100&amp;output=atom"><img src="/images/rss-feed-icon-14x14.png" alt="0000898293 filings" border="0" align="top"> rss feed</a></td> <td style="text-align: right;"> <input type="button" value="next 100" onclick="parent.location='/cgi-bin/browse-edgar?action=getcompany&amp;cik=0000898293&amp;type=&amp;dateb=&

.htaccess - Redirect user to different site using apache rewrite rule -

i working on specific condition on production environment need redirect user third part in case specific url. i aware rewrite rule can used case, came across redirect in apache can used if resource moved server. can 1 me understand correct way this, want use url 'www.mysite.com/some/optional parameter/testpage' , mysite.com/some/optional parameter/testpage redirect http://testpage.mysite.com/ #with redirect redirect "www.mysite.com/testpage" "http://testpage.mysite.com/" redirect "mysite.com/testpage" "http://testpage.mysite.com/" is correct way achieve or need take different approach. you cannot use redirect directive matching host name in request. better use mod_rewrite , 301 redirect. rewriteengine on rewritecond %{http_host} ([^.]+\.[^.]+)$ [nc] rewriterule (?:^|/)(thepact)/?$ http://$1.%1 [l,nc,r=301]

javascript - Remove prefix from string with .split results in Unexpected token ILLEGAL -

i have string strange prefix , i've tried using split function return array after slash character "\". string: i:0#.w|itun\allepage_fg this tried: function claimorder(){ var user = $().spservices.spgetcurrentuser({ fieldname: "name", debug: false }); var trimuser = user.split("\"); $().spservices.spfindpeoplepicker({ peoplepickerdisplayname: "napa user", valuetoset: trimuser[1], checknames: true }); } i error: unexpected token illegal you need escape backslash inside string literal: var trimuser = user.split("\\"); in future, when error that, tell relevant line. case obvious, won't be.

android - Why does a new Gradle build start whenever I run Espresso tests? -

whenever attempt run espresso test android studio (typically right-clicking on test/class/package , selecting 'run tests'), android studio kicks off new build , installs new apk when no changes made. naturally, makes debugging failing ui tests time consuming procedure. has encountered problem , fixed it? android instrumented unit test should put test java files in app/src/androidtest/java/your.package.name directory, not test folder https://developer.android.com/training/testing/unit-testing/instrumented-unit-tests.html

javascript - Node.js connect-multiparty catch Error: maximum file length exceeded -

i want limit file upload size , inform user exceeding limit, don't know should catch error. limit setting: var multipart = require('connect-multiparty'); var multipartmiddleware = multipart({ maxfilessize : 2 * 1024 }); upload post: app.post('/upload', multipartmiddleware, function (req, res) {

Rails assets is having issues with my fonts -

both locally , in heroku having issues fonts. rails 4.2.5.1 my fonts in app/fonts folder: /app/assets/fonts/fontawesome-webfont.eot /app/assets/fonts/fontawesome-webfont.svg /app/assets/fonts/fontawesome-webfont.ttf /app/assets/fonts/fontawesome-webfont.woff /app/assets/fonts/fontawesome-webfont.otf the error message: started "/assets/fonts/fontawesome-webfont.ttf?v=4.2.0" ::1 @ 2016-06-01 22:12:24 -0400 actioncontroller::routingerror (no route matches [get] "/assets/fonts/fontawesome-webfont.ttf"): actionpack (4.2.5.1) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call' web-console (2.3.0) lib/web_console/middleware.rb:28:in `block in call' web-console (2.3.0) lib/web_console/middleware.rb:18:in `catch' web-console (2.3.0) lib/web_console/middleware.rb:18:in `call' actionpack (4.2.5.1) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call' railties (4.2.5.1) lib/rails/rack/logger.rb:38:in `call_app&

Matplotlib not recognized as a module when importing in Python -

i've been attempting install matplotlib graphing project in python. in accordance recommendation matplotlib website, installed anaconda pre-packaged python distributor. anaconda seems have installed correctly. install matplotlib, typed in command line: pip install matplotlib which brings multiple messages stating: "requirement satisfied." when in python script typed: import matplotlib.pyplot plt i received error message stating: importerror: no module named matplotlib.pyplot i'm using old windows xp operating system. i've looked everywhere help, , have tried installing matplotlib numerous times via command line! appreciated... thank you!! make sure version of pip corresponds version of python. 1 way following: python -m pip install matplotlib the -m module means in site-packages python pip module. you can do: >>> import sys >>> print("\n".join(sys.path)) to list path understood python, check whether

php - Yii CCaptcha "Get New Code" doesn't show -

i have view uses renderpartial: $this->renderpartial('mybankinfo', array('userentity'=>$userentity, 'useraccount'=>$useraccount, 'bonuspaymentmethodlist'=>$bonuspaymentmethodlist, 'modelcaptcha'=>$modelcaptcha) ,false,true); here's captcha code in view: <?php $this->widget('ccaptcha',array('clickableimage' => true)); ?> it works when using render not when im rendering in partial. there doesn't seem error on console, when clicked on image, refresh function called image isn't refresh nor "get new code" link appears. however when refresh page, image refreshed (if clicked on in once). is there particular js need reload? i've set process true though.

VBA Excel object required passing string array variable -

i attempting pass array of strings function variable , getting '424 object required' error when try compare values in array values in given cell. new vba may simple syntax error cannot seem figure out. here's code: method being called: sub initializecharts() 'set's array checking data names in social groups dim socialarray variant socialarray = array("chores", "meat & potatos", "work", "wind down", "reward") '... call chartlogic(range("'activitytracker'!b12"), range("'groups'!f4"), socialarray) end sub chartlogic method: sub chartlogic(datacell range, tablecell range, socialarray variant) dim temp double dim count integer '... 'loops through table , looks social cells same name, adding them chart until isempty(datacell) count = lbound(socialarray) ubound(socialarray) if socialarray(count).valu

image - Android Fatal Signal 11 from XML -

i creating android app , have yet run out of memory until now. part confusing not way expect run out of memory. i added new linear layout layout xml file. had background of image 40kb large. other images loaded approximately 12kb background being larger @ 120kb. when image loaded receive fatal signal 11 on runtime. if removed background layout work fine. changed image smaller, (2000x600) before 14kb. works fine. clear 26kb causing problem... what kind of precautions should take ensure doesn't happen again. quality images , 2000x600 might excessive it's app phone guidelines should follow? is there memory usage cap can extended or should stay under? also, if loaded many images on scrollview cause app crash? have had many images loaded @ once have never had crash before, i'm confused error being caused little memory usage. (in todays terms @ least.) regards, jake images not consume same amount of memory in ram on disk. can ram usage by: wid

jquery - How can I have impromptu not continue until submit is done and exits -

i'm using jquery impromptu library , not understanding async nature of it. i've got code below want redirect after prompt run. don't want next line of code execute if data.redirectpage statement true. success: function (data) { if (data.redirectpage == "hackathonregistration") { $.prompt("your code has been accepted , redirected hackathon registration page", { submit: function() { window.location.href = "/register/hackathon"; } }); } from read fast impromptu , code looks ok. except missing } close success function... ;) and no buttons on submit try trigger. that important and. try : success: function (data) { console.log(data.redirectpage); if (data.redirectpage == "hackathonregistration&quo

c# - SetAccessControl giving error as An unhandled exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll -

i need set access control folder my code private sub cmdapplyrestrictions_click(sender object, e eventargs) handles cmdapplyrestrictions.click dim mydirectoryinfo new directoryinfo(txtfolder.text) dim mydirectorysecurity directorysecurity = mydirectoryinfo.getaccesscontrol() dim user string = system.environment.userdomainname + "\" + cmbuser.selecteditem.tostring() mydirectorysecurity.addaccessrule(new filesystemaccessrule(user, filesystemrights.read, accesscontroltype.deny)) mydirectoryinfo.setaccesscontrol(mydirectorysecurity) messagebox.show("permissions altered successfully") end sub the line mydirectoryinfo.setaccesscontrol(mydirectorysecurity) is giving exception an unhandled exception of type 'system.unauthorizedaccessexception' occurred in mscorlib.dll i logged in user administrative rights not administrator need block access users including logged in user user including administrator later when progra

java - Removing spaces between letters and double spaces between words -

i need remove spaces between letters , make double spaces single spaces between words. so (double spaces between words): h e l l o m y n m e s b o b will need become this: hello name bob i've tried temp = "h e l l o m y n m e s b o b" temp = temp.trim().replaceall("\\s", ""); removes spaces. i managed make work doing: temp = temp.replace(" ", "."); temp = temp.replace(" ", ""); temp = temp.replace(".", " "); simpler way of doing it. you should use regex \s(?!\s). says space doesn't have space after it. this used this: temp = "h e l l o m y n m e s b o b"; temp = temp.replaceall("\\s(?!\\s)", ""); system.out.println(temp); outputs : hello name bob hope helps :)

sql - Deleting duplicates rows from redshift -

i trying delete duplicate data in redshift table. below query:- with duplicates (select *, row_number() on (partition record_indicator order record_indicator) duplicate table_name) delete duplicates duplicate > 1 ; this query giving me error. amazon invalid operation: syntax error @ or near "delete"; not sure issue syntax clause seems correct. has faced situation before? redshift being (no enforced uniqueness column), ziggy's 3rd option best. once decide go temp table route more efficient swap things out whole. deletes , inserts expensive in redshift. begin; create table table_name_new select distinct * table_name; alter table table_name rename table_name_old; alter table table_name_new rename table_name; drop table table_name_old; commit; if space isn't issue can keep old table around while , use other methods described here validate row count in original accounting duplicates matches row count in new. if you're doing constant

Ansible playbook with serial > 1 and run_once -

i writing simple 2 task ansible playbook download update file internet , push managed servers, similar to: - hosts: serial: 10 tasks: - name: download update file get_url: url=http://f.q.d.n/path/to/file dest=/tmp/ connection: local run_once: true - name: copy update file servers copy: src=/tmp/file dest=/path/to/file mode="..." first task supposed run once on localhost, rest run in 10 serial batches. according ansible documentation, tasks marked "run_once" ran on 1 host in each serial batch. i can't use workaround mentioned in documentation, using inventory_hostname in conditional, since actual target hosts may different, e.g. restricted --limit etc. what proper way design playbook? pre_task of use here ? - hosts: localhost tasks: - name: download update file get_url: url=http://f.q.d.n/path/to/file dest=/tmp/ - hosts: serial: 10 tasks: - name: copy update file servers copy: src=/tmp/file dest=/pa

verilog - Code for non-resetable flop -

is acceptable way code non-resetable flop ? input clk; input b; output a; reg a= 1'b0; always_ff @ (posedge clk) if(b>a) a<=b; non-resettable flops used everywhere.....! the technical advantage of resettable flop can reach " known " state in finite machine using single transition on reset pin else might have go through multiple cycles on clock reach known state. this needed when power on chip. there trade off between "no of cycles needed" area 1 has pay resettable flops. moreover, mentioned at page . in case of flops without set/reset pin, output deterministic if input d in known stable state @ arrival of clock , satisfies setup , hold requirement. during initial power up, output of such flops not initialized , in unknown state, treated x in digital simulation. remains x till first clock edge comes , along comes functional stable value @ input. following implementation in verilog , yours in sv acceptable, @ (posedg

c++ - Rebuild a dynamic library upon parameter addition to function -

got question regarding dynamic libraries in c++, have dll number of other dlls linking , want add parameter 1 of exported functions in dll. need rebuild of dlls linking new lib or ones call specific function? help appreciated! rebuild required ones call specific function got new parameter. lib of dll helps in resolving names used in executable/other dll linked dll . executables/dlls not call function (inside of dll) signature has been changed, not required rebuild. but practice "whenever possible", consistency point of view, every 1 using newer version of of dll should rebuild.

android - Error in displaying data after fetching it from the Sqlite DataBase -

throwing fatal error while going display message using textview.. iam using program sets loger also.it run upto logger="lastmark". private void displaytext(string message){ logger.info("inside display message"); textview textview = (textview)findviewbyid(r.id.name_1); logger.info("last mark"); textview.settext(message); } public void callstatus(){ logger.info("inside 3 rd step"); database = databasemanager.instance(); logger.info("inside 4 rd step"); //to data database need cursor. //after perform select query data database specific query, in cursor // "*" means "all" in translation query means "select name table" cursor = database.select("select * " + table_name); logger.info("inside 4b rd step"); string s =""; logger.info("inside 5 rd

python - How to pass the content of list one element at a time to a method? -

i have libnmap scanner script works collecting eip aws , scanning them 1 one, function collects eip looks : def gather_public_ip(): access_key = config.get('aws','access_key') secret_key = config.get('aws','secret_key') regions = regions = ['us-west-2','eu-central-1','ap-southeast-1'] all_eip = [] region in regions: client = boto3.client('ec2',aws_access_key_id=access_key,aws_secret_access_key=secret_key,region_name=region,) addresses_dict = client.describe_addresses() eip_dict in addresses_dict['addresses']: if 'privateipaddress' in eip_dict: print eip_dict['publicip'] all_eip.append(eip_dict['publicip']) print all_eip return all_eip this function returns me list looks ['22.22.124.141', '22.21.149.191', '22.11.132.122', '22.11.227.241', '22.34.28.112', &#

dynamics crm - CRM 2011 Field Security based on attribute value -

i have situation want use field security when attribute on record value. entity contact , there bit attribute called vip. when user opens record , vip value true , not in vip team user cannot see fields marked field security. is possible write plugin this, or there better solution? you connect form's onload event , check user's teams , vip field , show other fields accordingly. not sure if there's easier way teams, odata request option: http://msdn.microsoft.com/en-us/library/gg334767.aspx command this: var userid = xrm.page.context.getuserid(); var cmd = "/teammembershipset?$select=teamid&$filter=systemuserid eq guid'" + userid + "'"; to set fields' visibility, have @ link: http://danielbergsten.wordpress.com/2011/02/15/crm-2011-javascript-for-hiding-a-field-based-on-another-fields-value/

cuda - How to perform Hadamard product with CUBLAS on complex numbers? -

i need compute element wise multiplication of 2 vectors (hadamard product) of complex numbers nvidia cublas. unfortunately, there no had operation in cublas. apparently, can sbmv operation, not implemented complex numbers in cublas. cannot believe there no way achieve cublas. there other way achieve cublas, complex numbers ? i cannot write own kernel, have use cublas (or standard nvidia library if not possible cublas). cublas based on reference blas, , reference blas has never contained hadamard product (complex or real). hence cublas doesn't have 1 either. intel have added v?mul mkl doing this, non-standard , not in blas implementations. kind of operation old school fortran programmer write loop for, presume didn't warrant dedicated routine in blas. there no "standard" cuda library aware of implements hadamard product. there possibility of using cublas gemm or symm , extracting diagonal of resulting matrix, horribly inefficient, both computation ,

angular - Angular2 - bind ngModel to a reference of a property -

i have long list of user inputs, , store these in object instead of spelling them out in html. want bind these values object stores user/customer's data. preferably using ngmodel due simplicity , functionality. anyone knows how can achieve this? example below (not working). @component({ template: ` <div> <h2>ngmodel example</h2> <div *ngfor="let input of inputlist"> {{ input.label }} <input type="text" [(ngmodel)]="input.bindto"> </div> </div> <p>this not working: {{customerinfo.name}}, {{customerinfo.email}}</p> `, directives: [...] }) export class appcomponent { inputlist = [ { label: "enter name", bindto: this.customerinfo.name // tried 'customerinfo.name' }, { label: "enter email", bindto: this.customerinfo.email } ] customerinfo = { name: 'test',

Needed more information about Paypal Notify URL -

how paypal run url specified in notify_url? able session in notify_url created @ time of checkout in website? if want pass session data notify url (which ipn solution) need either send data in custom parameter of button or api request string, or save of data in database record, send id of database record in custom parameter. that way custom parameter again have same value within ipn script can pull out of database processing.

javascript - Getting around asynchronous ajax get -

so have function - ipgeocoding = (data) -> coords = [] finish = _.after(data.length, (coords) -> console.log coords return coords ) _.each(data, (datum) -> $.ajax( url: "http://freegeoip.net/json/#{datum}" type: 'get' success: (result) -> lat = result.latitude lon = result.longitude pair = [lat, lon] coords.push(pair) finish(coords) ) ) it's being called if @model.get('data')? if @model.get('func')? @points = @model.get('func')(@model.get('data')) however, @points undefined. want @points coords when console.log coords run(which array of length). i'm using _.after because want build coords results of multipl async calls. how coordinates in coords? you've left out callback parameter ipgeocoding the other answer . you're supposed doing this:

Typescript files not showing in Angular 2 CLI project using chrome web developer tools -

Image
i have generated typescript project using angular2 cli (ember cli). using chromium web developer tools debug. have "enable javascript source maps" selected in developers tools settings. see .js files , .ts listed in sources view. however, .ts (typescript) files show empty when select them i.e can't find them. screen print showing situation: i can see text of .js files if select them. the .ts files not copied dist directory, , seems problem me, i've seen examples elsewhere showing typical angular2 cli dist structures , not have .ts files either. relevant portion of "tsconfig.json" showing have source mapping enabled: 1 "compileonsave": false, 2 "compileroptions": { 3 "declaration": false,

bluegiga - BGScript: Conversion of string into integer -

i have android app sends data ble113 module. receive data through gatt characteristic of type 'user'. able data strings. when send integers, 24, receive string '24'. there anyway can convert string number integer type? this gatt.xml. <characteristic uuid="xxxxx-xxxx-xxxxx-xxxx-xxxxxxxxxx" id="configuration"> <description>config register</description> <properties read="true" write="true"/> <value type="user" /> </characteristic> this snippet android side write integer value '1'. string str = "1"; try { byte[] value = str.getbytes("utf-8"); chara.setvalue(value); } catch (unsupportedencodingexception e) { e.printstacktrace(); } . . . boolean status = mbluetoothgatt.writecharacteristic(chara); i want receive data integer '1' in bgscript side. doing wrong conversion? please me send integers. has g

html - Css : Scale background color of a div -

i have div , want have background-color of div scaling after hover did following: li { background-size: 0 0; transition: background-size 2s ease-in; -moz-transition: background-size 2s ease-in; -web-kit-transition: background-size 2s ease-in } li:hover { background-size: 100% 100%; background-color: rgba(0, 0, 0, 0.1); } i want achieve similar effect toolbars buttons hover on website: http://www.materialup.com/posts/material-admin you need add :before element through css desired result. demo li { width: 40px; height: 40px; float: left; margin-right: 5px; background: white; } li:before { content: " "; transition: 255ms ease-in; -moz-transition: 255ms ease-in; -webkit-transition: 255ms ease-in; transform: scale3d(0, 0, 0); -webkit-transform: scale3d(0, 0, 0); width: 40px; height: 40px; float: left; background-color: rgba(0, 0, 0, 0.1); opacity: 1; } li:hover:before { transform: scale3d(1, 1, 1); opaci

html - Is `position: fixed` on `<body>` problematic? -

on spa mobile devices , desktop browsers need set position: fixed on <body> avoid ios' overflow/rubberband scrolling. position: fixed , modifications on <body> hacky , risky cause problems. this why wanted clarify: are there known problems / caveats / things watch out (i.e. stacking context, z-indexing context, static/relative/absolute/fixed positioning on children) / ... when adding position: fixed <body> the "position: fixed" relates "element" positioned relative browser window. webpage browser zooming affected it. ie6 , below break it. perhaps better as: html, body { height: 100%; overflow: auto; } body .element { position:fixed; bottom: 0; } then html: <body> <div class="element"> (everything else inside here) </div> </body>

javascript - How to create popup new window browser with small size -

i tried create link, if clicked popout new windows browser small size, tried code <p>click button open new browser window.</p> <button onclick="myfunction()">try it</button> <script> function myfunction() { window.open("http://www.w3schools.com"); } </script> the result success move other link opened in new tab on parent browser, tried create link opened in new window browser small size. you can set height , width. window.open("http://www.w3schools.com", "", "width=200,height=100"); to set position center. var dualscreenleft = window.screenleft != undefined ? window.screenleft : screen.left; var dualscreentop = window.screentop != undefined ? window.screentop : screen.top; var width = window.innerwidth ? window.innerwidth : document.documentelement.clientwidth ? document.documentelement.clientwidth : screen.width; var height = window.innerheight ? window.innerheight : doc

c# - How to use HttpContext.Current.Session in static property of a abstract class.? -

i have controllerbase abstract class , below. using system.web; using system.web.mvc; public abstract class controllerbase : controller { public static string sesssionid { { return httpcontext.current.session["sessionid"]; } } } i getting error "object reference required non-static field, method, or property 'system.web.mvc.controller.httpcontext.get" however have used same in other static classes , have not got above error. i wonder how httpcontext being accessable not current. could clarify me, wrong above. your base class controller specifies httpcontext property itself. so, when using in derived class controllerbase , compiler thinks want refer property of base class. you either make property non-static, wudzik suggested in first comment. guess cleaner way it. if need keep property static, have tell compiler, want use httpcontext class of namespace system.web : public static string sesssionid {

Azure signing up from Iran -

i'm iran when try sign azure, asks me enter phone number prefix, iran not in combo box can't verify phone number. do? there way sign up? you should use vpn or proxy server , when chose country ... rightclick on select box , inspect element , chanege country code +98 , try it if way not working... contact family @ uk or usa or accepted countries ... , use phone number... :( fa: dadash ma irania bad bakhtim dige...

deploying war on weblogic 12.2 without Jersey -

i have war application wrapped in ear deployment in weblogic. not using jersey @ in code, unless 3rd-party jar somehow refers without knowledge, , have metadata-complete="true" attribute in web.xml. the application deploys fine on weblogic 12.1, on weblogic 12.2 there error message: <2-jun-2016 9:48:42 o'clock idt> <error> <j2ee> <bea-160228> <appmerge failed merge application. ifils. see error message(s) below.> weblogic.utils.compiler.toolfailureexception: com.sun.jersey.server.impl.inject.abstracthttpcontextinjectable @ weblogic.application.compiler.flowdriver.handlestatechangeexception(flowdriver.java:55) @ weblogic.application.compiler.flowdriver.nextstate(flowdriver.java:38) @ weblogic.application.compiler.appmerge.runbody(appmerge.java:146) @ weblogic.utils.compiler.tool.run(tool.java:159) @ weblogic.utils.compiler.tool.run(tool.java:116) @ weblogic.application.compiler.appmerge.merge(appmerge.java:158)

validation - How to Validate Negative BigDecimals in scala play Framework FORMS? -

i want validate (do not allow) negative amount values , in post request following validation trait have form mapping, bigdecimal has precision , scale, how make sure of negative bigdecimals coming in request? trait bicvalidation extends commonvaldidation { implicit val bicform = form( mapping( "id" -> optional(number), "name" -> text, "description" -> optional(text), "bid" -> optional(number), "amount" -> bigdecimal )(bic.apply)(bic.unapply) ) } try "amount" -> bigdecimal.verifying("amount must negative", => < 0) and see docs .

c# - How to use TDD when your method is designed to perform many tasks -

i'm still trying follow path tdd. let's have sunsystembroker triggered when file uploaded shared folder. broker designed open file, extract records it, try find associated payments in systems , call workflow! if want follow tdd develop ibroker.process() method how shall do? note: broker independent assemblies inheriting ibroker , loaded console app (like plugins). this console in charge of triggering each broker! public interface ifiletriggeredbroker : ibroker { filesystemtrigger trigger { get; } void process(string file); } public class sunsystempaymentbroker : ifiletriggeredbroker { private readonly idbdatasourcefactory _hrdbfactory; private readonly iexceldatasourcefactory _xlfactory; private readonly ik2datasourcefactory _k2factory; private ilog _log; public void process(string file) { (...) // _xlfactory.create(file) > extract // _hrdbfactory.create() > find // compare records

If hasClass condition not working jquery -

i trying find out how show/hide element depending on fact whether element ".question a" has class "checked" or not. isn't working. knows why ;( ? $().ready(function() { var mylink = ".question a"; if (mylink.hasclass('checked')) { $('.answer').show(300); } else { $('.answer').hide(300); } }); try like $(document).ready(function() { var mylink = $(".question a"); if (mylink.hasclass('checked')) { //you can use $(this).hasclass $('.answer').show(300); } else { $('.answer').hide(300); } }); if want change status of link call same while event triggered like $(mylink).on('click',function(){ if ($(this).hasclass('checked')) { $('.answer').show(300); } else { $('.answer').hide(300); } });