Posts

Showing posts from May, 2012

asp.net core mvc - Angular2 component without view annotation -

i able use angular2 client-side databinding on server-rendered pages (asp.net mvc6). is possible without adding @view template? instead of defining inline or creating external template, enclose block of server-rendered html app element. how did in angular1, allows me choose whether databind on server-side or on client-side. thanks. you can similar, want. take example: import {component, view, bootstrap} "angular2/angular2"; @component({ selector: "app" }) @view({ template: "<content></content>" }) export class app { public name: string; constructor() { this.name = "myname"; } } bootstrap(app); the template has special content <content></content> represents ngtransclude directive. allow add content inside app tag: <app> <h1>hello world</h1> </app> unfortunately still poorly undocumented , changing it's hard tell actual limitations or

sql - Strange behavior OFFSET ... ROWS FETCH NEXT ... ROWS ONLY after ORDER BY -

i see strange behavior of construction select ... order ... offset ... rows fetch next ... rows i made simple example display (sql server version: 2012 - 11.0.5058.0 (x64) ): create table #temp( c1 int not null, c2 varchar(max) null) insert #temp (c1,c2) values (1,'test1') insert #temp (c1,c2) values (2,null) insert #temp (c1,c2) values (3,'test3') insert #temp (c1,c2) values (4,null) insert #temp (c1,c2) values (5,null) first query: select * #temp order c2 desc result ok: 3 test3 1 test1 2 null 4 null 5 null second query: select * #temp order c2 desc offset 0 rows fetch next 3 rows result has sorting: 3 test3 1 test1 4 null and last query: select * #temp order c2 desc offset 3 rows fetch next 3 rows result strange , invalid in opinion (i need 2 records not contains in previous result, instead record id=4 second time): 4 null 2 null can explain why sql server works strange? use unique key column type

vba - find and replace using macro in the subject of an active email -

i have mis produces automated email work instructions. have manipulated crystal report make order acknowledgement , replace words in subject "work instruction '1234' 'date' etc" "order acknowledgement '1234' 'date' etc". i want click macro button have added 'compose email' screen this here have tried, doesn't work. sub orderack() dim ordack string dim newmail outlook.mailitem set newmail = application.activeinspector.currentitem ordack = replace(newmail.subject, "works instruction", "order acknowledgement") newmail.subject = ordack newmail.subject = display end sub to edit subject line try following option explicit sub orderack() dim olitem object dim ordack string dim snew string dim newmail outlook.application set newmail = application set olitem = newmail.activeexplorer.selection.item(1) ordack = replace(olitem.subje

android studio - Getting Genymotion to run with homebrew/cask installed VirtualBox -

i tried genymotion running through android studio virtualbox installed through homebrew cask. when trying launch genymotion through android studio using genymotion device manager button in toolbar, error genymotion: initialize engine: failed in event log, seems error related when virtualbox isn't installed. running genymotion on own outside of android studio works fine. i able fix uninstalling virtualbox cask , reinstalling .dmg provided virtualbox themselves. that's fine me right now, wondering how 1 cask-installed virtualbox linked android studio. make sure have installed homebrew . brew cask install virtualbox brew cask install genymotion

iphone - iOS - Detect Blow into Mic and convert the results! (swift) -

i need develop ios app in swift detects blow in microphone user. has challenge-game 2 players have blow iphone mic 1 after other. decibel values should measured , converted in meter or kilometer can determine winner. player "blows further" (player1: 50km, player2: 70km) wins. is possible implementation? i have code in swift , don't know how proceed: import foundation import uikit import avfoundation import coreaudio class viewcontroller: uiviewcontroller { // @iboutlet weak var mainimage: uiimageview! var recorder: avaudiorecorder! var leveltimer = nstimer() var lowpassresults: double = 0.0 override func viewdidload() { super.viewdidload() let url = nsurl.fileurlwithpath("dev/null") //numbers automatically wrapped nsnumber objects, simplified [nsstring : nsnumber] var settings : [nsstring : nsnumber] = [avsampleratekey: 44100.0, avformatidkey: kaudioformatapplelossless, avnumberofchannelskey: 1, avencoderaudioqualitykey: avaudioqualit

jboss - Losing plus sign in native JPA query -

i have native sql query in switchyard project (select sysdate + interval '720' minute dual) however, when jboss server executes query plus sign has disappeared trace (select sysdate interval '720' minute dual) how can escape plus sign appears part of native query.

python - Passing cdef class object as argument to cdef method -

in cython, possible pass cython cdef class object instance argument cdef method. example if have below class: # foo.pyx cdef class foo: def __cinit__(self, double arg): self.arg = arg def get_arg_sqr(self): return self.arg * 2 # bar.pyx foo cimport foo cdef exec_foo(foo foo): cdef double sqr = foo.get_arg_sqr() how achieve ? # test.py foo import foo import bar foo f = foo(2.33) exec_foo(f) exec_foo should def not cdef if want access outside cython code. in notebook following seems work (without pyd/pyx files) in opening cell import cython %load_ext cython in next cell: %%cython cdef class foo: cdef double arg def __cinit__(self, double arg): self.arg = arg def get_arg_sqr(self): return self.arg * 2 def exec_foo(foo foo): cdef double sqr = foo.get_arg_sqr() return sqr in final cell. f = foo(1.0) exec_foo(f)

Javascript: How to create an object from a dot separated string? -

edit: modifying phrasing since not homework question. people downvoting should ashamed. ;) i ran potential scenario posed few of employees test question. can think of couple ways solve problem, neither of them pretty. wondering solutions might best optimization tips. here's question: given arbitrary string "mystr" in dot notation (e.g. mystr = "node1.node2.node3.node4") @ length, write function called "expand" create each of these items new node layer in js object. example above, should output following, given object name "blah": blah: { node1: { node2: { node3: { node4: {}}}}} from function call: mystr = "node1.node2.node3.node4"; blah = {}; expand(blah,mystr); alternately, if easier, function created set variable returned value: mystr = "node1.node2.node3.node4"; blah = expand(mystr); extra credit: have optional function parameter set value of last node. so, if called function "expand" , cal

javascript - Show current day in the title of jquery datepicker -

Image
how can show current full date in title of jquery datepicker : 05 july 2015 because show me july 2015 i couldn't find non-hacky way of doing it, changing defaults config text want show might you: var defaults = { monthnames: ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december' ] }; var today = new date(); var month = today.getmonth(); defaults.monthnames[month] = today.getdate() + ' ' + defaults.monthnames[month]; $.datepicker.setdefaults(defaults); here working plnkr: http://plnkr.co/edit/gfp95vochd4fhqoktil3?p=preview

c++ vector elements access -

i trying create vector datatype have defined in class vector<mydatatype> myvector; but when try access elements in vector using loop for(int i=0; i<myvector.size();i++) i error message telling vector out of range debug assertion failed line 932! this code vector <road_segment> unvisited;//the vector (i = 0; i<unvisited.size(); i++) { cur_node = unvisited[0];//current node visit find_node_neighbers(cur_node.end_station.id, end, t_r); when try comment loop don't error message any appreciated this line: cur_node = unvisited[0]; should be: cur_node = unvisited[i]; otherwise, access first element on , over. but if need perform action on each element, should use foreach loop instead: for (const road_segment& cur_node : unvisited) { // i'm guessing "neighbers" typo, that's in question find_node_neighbers(cur_node.end_station.id, end, t_r); } this allows avoid problems indices , such. or if ne

android - How to save full instances of Activities and hence prevent reloading for each start? -

my android app converts website mobile application. design follows: navigation drawer containing different categories of posts per website. each option different activity. designed baseactivity (with navigation drawer initialisations) other activities extend, each activity has navigation drawer. (i not use fragments) each activity calls json parser load posts website , hence takes upto 5 seconds load. the problem activities/screens once opened not stay in memory when called time. for example: home screen --> category 1 screen --> home screen causes home screen load second time , hence takes additional 5 seconds. how can keep full (or @ least partial) instance of @ least 3 activities in memory avoid nuisance? i call super.oncreate(savedinstancestate) each activity restarts beginning. for example: home screen --> category 1 screen --> home screen causes home screen load second time , hence takes additional 5 seconds. add appropriate fl

opencv - Runtime error in Visual Studio C++ debug mode, but not in release; code used to work -

in summary, wrote code. ran fine in both debug , release mode. added code. started getting error. commented out new code. continued same error, though worked. discovered bug cropped in debug mode - runs fine in release. the error is: first-chance exception @ 0x748f4598 in speed3calib1.exe: microsoft c++ exception: cv::exception @ memory location 0x005ec350. if there handler exception, program may safely continued. i stepped through , found section gives me trouble (i've added exception handling since first asked question). here section gives me trouble. try { calibratecamera(object_points_vector, test_image_points_vector, test_image.size(), intrinsic, distortion_coefficients, rvecs, tvecs, calibration_flags); } catch (cv::exception &e) { std::cerr << "exception: " << e.what() << std::endl; return 0; } the new weirdness never goes catch block, still throws error. since first asking, stumbled on box t

c++ - Google Native Client Visual Studio Add-in: Webserver fails to start because arguments to httpd.py are invalid -

i have application turned simple native client app year ago, , i've been trying running again. however, when try run it, or of example vs projects, web server fails start, giving me usage hints httpd.py, , saying "httpd.py: error: unrecognized arguments: 5103". i wasn't able find on nacl guide or on net. troubleshoot issue if see script starts webserver, have no idea stored. the script start server 'nacl_sdk\pepper_43\tools\httpd.py'. problem port argument being formated incorrectly. the expected format is: httpd.py [-h] [-c serve_dir] [-p port] [--no-dir-check] but, received arguments formatted add-in is: ['--no_dir_check', '5103'] where port prefix missing , should '-p 5103' for quick fix, add following line parser.add_argument('args', nargs=argparse.remainder) before parse_args(args) in main(args) method in httpd.py. this keep unknown arguments being parsed , use default value port instead (

rust - How can I return something from HashMap.get’s None case? -

i'm wondering best practice handle none result in getting values hashmap . given have simple function: pub fn get_value(&self, value: string) -> &string { one value hashmap unwrap : my_map.get(&"hello".to_string()).unwrap() but don’t want panic if gets none . else can do? match self.os_config.get(&value) { some(val) => return &val, none => //?? cannot return string::new().. temporal? } for starters, &string type should never exist in signature; should take more general &str . string owned string, while &str string slice. because string implements deref<target = str> , &string coerces &str . when dealing hash map keys, should take &str rather &string , , should avoid taking string if need &str ; don’t need consume string. can index hashmap<string, _> &str fine. the type of string literal &'static str ; &'static str quite happily coerc

javascript - Scrolling overflowed divs with ajax -

i know there similar posts, couldn't find single answer in of them has worked me. want new messages scroll bottom it's not doing it. here's script show_messages.js: i have div named 'show-messages' set overflow: auto $(document).ready(function() { // grab id html attribute var uid = $('#message').attr('name'); setinterval(function() { // load messages userid $('#show-messages').load('show_messages.php?uid=' + uid); $("#show-messages").scrolltop = $("#show-messages").scrollheight; }, 500 ); }); does have ideas causing not scroll down? scrolltop function of jquery objects calling property. however, scrollheight not, it's property on html element. access (first) html element jquery object, use $()[0] . also, should cal after load finishes $('#show-messages').load('show_messages.php?uid=' + uid, function () { $("#show-me

c++ - Linker error : undefined reference to -

this question has answer here: what undefined reference/unresolved external symbol error , how fix it? 27 answers i wrote program static variable. however, getting following error : [linker error] c:/users/prcm/documents/practice/junk.cpp:8: undefined reference `x::a' here code #include <iostream> using namespace std; class x { public: static const int a; public: static int geta() { return a; } }; int main() { cout<< x::geta()<< endl; return 0; } it's right, have never defined x::a . put following line after class declaration: const int x::a = 0;

php - Google Analytics Measurement Protocol Event results as Realtime visitor from United States -

currently making custom event trigger php , using measurement protocol. i had validate event - , "valid": true. see event in real-time reports. when testing event , when check analytics real-time have visitor not country/city, 1 more united states/new york. so if on site , chill`n ... see 1 user in real-time correct location (me). when trigger specific event working on - have 1 more real-time visitor united states/new york. ?? i cant explain self.. these request parameters: $data['v'] = 1; $data['tid'] = 'ua-xxxxxx-x'; $data['cid'] = '5sd5asdshfsd53sdfdd25sd54fgdsfg49dd854'; $data['uid'] = '100'; $data['t'] = 'event'; $data['ec'] = 'registration'; $data['ea'] = 'form'; $data['el'] = 'user data'; $data['ev'] = 1; $data['dh'] = 'mydomain.com'; $data['ds'] = 'web'; someone got problem and/or solution?

c# - Winform showing another application inside a PictureBox -

first, state understand problem similar running application inside picturebox , application runs .exe fine instead not nest inside picturebox. in c# winforms application attempting run calc.exe inside picturebox, 75% of time application runs calc.exe own window. my code below. enter code hereprivate void preview_button_click(object sender, eventargs e) { if (activewindows_listbox.selecteditem == null) { messagebox.show("there no window selected take picture of.", "insufficient data"); return; } process p = process.start("calc.exe"); thread.sleep(500); p.waitforinputidle(); setparent(p.mainwindowhandle, viewingscreen_picturebox.handle); } from understanding of trying starting calc.exe application native windows, telling application wait calculator initialize self tell calculator picturebox parent of calculator. that leaves question, there missing making ap

eloquent - Laravel 5 nested relationship -

i have 3 tables, with: user: id | name products: id | name | user_id tracks: user_id | product_id relationships between these models (tables) are: //user.php************************************************* public function products() { return $this->hasmany('app\product'); } public function track() { return $this->hasmany('app\track'); } //product.php************************************************* public function user() { return $this->belongsto('app\user'); } public function track() { return $this->belongsto('app\track'); } //track.php************************************************* public function products() { return $this->hasmany('app\product'); } public function user() { return $this->belongsto('app\user'); } track table used if user want track product. kind of bookmark. so, when i'am on product page, $product = app\product::find(1) , if want echo user name, $produc

Meteor OAuth Add/Pass Query Params to /oauth/authenticate (Twitter "force_login") -

i'm creating package allow connect multiple same service accounts , need force user login account @ popup window every time (do not authenticate automatically) twitter has option "force_login" parameter when using meteor.loginwithtwitter twitter docs i can't find way of using meteor, looked creating own twitter/accounts-twitter package seems it's deeper inside oauth packages , gets messy figure out or how can that. have ideas? it not possible yesterday, it's possible today. opened pull request in meteor repository adding functionality: https://github.com/meteor/meteor/pull/5693 meteor.loginwithtwitter({ force_login: true }, ...); note it's not merged yet , soon.

How to create a method that can make class variables in python? -

let's want make object has method adds variables function. example lets have object called obj. when write obj.create_var("sample_variable"), can call obj.sample_variable. want method takes name of variable parameter , creates variable on object. how write method? def createvar(self, name, value): setattr(classname, name, value)

c# - Can we use global.asax file in DotNet class library projects -

can use global.asax file in .net class library projects? because have not seen anywhere global.asax file can used web based applications. the code of global.asax file being complied , being called .net framework when application starts. want use similar kind of functionality class library i.e. when class library being loaded in memory application_start of global.asax file of class library called. i know can used using static constructor want utilize global.asax this. any suggestions/comments highly appreciated.. thanks the global.asax file feature of asp.net appliations. not available in dlls (class library projects). there no standard way (using c#) of running code on assembly-load, though clr seems have such feature. have @ this question more information , ideas. example, 1 answer mentions tool called injectmoduleinitializer , run post-build step inject module initializer method .net assembly. here's short excerpt blog post introducing injectmodu

Making bash script with command already containing '$1' -

somewhere found command sorts lines in input file number of characters(1st order) , alphabetically (2nd order): while read -r l; echo "${#l} $l"; done < input.txt | sort -n | cut -d " " -f 2- > output.txt it works fine use command in bash script name of file sorted argument: & cat numbersort.sh #!/bin/sh while read -r l; echo "${#l} $l"; done < $1 | sort -n | cut -d " " -f 2- > sorted-$1 entering numbersort.sh input-txt doesn't give desired result, because $1 in using argument else. how make command work in shell script? there's nothing wrong original script when used simple arguments don't involve quoting issues. said, there few bugs addressed in below version: #!/bin/bash while ifs= read -r line; printf '%d %s\n' "${#line}" "$line" done <"$1" | sort -n | cut -d " " -f 2- >"sorted-$1" use #!/bin/bash if goal write bash scri

php - method="post" enctype="text/plain" are not compatible? -

when use <form method="post" enctype="text/plain" action="proc.php"> form data can not sent proc.php file properly. why? problem? why can't use text/plain encoding post can use method? [revised] the answer is, because php doesn't handle (and not bug): https://bugs.php.net/bug.php?id=33741 valid values enctype in <form> tag are: application/x-www-form-urlencoded multipart/form-data the first default, second 1 need when upload files. @alohci provided explanation why php doesn't populate $_post array, store value inside variable $http_raw_post_data . example of can go wrong text/plain enctype: file1.php: <form method="post" enctype="text/plain" action="file2.php"> <textarea name="input1">abc input2=def</textarea> <input name="input2" value="ghi" /> <input type="submit"> </form> file2.php: &

javascript - Bootstrap 3 navigation list items hover issue -

i have tryed example: html <div class="container"> <nav class="navbar navbar-default" role="navigation"> <!-- brand , toggle grouped better mobile display --> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse"> <span class="sr-only">toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> </div> <!-- collect nav links, forms, , other content toggling --> <div class="collapse navbar-collapse navbar-ex1-collapse"> <ul class="nav navbar-nav"> <li><a href="#">lin

playframework - Errors viewing the scala html templates in Play -

Image
i getting started play framework, hardly converted play-java project eclipse project , imported eclipse ide eclipse required additional plugin, tried downloading scala ide has play supportive plugins inbuilt , imported project, works. but when open 2 default html files, index.scala.html , main.scala.html, editor shows errors shown below. how resolve these setup issues? using latest play framework play 2.4.2 , scala ide downloaded file name: scala-sdk-4.1.0-vfinal-2.11-win32.win32.x86_64 this known problem, there issue on github still open. linked issue discussion on scala-ide-user group several possible solutions offered in form of replacement .jar 's. i'd keep eye on 2 links when fixed.

sql - SSIS Derived Column Expression -

i have below derived expression timestamp in ssis (dt_dbtime)(substring([column 11],1,2) + ":" + substring([column 11],3,2) + ":" + substring([column 11],5,2)) but it's not taking null values tried 1 isnull ( [column 11] ) ? "000000" : (dt_dbtime)(substring([column 11],1,2) + ":" + substring([column 11],3,2) + ":" + substring([column 11],5,2)) but still not working. can on this? the error posted in question bit misleading. the actual error produced in ssdt : the data types "dt_wstr" , "dt_dbtime" incompatible conditional operator. operand types cannot implicitly cast compatible types conditional operation. perform operation, 1 or both operands need explicitly cast cast operator. and ofcourse 1 posted @ end: error @ data flow task [derived column [18]]: computing expression "(isnull([column 0]) ? "000000" : (dt_dbtime) (substring([column 0],1,2) +

Python: Establishing List with List Comprehensions or Iterators -

i am trying improve coding, , algorithm performance replacing for loops list comprehensions, generators, , iterators. i having hard time rapping head around how implement tools in itertools , , appreciate give. i trying initialize list value 0 range of indices. here 2 ways came with: count_list = [0 index in range(4 ** k)] and total_index = list(range(4 ** k)) count_list = [0 index in total_index] (k represents integer of the number letter in word made of 4 letter alphabet) when timed code in python 3.4 , turned out first, using generator faster method when looking @ in isolation, when had reuse 4 ** k index loop, methods ended timing @ same speed. what have been struggling figure out how can use iterator replicate initialization. know if wanted create list of of numbers in index use list(range()) or use index_list = [index index, values in enumerate(words)] i not sure how assign value 0 each element using that. i wondering how might use list comprehensio

excel vba - SQL Query Automation Error -

i trying run query search data in microsoft access , running bit of problem. error occurs on line rec.open sqlquery, conn and reads "run-time error '-2147217900 (80040e14)': automation error" sub query21st() ' create file path reference string 21st data dbpath = database_path() ' create connection string dim connstring string connstring = "provider=microsoft.ace.oledb.12.0;" & _ "data source=" & dbpath & ";" & _ "persist security info=false;" 'create connection connection string above dim conn new adodb.connection conn.open connstring ' create sql command string dim lookupfields string lookupfields = "cert.[avgle]" dim sqlquery string sqlquery = "select " & lookupfields & " [certificates] cert " & _ "where [dob] =" & [dob_21st] & " , [certificatedate] =&qu

android - What is purpose of permission ACCESS_MTK_MMHW -

i went through existing code of app.there 1 permission in manifest file: android.permission.access_mtk_mmhw .i searched on google didn't satisfactory answers.can 1 please tell purpose of permission. there easy way discover permission grants access to. try install application in cellphone. when popup appears describing permissions app needs, pay attention every 1 of them. in case, based on i've searched, mtk refers mediatek , manufacturer of eletronic chips. unfortunately there little none information on internet mmhw , must hardware provided company , app needs permission use (lucky guess?).

sql server - How to seach in C# sql database by LIKE -

i have table , want search in table. select tbphonebook.* tbphonebook fname @fanem in tbphonebooktableadaptor , , use : private void search_click(object sender, eventargs e) { tbphonebooktableadapter.search(this.test4dataset.tbphonebook, textbox1.text); } and works fine, when searches word, words contain search expression shown. for example there these names in database: ali , alireza , soheil , soheilyou , .... in current search if user searches ali program show him ali while alireza contains ali search criteria! in php use : select * tbphonebook fname "%$fanem%" but don't know syntax in c# security concerns aside, use concatenated string query like: "select tbphonebook.* tbphonebook fname '%"+textbox1.text+"%'" an example more secure way avoid sql injections can find here: sql parameters

python - How to set javascript variable to flask template variable using javascript -

i want set javascript variable value flask template variable in javascript. trying $(document).on("click", ".prepopulate", function () { var mybookid = $(this).data('id'); alert(mybookid); // value showing proper {% set tempvar = 'mybookid' %} alert ({{tempvar}}) }); but it's giving error instead (undefinederror: 'list object' has no attribute 'mybookid'). way set template variable in javascript using javascript variable? you want use set this: %set{"tempvar" value="mybookid"}%

.htaccess - url rewrite rule for urls that contain // in them -

ive got bit of issue site indexed google. seo people have pointed out domain has been indexed double // @ end of domain portion , causing duplicate records in google. have checked server side components , appears configured correctly. example www.domainname.com//shop/products this renders quite nicely on screen, seo guys reporting issue. rewriterule ^//(.+)$ /$1 [r=301,nc,l] is rule have applied, there appears no change in browser, still generates www.domainname.com//shop/products we using helicon ape product rewrites wondering if should visible user on screen or handled on server side? you can try : rewriteengine on rewritecond %{the_request} //([^\s]+) [nc] rewriterule ^ /%1 [r,l]

javascript - How to use Hogan in django template -

is possible include following in django html file? <!-- hit template --> <script type="text/template" id="hit-template"> <div class="hit media"> <a class="pull-left" href="{{ url }}"> <img class="media-object" src="{{ image }}" alt="{{ name }}"> </a> <div class="media-body"> <h3 class="hit_price pull-right text-right text-danger"> ${{ saleprice }} </h3> <h4 class="hit_name">{{{ _highlightresult.name.value }}}</h4> <p> {{{ _highlightresult.shortdescription.value }}} </p> <ul class="hit_tags list-inline"> {{#_highlightresult.manufacturer}}<li>{{{ _highlightresult.manufacturer.value }}}</li>{{/_highlightresult.manufacturer}} {{#_highlightresult.category}}<li>{{{ _highlightres

python - Add column of empty lists to DataFrame -

similar question how add empty column dataframe? , interested in knowing best way add column of empty lists dataframe. what trying initialize column , iterate on rows process of them, add filled list in new column replace initialized value. for example, if below initial dataframe: df = pd.dataframe(d = {'a': [1,2,3], 'b': [5,6,7]}) # sample dataframe >>> df b 0 1 5 1 2 6 2 3 7 then want end this, each row has been processed separately (sample results shown): >>> df b c 0 1 5 [5, 6] 1 2 6 [9, 0] 2 3 7 [1, 2, 3] of course, if try initialize df['e'] = [] other constant, thinks trying add sequence of items length 0, , hence fails. if try initializing new column none or nan , run in following issues when trying assign list location. df['d'] = none >>> df b d 0 1 5 none 1 2 6 none 2 3 7 none issue 1 (it perfect if can approach work! maybe trivial missing

Meteor package dependency - Added automatically or Not -

i trying use rajit:bootstrap3-datepicker in project. project page on atmosphere list jquery dependency of package. does meteor add jquery when run command meteor add rajit:bootstrap3-datepicker or have separately add jquery meteor add jquery note: .meteor/packages not show jquery 1 of added packages. jquery listed dependency in rajit:bootstrap3-datepicker package.js , why automatically added app without need explicitly add yourself. .meteor/packages listing app direct dependencies, not dependencies implied packages you're using.

rsync doesn't copy *only* modifications -

i'm using rsync backup files. choose rysnc because (should) use modification times determine if changes have been made , if files need updated. i started backup (from computer system (debian) portable external hard drive) command: rsync -avz --update --delete --stats --progress --exclude-from=/home/user/scripts/exclusionrsync --backup --backup-dir=/media/user/hdd/backups/deleted-files /home/user/ /media/user/hdd/backups/backup_user it worked , took lot of time. believed second time quick (since didn't modify files). unfortunately, 2nd, 3th, 4th, ... times took long first one. still see files being copied if these files in portable hard drive. i don't understand why rsync doesn't copy modifications (rsync known efficient , copy changes , specificly call --update option). a side effect of problem files moved backup dir (deleted-filed) transfered. indeed, rsync delete previous file before copy same file during each update... i found solution readi

Excel Open 2 Workbooks at the same time -

i have workbook open vba coding. there several different userforms input data , reports out of workbook. it seems while workbook open, , active, cannot open, @ and/or edit, unrelated excel spreadsheet through windows explorer. 1 of users asked me if while program running if @ (without closing active workbook) different spreadsheet. has nothing coding such request active workbook, more convenience i.e. not having close 1 , open one. is there can facilitate request? there vba code can use in active workbook allows or gives excel permission open more 1 workbook? i think you'll find when userform or other excel dialog-based object open, cannot "double-click" on workbook open, excel busy , focus on open dialog screen. however, if start instance of excel (start -> programs -> microsoft excel) , open workbook within new instance, work additional workbooks.

html - Media queries in my css do not work -

i have issues media queries. seems not work in either browser. tried in opera, chrome, firefox. page http://amatalents.com/about-us.html , media-queries main div section @media screen , (min-width: 150) , (max-width: 400) { .windows div { width: 100%; display: table-column; } .windows div { font-size: 10px; color: green; } .windows { background-color: red; } } i validated css file , first time did fine , mentioned css parser error reffering media queries part of file, second time referred media queries without mentioning parser error. lost... please help! you missing px. @media screen , (min-width: 150px) , (max-width: 400px)

jquery - javascript getElementById start with -

i want select div start * change display: block display:hidden function select_to_text(a) { var = '#' + a; var aa = $(as).val(); if (aa == "0") {} else { //var $eles = $(":*[name^='personal_family_type_']").css("background-color","yellow"); document.getelementbyid(a + "_" + aa + "_block").style.display = 'block'; } } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="form-group"> <label for="personal_family_type" class="control-label col-sm-2">type</label> <div class="col-sm-10"> <select size="1" id="personal_family_type" name="personal_family_type" class="form-control btn btn-primary" onchange="select_to_text('personal_family_type')"> <option valu

algorithm - What is the most efficient to count trailing zeroes in an integer? -

normal way is int main(){ int a=2000,count=0,temp; while(a!=0) { temp=a%10; if(temp==0) count++ else break; a/=10; } printf("%d",count); } is there more efficient way ? for 32-bit integer (maximum value 2147483647) need maximum of 4 tests. 64 bits add 1 more test 16 zeros. start larger powers of 10 , work down: int counttrailingzeros(int n) { int zeros = 0; if((n % 100000000) == 0) { zeros += 8; n /= 100000000; } if((n % 10000) == 0) { zeros += 4; n /= 10000; } if((n % 100) == 0) { zeros += 2; n /= 100; } if((n % 10) == 0) { zeros++; } return zeros; } this has better worst-case performance, if 9/10ths of numbers pass have no trailing zeros average case worse. depends on values passing in typical case. however, if 9/10ths of numbers pass have no trailing zeros shouldn't worry optimizing original code in first pla

javascript - Having Issue On Bootstrap 3 SlideDown() hidden Element -

can please take @ this demo , let me know why change() function not able slidedown() hidden element in bootstrap 3? here code have $(function() { $('input:radio').change(function() { if($(this).val()== 'dog') { $('#hidden-list-1').slidedown(); } if($(this).val()== 'bird'){ $('#hidden-list-2').slidedown(); } }); }); as other answers have mentioned issue boostrap has style .hidden{ display: none !important; } one way solve removing hidden class. $('#hidden-list-1').hide().removeclass('hidden').slidedown(); here demo https://jsfiddle.net/dhirajbodicherla/zzdl5jp7/3/

java - Why implement Comparable interface when you can define compareTo method in a class? -

this question has answer here: is there more interface having correct methods 17 answers you can define compareto method in class without implementing comparable interface. benefits of implementing comparable interface? the benefit of implementing interface methods require object implements comparable interface. gives them guarantee object you're passing has compareto method correct signature. there's no way in java have method require object implement given method (such compareto ) in , of itself. around this, interfaces created. time have object know comparable , know can call compareto on it.

google spreadsheet - Retrieve value of cell below, based on horizontal search of cell rows above -

i'm using google sheets. have spreadsheet has horizontal row of dates @ top. i'm attempting search horizontal date row today, , return value of cell vertically below header. if today's date found in "h1" return value of "h24", if today's date found in "y1" return value of "y24" etc , on. i've tried =vlookup , =hlookup , can't , semblance of results aren't error. any @ appreciated, i'm excel/sheets novice. does formula work want: =filter(a24:z24,a1:z1=today()) if current data in cell h1 formula should output contents of cell h24

ios - AutoLayout with ScrollView in Swift -

i have joined ios develepors world. have questions. i don't understand auto layout scrollview. im tried every kind method everytime seen different size , different location (button). i want create scrollview (hortizonal) on 12 buttons iphone models. should do? write details. thank much. it's pretty easy, have methodic constraints add. start outside constraints , start adding inner ones. check out tutorial wrote implementing uiscrollview + auto layout in swift. if have doubt, ask me :) https://www.dribba.com/blog/2015/07/21/scrollview-autolayout-ios8-swift/

python - function that checks the length of the cycle -

hey guys have function, gives me error when test it. have idea on how fix exercise. please read through. write function cyclelength(array), returns number of students form loop, given start talking left-most one. input array list of non-negative integers, such array[m] number of student whom student m redirects. no student redirects himself. left-most student number 0, next number 1, , on. each element in list in range [0, n-1] n length of list. example, suppose list [1, 3, 0, 1]. student 0 redirects student 1, redirects student 3, redirects student 1. there loop of 2 students: 1, 3. answer 2. note though started student 0, not part of loop. here function: def cyclelength(m): lst = [] = 0 while not in lst: lst.append(i) = int(m[i]) b = len(lst) - lst.index(i) return b you got right. >>> def cyclelength(students): ... seen = [] ... current = 0 ... # run till have seen students ... while len(seen) != len(st

winforms - can a BackgroundWorker object in c# be ran without a Windows Forms? -

i need develop c# application using **backgrounworker** , without using windows forms . i've seen examples presented microsoft regarding use of backgrounworker class, , they're developed windows forms. can use backgroundworker without windows forms ? if so, please provide detail. in advance ! in c# there can use tasks or threads both used run in background in separated execution context ( separated thread ) this simple example using thread using system.threading; // creating new thread , pass delegate run thread thread = new thread(new threadstart(workthreadfunction)); // command start thread thread.start(); public void workthreadfunction() { // background work }

cordova - Ionic Issues With iOS 9 Beta -

i'm running ionic app on ios 9 beta, runs ok - randomly when click button take me next view, go new view , take me previous view. when click button in header, take me previous view , forward again. it's working fine on latest stable version of ios , android. is else has experienced ios 9 beta? there fix? this issue has been addressed , angular team. have created patch should work. https://github.com/driftyco/ionic/issues/4082 http://blog.ionic.io/preparing-for-ios-9/

direct3d11 - I need some clarification with the concept of "Spaces" (world space, view space, projection spaces, local spaces and screen spaces) (c++, direct3d 11) -

so far, understand these spaces define aspect of games' 3d world. view space camera, , define creating matrix contains camera position, camera target , "up" direction of camera. this done in code follows... xmmatrix cameraview; xmvector cameraposition; xmvector cameratarget; xmvector cameraup; /* describing matrix */ cameraposition = xmvectorset(0.0f, 0.0f, -0.5f, 0.0f); cameratarget = xmvectorset(0.0f, 0.0f, 0.0f, 0.0f); cameraup = xmvectorset(0.0f, 1.0f, 0.0f, 0.0f); /* creating matrix*/ cameraview = xmmatrixlookatlh(cameraposition, cameratarget, cameraup); i have hard time trying visualize in head. in simple terms.. "enabling" player move around @ creating cameraview ? (assuming 3d world created) can explain me happening here first suggestion: new directxmath , direct3d, should take @ directx tool kit , simplemath wrapper in particular. save lot of distraction here. when render object, there

html - Bootstrap 3: Can 'row' and 'col-xx-xx' classes be assigned to non-block leven elements? -

is advisable give bootstrap 3 classes non-block level elements such span? best practices in area? still see answer question anywhere. since bootstrap classes specifies css properties listed below, technically possible use them on non-block elements, have additionally set display: block; these elements. don't think advisable, html elements must used taking in account of purpose, described in html w3c standard. for .row: margin-left margin-right for col-xx-xx: position min-height padding-left padding-right width

c++ - Why is the push_back method of vector not working? -

i want put in elements in vector. till date have used way of inserting elements in vector , has worked. not know why not working today. world::world() { collisionmap.loadfromfile("collisionmap.png"); for(int i=0; i<collisionmap.getsize().y; i++) { for(int j=0; j<collisionmap.getsize().x; j++) { if(collisionmap.getpixel(j,i)==sf::color(0,0,0)) { cout<<"test"<<endl //prints collisionlist.push_back(sf::floatrect(j*32, i*32, 32, 32)); } } } cout<<collisionlist.size(); //shows nothing } edit: i forgot mention :- 1.i using sfml. 2. collisionlist vector. 3.this code compiles without problem. 4.the size of collisionmap not 0 since collisionmap.getsize() returns accurate value. cout<<collisionlist.size(); //shows nothing of course. puts stuff in buffer, doesn't output anything. try: cout<<

Combined standard error function in R -

basically, have several experiments ( site s) spanning on course of several years, each year own mean , standard error (based on several replicates each), , want calculate grand mean , standard error each site . grand mean seems straight-forward (average means?) grand standard error less intuitive me. how can create function calculate grand se use dplyr? simplified version of data below: > print(tbl_df(df), n=40) source: local data frame [76 x 8] site year myc co2 n anpp anpp.se nyears 1 placerville 1991 ecm elev nlow 0.8100 0.14000 3 2 placerville 1991 ecm amb nlow 0.5400 0.07000 3 3 placerville 1992 ecm elev nlow 53.1200 11.83000 3 4 placerville 1992 ecm amb nlow 26.9000 3.28000 3 5 placerville 1993 ecm elev nlow 1068.3000 183.80000 3 6 placerville 1993 ecm amb nlow 619.0000 118.90000 3 7 placerville 1991 ecm elev nhigh 1.5700 0.26000 3 8 placerville 1991 ecm

android - RecyclerView not generating list when it has a view above it -

so cannot make recyclerview generate given list once have view above it. view above , recycler view both within linearlayout , single child of nestedscrollview (used collapsing toolbar). once recyclerview view in fragment works expected. stockscompletelistfragment.java public class stockscompletelistfragment extends fragment { @nullable @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { nestedscrollview sv = (nestedscrollview) inflater.inflate( r.layout.fragment_stocks_completelist, container, false); linearlayout mylinear = (linearlayout) sv.findviewbyid(r.id.mainlinear); recyclerview rv = (recyclerview) mylinear.findviewbyid(r.id.recyclerview); if (rv == null){ toast.maketext(getactivity(),"null", toast.length_short).show(); } setuprecyclerview(rv); return sv; } private void setuprecyclerview(recyclervi

ios - SKScene getting slower after every restart -

this code. assume because deinit never called, , every time user starts playing (gamescene), memory jumps 20 mb 40 mb 60, etc. , fps goes down after every time user dies , restarts game. does know why? gameviewcontroller.swift import uikit import spritekit extension sknode { class func unarchivefromfile(file : nsstring) -> sknode? { if let path = nsbundle.mainbundle().pathforresource(file string, oftype: "sks") { var scenedata = nsdata(contentsoffile: path, options: .datareadingmappedifsafe, error: nil)! var archiver = nskeyedunarchiver(forreadingwithdata: scenedata) archiver.setclass(self.classforkeyedunarchiver(), forclassname: "skscene") let scene = archiver.decodeobjectforkey(nskeyedarchiverootobjectkey) as! gamescene archiver.finishdecoding() return scene } else { return nil } } } class gameviewcontroller: uiviewcontroller{ @ib

Is there an equivalent in Python of Fortran's "implicit none"? -

in fortran there statement implicit none throws compilation error when local variable not declared used. understand python dynamically typed language , scope of variable may determined @ runtime. but avoid unintended errors happen when forget initialize local variable use in main code. example, variable x in following code global though did not intend that: def test(): y=x+2 # intended x local variable forgot # x not initialized print y x=3 test() so question that: there way ensure variables used in test() local , there no side effects. using python 2.7.x. in case there local variable, error printed. so question that: there way ensure variables used in test() local , there no side effects. there technique validate globals aren't accessed. here's decorator scans function's opcodes load_global . import dis, sys, re, stringio def check_external(func): 'validate function not have global lookups' saved_st