Posts

Showing posts from March, 2014

ssms - SQL Server Management Studio 2016 creates project all the time -

Image
i've upgraded ssms 2014 2016 , what's bugging me whenever want quit it, asks me save solution though didn't create one. how disable check?

c# - Getting the error: “No HTTP resource was found that matches the request URI” in WebAPI and AngularJS -

i'm confused. i'm using asp.net webapi 2 rest api , angularjs spa. application uses 4 rest requests. 1 doesn't work , don't know why. i've defined process follows: client-side: //controller crudservice.getrepo(selfrom, selto).$promise.then( function (response) { ... }, function (err) { $log.error('mth: ', err); }); //crudservice function getrepo(selfrom, selto) { return resservice.ds022.query( { from: selfrom, to: selto } ); } //resservice: function resservice($resource, baseurl) { return { ds022: $resource(baseurl + '/api/qr_ds022/mth_test', { from: '@from', to: '@to' }, {}) } } and on other hand: server-side (webapi) [routeprefix("api/qr_ds022")] public class qr_ds022controller : apicontroller { private testcontext db = new testcontext(); [httpget] [route("mth_test")] public iqu...

terminal - How can I set the certificates in CURL -

in order successful response using curl --cacert <path of ca.pem> ... how can set path of ca.pem in configuration file in mac in order not specify path of certificate every time, , can directly use curl ... on system can set environment variables point these files. try: export ssl_cert_file=/path/to/ca.pem there ss_cert_dir specify directory containing certificates. you can add .bashrc or .bash_profile file make permanent. this can changed @ compile time curl passing --with-ca-path=directory when building curl i'd recommend leaving is. better yet, find out ca path/file os and/or openssl using , add relevant certificate there. have no idea live on mac should have directory of trusted ca certs curl using verification (probably somewhere in /etc).

java - Easy Way to Add Closing Tags on HTML Document so XSLT can be Applied -

i working on system need pass hmtl through xslt transformation, html has few header tags don't have closing tags not technically "well-formed" able apply xslt. here tags: <meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta http-equiv="x-ua-compatible" content="ie=9"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="bootstrap.min.css"> <link rel="stylesheet" href="smartdoc.css"> here issue, documents working downloaded server don't have direct access open file, in notepad, , close tags manually. best way go closing tags can use xslt on them? note using java library run xslt transformation potentially use java edit html before applying xslt, not sure use. there java version of html tidy called jtidy use clean-up html. the jtidy how page show...

direct3d11 - Tutorial 2 of msdn "Direct3D Tutorial Win32 Sample" -

hi trying tutorial2 of https://code.msdn.microsoft.com/windowsdesktop/direct3d-tutorial-win32-829979ef#content . in tutorial 1 had add #pragma comment(lib,"d3d11.lib") make work. in tutorial 2, added 2 pragmas,#pragma comment(lib,"d3d11.lib") , #pragma comment(lib,"d3dcompiler.lib"). still can't build it. .hlsl files produce error:{error x1507 failed open source file: 'tutorial02.fx'}. tried locate tutorial02.fx in computer couldn't. idea file or how make work? using visual studio 2015 community edition. since using vs 2015, assume opened tutorials.sln , upgraded them v140, yes? i did , able build tutorials configurations without problem using vs 2015. sounds may not have expanded package correctly because tutorial02.fx present in package. note i've not updated msdn copies of samples in time. maintain them on github .

Evaluate statements from within Python logging YAML config file -

consider following snippet of python logging yaml config file: version: 1 formatters: simple: format: '%(asctime)s - %(name)s - %(levelname)s - %(message)s' handlers: logfile: class: logging.handlers.timedrotatingfilehandler level: debug filename: some_fancy_import_name.generate_filename_called_error backupcount: 5 formatter: simple i load yaml config file way: with open('logging.yaml', 'r') fd: config = yaml.safe_load(fd.read()) logging.config.dictconfig(config) take special notice of filename handler should write logs. in normal python code, expect some_fancy_import_name.generate_filename_called_errorlog generate string 'error.log' . in all, logging handler should write file 'error.log' in current directory. however, turns out, not case. when @ current directory, see file named 'some_fancy_import_name.generate_filename_called_errorlog' . why go through trouble? i filename progra...

oracle - Create a table using plsql -

issues: while executing query throws following error ora-01422: exact fetch returns more requested number of rows ora-06512: @ line 5 01422. 00000 - "exact fetch returns more requested number of row other issue trying primary key columns @ 1 place creating separate sql line other column in same primary key column. declare v_create varchar2(10000); v_alter varchar2(10000); v_index varchar2(10000); begin select 'create table owner_new.' ||table_name ||' select * ' ||owner ||'.' ||table_name ||';', 'alter table owner_new.' ||table_name ||' add (time timestamp not null default systimestamp, action varchar2(10) not null default ''i'');', 'create index ' ||cc.owner ||'.' ...

Model class not found when running Seeder in Laravel 5 -

i creating admin auth app , generated model artisan command: php artisan make:model admin -m this generated class: namespace app\models; use illuminate\database\eloquent\model; class admin extends model { // } this created empty model , basic migration. added lines migration: public function up() { schema::create('admins', function (blueprint $table) { $table->increments('id'); $table->string('name', 32); $table->string('username', 32); $table->string('email', 320); $table->string('password', 64); $table->string('remember_token', 100)->nullable(); $table->timestamps(); }); } then used command line create seeder: php artisan make:seeder admintableseeder and added seeder databaseseeder public function run() { $this->call(admintableseeder::class); ...

vb.net - How to use Lambda functions with embedded code in SSRS 2008 R2 reports? -

using ssrs 2008 r2 embedded code, vb.net code compiler seems err whenever need beyond simplest of statements. for instance, want use linq select function perform operations on elements of collection, bids keeps throwing compiler errors on lines of valid vb.net code. public function splittoids(byval multivalue string) integer() dim regex new system.text.regularexpressions.regex("((?>.*?);#\d*;#)", system.text.regularexpressions.regexoptions.compiled or system.text.regularexpressions.regexoptions.explicitcapture or system.text.regularexpressions.regexoptions.cultureinvariant or system.text.regularexpressions.regexoptions.ignorecase) dim results new system.collections.generic.list(of string)() dim matches system.text.regularexpressions.matchcollection = regex.matches(multivalue) each mvmatch system.text.regularexpressions.match in matches results.add(mvmatch.value) next 'dim pairs string() = splittopairs(multivalue) 'dim n...

android - handle toolbar appearance individually on different Activities -

Image
i have 2 activities activity1 , activity2 and in both activities added toolbar codes activity1 : <android.support.v7.widget.toolbar android:layout_height="wrap_content" android:layout_width="match_parent" android:minheight="?attr/actionbarsize" android:id="@+id/toolbartrendingactivity" android:elevation="5dp" android:textalignment="center" android:background="@color/colorprimary" app:theme="@style/toolbarstyle"> <textview android:layout_width="wrap_content" android:layout_height="match_parent" android:textalignment="center" android:layout_gravity="center" android:id="@+id/toolbar_title" android:textsize="20sp" android:textstyle="bold" android:background="#00000000" android:textcolor="#ffffff...

FHIR Search Slots request -

i implementing fhir server , un-avoidable reason not have access doctor's schedule, however, have access slots available appointment booking. i can slots 4 parameters using doctor id organization id location id date of slot will below considered valid slot query using fhir : http://localhost:8080/context/fhir/slot?practitioner=practitioner/123456789&organization=organization/1234&location=location/2&start=2016-07-25 also, in response above query, since reference schedule absolutely necessary (slot has card=1..1 schedule reference), can pass reference value : "schedule": { "reference": "schedule/notrequired" } in slot response ? unfortunately, right now, have expose schedule, there isn't reason has "real". way have implemented slot searching exposing dummy schedule data element being link actor. example: <schedule xmlns="http://hl7.org/fhir"> <id value=...

python - MacOS: make pycaffe gives "no rule to make target" -

i want import caffe python 2.7 (anaconda/mac). managed make (all, test, , runtest), passed success. here's snippet of make runtest command: [----------] global test environment tear-down [==========] 1096 tests 150 test cases ran. (49316 ms total) [ passed ] 1096 tests. the next step according caffe manual run command: make pycaffee there error: make: *** no rule make target `python/caffe/_caffe.cpp', needed 'python/caffe/_caffe.so'. stop. i believe has pythonpath , cannot figure out missing. here's piece of bash_profile: export path="//anaconda/bin:$path" export path="/home/xxx/anaconda/bin:$path" export pythonpath=~/desktop/google_deepdream/caffe-master/python:$pythonpath also, piece of makefile looks like: # note: required if compile python interface. # need able find python.h , numpy/arrayobject.h. #python_include := /usr/include/python2.7 \ # /usr/lib/python2.7/dist-packages/numpy/core/...

javascript - How to wrap compiled element around directive? -

i initiating simple directive link function: ... function linkfn(scope, element) { var wrapperel = angular.element('<div data-ng-click="togglezoom()"></div>'); scope.togglezoom = function() {...}; element.wrap(wrapperel); } ... i tried replace wrapper compiled 1 var compiledwrapperel = $compile(wrapperel)(scope); , did not solve problem.

.net - Why cant i store 20 kilibytes image in mysql -

i storing thumbnail size images (less 50kb) in tinyblob field in mysql using mysqlconnector .net using following code dim imgcov new imageconverter() dim imgarray byte() = directcast(imgcov.convertto(picturebox1.image , gettype(byte())), byte()) try using conn new mysqlconnection(constr) conn.open dim sql string ="insert services(name,code,emp_id,image) values(@name,@code,@emp_id,@image)" using cmd new mysqlcommand(sql,conn) cmd.parameters.add("@name", mysqldbtype.varchar, 45).value ="ironing" cmd.parameters.add("@code", mysqldbtype.varchar, 45).value ="irn" cmd.parameters.add("@emp_id", mysqldbtype.int32).value =1 cmd.parameters.add("@image", mysqldbtype.longblob, 100).value=imgarray cmd.executenonquery () end using ...

api - C# POST request to webapi using a console program -

i have web api can access through browser :- https://127.0.0.1:8443/ncrapi i trying create simple console program in c# using vs2015 send data , receive response using http post. here have far:- using system; using system.net.http; using system.net.http.headers; using system.threading.tasks; namespace websample { class apisenddata { public string apifunction { get; set; } public string dppname { get; set; } public string cleardata { get; set; } public string dppversion { get; set; } } class program { static void main(string[] args) { // main function calls async method named runasync // , blocks until runasyncc completes. runasync().wait(); } static async task runasync() { using (var client = new httpclient()) { // code sets base uri http requests, // , sets accept header "applica...

javascript - JS - Set delay between sending AJAX request -

i working on building search feature site. have search bar sends ajax request server each time user types something. server in turn send items match search. the problem if user types "a" , "b" send is: a ab to counter have found settimeout delays when user enters search; however, delaying when strings fire (i.e. waits 0.75 seconds before sending a , waits 0.75 seconds before sending ab ). here's js: $('#searchbox').keyup(function(e) { var timeoutid = settimeout(searchrequest, 750, $(e.currenttarget).val()); }); function searchrequest(str) { if (str.length > 0) { console.log('search request initalized | sending: ', str); var xhttp = new xmlhttprequest(); xhttp.open('post', 'code send here', true); xhttp.send(str); } } i think need debounce function. here's basic javascript debounce function (as taken underscore.js): // returns function, that, long continues invoked, ...

php - Poor performance of getting the contents of a jpg or a json file in a zipped versus unzipped directory -

i have a.zip file on 100k jpg images , 400k json files. able contents of file inside a.zip using file_get_contents(zip:://path/to/a.zip#subdir/path/to/file) function (in php). however, takes 100 times more time (from 250 milli-seconds +25 seconds based on firebug) contents of file compared unzipped directory. suggest solution? thanks.

javascript - Hover Fade In And Out -

sir!, have question! possible when hover table or images, fade in-out-in-out , on. , won't stop unless point out hover? in css or js please thank you! apparently, missed wanted pulsing effect perhaps old blink tag. updated example uses css animation, there other alternatives well. @keyframes pulse { { opacity: 1 } { opacity: 0 } } .fade:hover { animation-name: pulse; animation-duration: 500ms; animation-iteration-count: infinite; animation-direction: alternate; animation-timing-function: ease-in-out; } <div class="fade">fade on hover</div>

How to use eclipse-pmd rulesets configuration -

as can see here: in manual easy create rule set. using eclipse-pmd plugin. have difficulty figuring out put rulesets.properties file. root of source tree. ruleset.xml in root of source tree. you can set eclipse-pmd in project properties. please take @ getting started eclipse-pmd page of eclipse-pmd website. has step-by-step instructions on how set plugin.

Overriding the legend title using user specified string instead of variable name -

i have below code using ggplot2() package. trying plot between variables - 'company advertising' , 'brand revenue' of data frame 'htmltable' , when variable 'industry' 'luxury'; using ggplot() function. using variable of data frame 'brand value' colour variable. p<- ggplot(htmltable[htmltable$industry='luxury',],aes(x='companyadvertising',y='brandrevenue') q <- p+geom_point(aes(color='brandvalue',size='brandvalue') + geom_text(label='brand') r <- q+xlab("company advertisiment in billions")+ylab("brand revenue in billions") +ggtitle("luxury") r+theme(plot.title=element_text(size=10,face='bold'),legend.key=element_rect(fill='light blue')) here, want change legend title "brandvalue" "brandvalue in billions". please suggest. i tried using labs parameter in below statement. resulting in 2 legends. r <- q...

css - Why div adds 4 pixels on the bottom of a textarea on chrome and safari (but not on firefox)? -

i try put red textarea on bottom of page: https://jsfiddle.net/akcmd94u/5/ html <div class="footer"> <textarea rows=1></textarea> </div> css .footer { position: absolute; bottom: 0; left: 0; right: 0; padding: 0; margin:0; } textarea { background-color: red; border: none; padding: 0; margin:0; height: 30px; } on latest firefox, textarea correctly on bottom. but on latest chrome , latest safari, there's gap between bottom border , textarea. how remove gap on chrome , safari? that's because textarea displayed inline element. so, way it's height calculated not expect block element. this solve issue: textarea { display: block; } also, way guarantee both textarea , container have same height. cheers.

javascript - Test if two elements are the same -

i suspect work @ first: if ($('#element') == $('#element')) alert('hello'); but not. how 1 test if elements same? as of jquery 1.6 can do: $element1.is($element2)

javascript - Bootstrap Modal switching -

i have 2 modals id1 , id2 , want open 1 of modal according state of paddle switch.when switch in 'off-state', modal id 'id1' needs opened , when switch in 'on-state', modal id 'id2' needs opened. on 'onchange' event, adding id of modal needs opened 'data-open' , 'aria-controls' attribute. $('#button-id1').attr('data-open', 'id1'); $('#button-id1').attr('aria-controls', 'id2'); but working first time, when closed opened modal, switching paddle shows opened modal. can give me idea going here? try this $('#id1').modal("hide"); it should in if statement when switch on-state selector id of modal should modal want hide or remove else off-state if(switch_button == on_state){ $('#id1').modal("show"); $('#id2').modal("hide"); }else{ $('#id1').modal("hide"); $('#id2').modal(...

c# - Regular Expression for word starting with Colon (:) -

i new regular expression, please me in regards. have sql query below declare @name varchar(20) declare @branchcode char(3) select @name=:entername select @branchcode=:enterbranchcode select * master name=@name , branchcode=@branchcode now need replace :entername , :branchcode actual value. trying solve using regular expression. is regex ok (/\b:\s+/g") ??? all want achieve collect sql parameter web application dynamically no, sqlparameters for. in addition creating variables can used within sql, protect against sql injection attacks , you're opening for. plenty of examples on stack overflow how use them, such this one. in order parse these out given query prompt user values... simply take query regular parameters, select * foo bar = @barname you can regex @barname parameters pretty easy regex @\w+ for each parameter, ask user the type of parameter the value of parameter construct sqlparameter each , add sqlcommand object. yo...

c++ - Is it bad to declare a C-style string without const? If so, why? -

doing in c++ char* cool = "cool"; compiles fine, gives me warning: deprecated conversion string constant char*. i never willfully use c-style string on std::string , in case i'm asked question: is bad practice declare c-style string without const modifier? if so, why? yes, declaration bad practice, because allows many ways of accidentally provoking undefined behavior writing string literal, including: cool[0] = 'k'; strcpy(cool, "oops"); on other hand, fine, since allocates non-const array of chars: char cool[] = "cool";

java - How to setup fisheye/crucible reviews in IntelliJ Idea? -

i trying review peer's code in intellij idea 15. have been able set-up atlassian plugin fine in intellij , i'm able see of jiras , filters through jira tab. there no crucible review coming have manually created through web-browser in fisheye/crucible login. how working? the plugin not supported atlassian anymore. , there no development in plugin repo more year. i expect features stop working atlassian update apis. ticking bomb - update of service plugin can become incompatible.

Hive - Select keys with a particular value -

is there way in hive select keys of map have particular value? e.g. if map looks this: {"default":1, "test":2, "experiment":1} given value 1, select (and concatenate using concat_ws) keys "default" , "experiment" . if helps, map stored member of struct stored in table i'm reading data from.

javascript - how can i use br in a string to show my string correctly with the html tag? -

my string is: $scope.lyrics = 'blablablalba\nblablabla\nblablabla'; then replace '\n' <br> tag and string is: $scope.lyrics = 'blablablalba<br>blablabla<br>blablabla'; and when string in html: <p> {{ lyrics }} </p> my result blablablalba <br> blablabla <br> blablabla what can result be: lablablalba blablabla blablabla you have sanitize html tags. $scope.lyrics = 'blablablalba<br>blablabla<br>blablabla'; <p ng-bind-html-unsafe="lyrics"> the output be: blablablalba blablabla blablabla check out: http://jsfiddle.net/5dmjt/7670/

ios - Get area of intersecting line (CGPoints) -

Image
i have array of cgpoints , find points, build shape. please see attached image: the red circles mark points have. how can area question mark found? thanks. you going have start first line segment , check intersections. if first 2 line segments intersect same line , shape line, ignore case. continue down line segments once find segment pair intersect have shape. check line segment 2 against line segment 1. check line segment 3 against line segment 2, against line segment 1. check 4 against 3, 2, 1, etc... if find line segment 7 intersects line segment 3, delete first point of line segment 3 , se intersection point found. delete last point of line segment 7 , set intersection point found. there have shape. here example method find intersection of 2 line segments (written in c#, it's straight math should easy convert language like). taken here: // determines if lines ab , cd intersect. static bool linesintersect(pointf a, pointf b, pointf c, pointf d) {...

hadoop - How to specify multiple conditions in sqoop? -

sqoop version: 1.4.6.2.3.4.0-3485 i have been trying import data using sqoop using following command: sqoop import -libjars /usr/local/bfm/lib/java/jconnect-6/6.0.0/jconn3-6.0.0.jar --connect jdbc:sybase:db --username user --password 'pwd' --driver com.sybase.jdbc3.jdbc.sybdriver --query 'select a.* table1 a,table2 b b.run_group=a.run_group , a.date<"7/22/2016" , $conditions' --target-dir /user/user/a/ --verbose --hive-import --hive-table default.temp_a --split-by id i following error: invalid column name '7/22/2016' i have tried enclosing query in double quotes, says: conditions: undefined variable. tried several combinations of single/double quotes , escaping $conditions , using --where switch well. ps: conditions non numeric. (it works cases x<10 or so, not in case it's string or date) in command --split-by=id should --split-by=a.id , use join instead of adding where condition, convert date (specified stri...

python - Joining Lists Within A List? -

i trying make join of lists within list in python here example of doing (the lists bigger in real code): import itertools listenv = ["in","vc","vs"] listsize = ["u17-1","u17-2"] listevnsize = list(itertools.product(listenv, listsize,)) print listevnsize #this results in [('in', 'u17-1'), ('in', 'u17-2'), ('vc', 'u17-1'), ('vc', 'u17-2'), ('vs', 'u17-1'), ('vs', 'u17-2')] what want combine inner lists - instance result be: [('in-u17-1'), ('in-u17-2'), ('vc-u17-1'), ('vc-u17-2'), ('vs-u17-1'), ('vs-u17-2')] so in other words join inner lists, when tried using: listevnsizejoined = '-'.join(map(str,listevnsizezip)) as suggested in question, joining of outer lists 1 big string this: (('in', 'u17-1'),)-(('in', 'u17-2'),)-(('vc', ...

cassandra - Paging Datastax java driver -

can point me detailed documentation how paging implemented, page , page state? have gone through https://datastax.github.io/java-driver/manual/paging/ but how implemented internally? is coordinator drawing data , limit offset query data drawn out replicas sequentially every page request? or saving file cursor , doing randomaccess? if can driver , use later on? the documentation mentioned up-to-date pagination datastax java driver. can read this blog post , bit old, still valid. is coordinator drawing data , limit offset query [...] ? no. actually, there no "offset query" in cassandra, see cassandra-6511 . covered in driver documentation on paging . or saving file cursor , doing randomaccess? if can driver , use later on? yes both. paging state exposed driver meant used in way; again, explained in driver documentation on paging .

eclipse - android - Heap Size Increasing per activity -

in android game, have activities, 1 of them has opengl view. problem each time switch between activities, used heap memory doesn't free up, example after 10-20 times switching between activities in phones, application crashes , close. i have structure code switching between every activity: intent = new intent(worldchose.this, mainmenu.class); startactivity(it); overridependingtransition(r.anim.from_middle, r.anim.to_middle); finish(); i have searched lot, says android should free unused memory , shouldn't worry it, seems it's not doing job in case! what should do? if isn't freeing memory eventually, have leak. i'd objects registered os, async tasks or threads, or else may stay around after death of activity has references activity.

firebase hasChildren working in simulator but not angularFire -

i learning firebase have following simple rule set up: { "rules": { ".read": "auth != null", "messages": { ".read": "true", "$conversation_id": { ".write": "newdata.haschildren(['receiver_id','sender_id','timestamp'])" } } } } in simulator write rule passes with: { "receiver_id":123, "sender_id":"test", "timestamp":123 } using angularfire permission denied (uid defined): var dat = { sender_id:uid, receiver_id: uid, timestamp: firebase.database.servervalue.timestamp }; database.ref('messages/mymessageid').push(dat); if remove haschildren check message gets added database proper values populated. gives? firebase.push() automatically creates new unique id (similar array index), structure should let angularfire...

react jsx - Reactjs dropdown list population from props data -

i trying create dropdown select box populate list items in dropdown box using data have passed componenent. keep running "uncaught invariant violation: input void element tag , must not have children or use props.dangerouslysetinnerhtml . check render method of assignmodal." error , not sure how solve it. here code using: in function trying dynamically generate drop down items createuserdropdown: function() { let items = []; (let = 0; < this.props.userdata.user_data.length; i++) { items.push(<option key={this.props.userdata.user_data[i].id} value={this.props.userdata.user_data[i].id}>{this.props.userdata.user_data[i].first_name}</option>); } return items; } here render function render: function() { return ( <div> <form classname='form-inline' onsubmit={this.handlesubmit}> <input type="select" label="multiple select" multiple> {this.createuserdropdown()} </input> </form...

Ruby: Hash, Arrays and Objects for storage information -

i learning ruby, reading few books, tutorials, foruns , one... so, brand new this. trying develop stock system can learn doing. questions following: i created following store transactions: (just few parts of code) transactions.push type: "buy", date: date.strptime(date.to_s, '%d/%m/%y'), quantity: quantity, price: price.to_money(:brl), fees: fees.to_money(:brl) and 1 colleague here suggested create transaction class store this. so, next storage information had, did: @dividends_from_stock << dividendsfromstock.new(row["approved"], row["value"], row["type"], row["last day with"], row["payment day"]) now, first question: way better? hash in array or object in array? , why? this @dividends_from_stock returned method 'dividends'. i want find dividends paid above specific date: puts ciel3.dividends.find_all {|dividend| date.parse(dividend.last_day_with) > date.parse('12/05/2014'...

javascript - Lost the scope of of a function inside a object -

i have problem, i'm losing reference property of object ana when runs within event $(window).resize as can keep scope. example: var testobject = { init: function () { this.divoriginal = $('.selector-tag'); this.resizenow(); }, resizenow: function () { //some code here.... //.... //.. $(window).resize(this.resizeupdate.bind(this)); //without bind(this) scope window }, resizeupdate: function() { console.log($(this)); var scrollwrapper = $(this)[0].divoriginal;//the way refer divoriginal scrollwrapper.css('border','1px solid red'); } } testobject.init(); there cleaner way access object's attributes? you can access object using this instead of $(this) since bound object method called event handler. see mdn docs on function.prototype.bind() : the ...

python - How to fix "unexpected keyword argument 'useChardet'" in html5lib -

i'm using html5lib , after updating latest version, keep getting error: traceback (most recent call last): file "/home/travis/build/freelawproject/juriscraper/tests/test_everything.py", line 119, in test_scrape_all_example_files site.parse() file "/home/travis/build/freelawproject/juriscraper/juriscraper/abstractsite.py", line 95, in parse self.html = self._download() file "/home/travis/build/freelawproject/juriscraper/juriscraper/abstractsite.py", line 384, in _download html_tree = self._make_html_tree(text) file "/home/travis/build/freelawproject/juriscraper/juriscraper/opinions/united_states/federal_appellate/ca11_u.py", line 26, in _make_html_tree e = html5parser.document_fromstring(text) file "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/lxml/html/html5parser.py", line 64, in document_fromstring return parser.parse(html, usechardet=guess_charset).getroot() file "/hom...

ruby - Rails: Many to many relation to self -

i having problems creating association: consider model "entry". want entries have many entries parents , want entries have many entries children. want realize relation via model called "association", here tried: migration: class createassociations < activerecord::migration[5.0] def change create_table :associations |t| t.integer :parent_id t.integer :child_id end end end association model: class association < applicationrecord belongs_to :parent, class_name: 'entry' belongs_to :child, class_name: 'entry' end so far works. how use create 2 many-to-many relations on model itself? class entry < applicationrecord # has many parent entries of type entry via table associations , child_id # has many child entries of type entry via table associations , parent_id end this should work: class entry < applicationrecord has_and_belongs_to_many :parents, class_name: 'entry', join_tabl...

javascript - Pull a single item from json and display in html -

i have array in json file , want pull single entry array , display when page loads. have gotten partway there using this question , answer , attempt adapt answer causes output html block repeat array items in sequence instead of picking one. here screenshot of get: screenshot of output i doing real stupid, , hope can point out. script follows: $.getjson('recommend.json', function(data) { var entry = data[math.floor(math.random()*data.length)]; $.each(data, function(entryindex, entry) { var html = '<div class="rec_img"><img src="./recs/' + entry['img'] + '" /></div>'; html += '<span class="rec_title">' + entry['title'] + '</span><p>'; html += '<span class="rec_author">' + entry['author'] + '</span><p>'; html += '<span class="rec_blurb">' + entry...

Ionic2 Firebase 3.2 Angularfire2 2.0.0-beta.2 Auth not working when testing on device -

when run ionic serve --lab works fine in browser. can auth operations email , password. when try , test on device through ionic upload, or build on android, app isnt authenticating correctly. can still connect firebase if hard code url of list or object can't data through auth login. worth noting when emulate in browser "the current domain not authorized oauth operations. prevent signinwithpopup, signinwithredirect, linkwithpopup , linkwithredirect working." not sure if related issue because still allows me login browser , not using of those, auth.login(email, password). when debug app device through chrome "uncaught error: "location.protocol" must http or https ". know how may able fix this? popup , redirect operations supported in http , https environments. check thread on how sign in or link popup in ionic/cordova: https://groups.google.com/forum/#!searchin/firebase-talk/cordova $20facebook/firebase-talk/mc_mllncwni/dqn_8aucbqaj

javascript - How do I move up/down a highlight selected row from a table in angularjs? -

i'm new in angularjs, i'm trying table move up/down selected highlight row buttons.. for example, after select first row need change second position down button... i need help! var foodapp = angular.module('foodapp',[]); foodapp.controller('foodctrl',function($scope){ $scope.selectedrow = null; $scope.fooditems = [{ name:'noodles', price:'10', quantity:'1' }, { name:'pasta', price:'20', quantity:'2' }, { name:'pizza', price:'30', quantity:'1' }, { name:'chicken tikka', price:'100', quantity:'1' }]; $scope.setclickedrow = function(index){ $scope.selectedrow = index; } }); <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script> <style> .selected { background-color:black; color:white; font-weight:bold; } </style...

asp.net - Regex password validation working fine on regex verification sites but not on mine -

i have following regex code works fine on regex verification code not on website (built asp.net mvc). validates length , numeric not absence of special characters. my regex: /^(?=.*[!@@#$&](?=.*[a-z]))(?=.*[0-9])(?=.*[a-z]).{8,}$/ on website toto1234 considered fine not case since not contain special character. basically checking on view did not make change on model. model had regex not checking special characters. on view, there script checks if password matches regex. edit: solution, more clear make sure view model or class decorated right regex. regex check and/or validation in view work temporary before try submit form. in case since had different regex (in view --via jquery-- , model), client side verification worked because have right regex. server side verification did not. had make sure had right regex on class well. hope more clear.

Visual Studio failed deploy to HoloLens: Error DEP6957 : Failed to connect to device -

i having trouble deploying hololens academy module: holograms (210) hololens device. ask pin, enter , fails. i can deploy , run in emulator fine. i can assure computers on same network , leave hololens on pairing screen. error dep6957 : failed connect device '172.16.25.29' using universal authentication. please verify correct remote authentication mode specified in project debug settings. 0x8007274c: network event being waited on triggered error. modelexplorer i restarted headset, restarted visual studio , computer , still facing issues. eventually determined needed leave headset pin window open while pairing , if enter bad pin vs, hard get/find dialogue change it. as result, created new build configuration triggered pin window upon build, @ point opened pin/pairing dialogue in headset , entered pin while leaving pin dialogue in headset open until showed device paired.

nonetype - How do I convert all python operations involving None to None values? -

i want mathematical operations involving 1 or more none variables return none. example: a = none b = 7 a*b i want last line return none, instead gives me error: typeerror: unsupported operand type(s) *: 'nonetype' , 'int' i understand why error exists , that, there way force result none ? background : have few functions mine data , return value, called diff . later on multiply or add diff few things meaningful information, not of original data contains useful diff , have set return diff = none in these cases. want able skip on these points when i'm plotting results. python seems have no trouble skipping on none elements in array when i'm plotting, i'd have results of operations none . instead of trying force mathematical operations contain arbitrary other value return arbitrary other value, use nan , designed sort of purpose: >>> nan = float("nan") >>> 7 * nan nan >>> 7 + nan nan a nan...

Why is it that the code below behaves differently in Java 1.6 and 1.7 -

the code below public class test16jit { public static void main(string[] s) { int max = integer.max_value; int = 0; long li = 0; while (i >= 0) { i++; li++; if (i > max) { system.out.println("i : " + i); system.out.println("max : " + max); system.out.println("woo!! went wrong"); } } system.out.println("value of i: " + i); system.out.println("total # of iterations: " + li); } } outputs below in java 1.7x value of i: -2147483648 total # of iterations: 2147483648 outputs below in java 1.6x i : 2147483636 max : 2147483647 woo!! went wrong value of i: -2147483648 total # of iterations: 2147483648 is there reason behavior? also if change int max = integer.max_value; -> final int max = integer.max_value; it behaves same in 1.6x , 1.7x it seems 1 of many examples of family ...

ubuntu - Running puppet agent for puppetlabs-apache module with sudo -

i've got ubuntu 14.04 latest puppet agent installed. user 'ubuntu' part of root , sudo groups. have password disabled sudo , can't puppet manifest use puppetlabs-apache module. complaining permission denied on /var/lib/dpkg/lock file. checked file isn't there. this seem such trivial problem, if run sudo puppet still complaining permission. my manifest looks this node default { include apache apache::vhost { 'st.site.com': servername => 'st.site.com', port => '80', docroot => '/var/www/html/sources/prod/', docroot_owner => 'www-data', docroot_group => 'www-data', } } how can enable run sudo privileges ? the part blowing on (when run manually sudo work fine) /usr/bin/apt-get -q -y -o dpkg::options::=--force-confold install apache2 the error : error: execution of '/us...

asp.net mvc - Understanding virtual and calculated properties in Entity Framework -

i have job model contains number of properties, , set of linked entities called quotes: public class job { .... public virtual icollection<quote> quotes { get; set; } } in job class have following calculated property: public decimal quotesawarded { { if (quotes == null || !quotes.any()) { return 0; } var totalunapprovedquotes = quotes.where(x => x.status != "approved"); return 1 - (totalunapprovedquotes.count() / quotes.count()); } set { } } i have 2 questions: when debug property, quotes null (even though there attached quotes entity). thought using virtual means shouldn't occur? how can ensure whenever model constructed, related quote entities attached? the reason i'm doing property value stored in database, reduces compute time it's pre-calculated, correct? follow up: in cases i'm not using include<quotes> when retrieving job obj...

sql server - Converting from R POSIXlt to T-Sql datetime -

i need restructure r posixlt object appropriate t-sql query going return sql datetime. imagine there should way conver posixlt double , use double make sql datetime, not able figure out how that. here have tried: date = as.posixlt(sys.time()) date_num = as.double(date) after copied contents of date_num (1469491570) , attempted paste following sql query see happens: select convert(datetime, convert(varchar(10), 1469491570)); however, errors out, guess expected, since expects string representation of date not random number... edit: looking find can convert posixlt number of tics or milliseconds from, say, 1900 , uses number create t-sql datetime. the function: julian(x, origin = as.date("1970-01-01"), ...) can convert posix object number of days specified origin should able convert number of seconds or milliseconds. for example: as.numeric(julian(as.date("2016-07-25"))) is 17007 days jan 1, 1970 (beginning of time unix) or as.numer...

android - Insert an item into the inner RecyclerView adapter -

i have recyclerview shows full-height recyclerview s items. , need insert new item in inner recylerview adapter. wrote method in adapter of top level recyclerview : public void notifyinneriteminserted(final int position, final int insertposition) { viewholder holder = (viewholder)mrecyclerview.findviewholderforadapterposition(position); if(holder != null) { day day = records.get(position); holder.madapter.clear(); holder.madapter.addall(day.getitems()); holder.madapter.notifyiteminserted(insertposition); } } but doesn't work. , if try update whole item of top level: dayadapter.notifydataiteminserted(position); doesn't work same. looks recyclerview holds old drawable cache. below full code of top level adapter: public class dayadapter extends recyclerview.adapter<dayadapter.viewholder> { private recyclerview mrecyclerview; public dayadapter(recyclerview recyclerview) { mrecyclerview = recyclerview...

javascript - Why does this loop produce undefined? -

why there 11th iteration, , why 'undefined' printed during it? var num = 10; var start = 0; function x(){ while (start <= num){ console.log(start + '<br>'); start++; } } console.log(x()); because x() not return when console.log() it. var num = 10; var start = 0; function x(){ while (start <= num){ console.log(start); start++; } } x(); if return in function output return. var num = 10; var start = 0; function x(){ while (start <= num){ console.log(start); start++; } return 'end'; } console.log(x()); now function returns 'end'.

c# - Postback on link button when clicking to show modal box -

i try modal box update new table after onclick button. right i'm using asp:linkbutton , when user click there sending id server side , search through database update modal box. inside modal box i'm using asp:updatepanel updatemode="conditional" . the problem is, there postback after clicking link button. guys have suggestion problem. or instead using method. please newbie guys. thanks. 1) add clientidmode = "autoid" in page. 2) register every linkbutton asyncpostbacktrigger programmatically in event listview1_itemdatabound. protected void listview1_itemdatabound(object sender, listviewitemeventargs e) { if (e.item.itemtype == listviewitemtype.dataitem) { linkbutton btntasktitle = e.item.findcontrol("tasktitle") linkbutton; if btntasktitle != null) scriptmanager.getcurrent(this).registerasyncpostbackcontrol(btntasktitle ); } } http://forums.asp.net/t/1859197.aspx?linkbutton+within+a+listview+that+is+within+an+updatepanel+causes+...

Importing react-native project in android studio -

am having small problem opening/importing react-native android studio. if open project using open project dialog, tells me project not gradle enabled , such pain make , test code changes. couldn't find out how enable project gradle project after fact after going through material on site. on other hand, if import using import gradle project dialog , select build.gradle file, project imported, see files inside android directory instead of main project directory. method allows me push changes emulator. how can fix problem? thanks, just import android directory android studio, make changes app/build.gradle add these codes before apply from: "../../node_modules/react-native/react.gradle" project.ext.react = [ bundleassetname: "index.android.bundle", entryfile: "index.android.js", bundleindebug: false, bundleinrelease: true, root: "../../", jsbundledirdebug: "$builddir/...

mysql - Yii2: How to save different data in two tables from one form? -

public function actioncreate() { $tim = new pstktim(); $user = new user(); if ($tim->load(yii::$app->request->post()) && $user->load(yii::$app->request->post())) { $tim->id = yii::$app->generateid->getguid(); $tim->save(); $idtim = $tim->id; $user->id = $tim->id; $user->save(); return $this->redirect(['view', 'id' => $tim->id]); } else { return $this->render('create', [ 'tim' => $tim, 'user' => $user, ]); } } i trying insert different data in 2 different tables. table pstktim , user, how insert in user table in yii2. could please try following way. public function actioncreate() { $tim = new pstktim(); $user = new user(); if ($tim->load(yii::$app->request->post())) { $tim->id = yii::$app-...

api - How to use filter in gapi.class.php? -

i'm using gapi.class.php data google analytics api here example code $filter = 'eventvalue =~ 493'; $ga->requestreportdata('00000000',array('eventlabel'),array('totalevents','uniqueevents','eventvalue','avgeventvalue','eventspersessionwithevent'), 'totalevents', $filter ,date("y-m-d"), date("y-m-d")); i want filter string prefix "customer received code :" , suffix "493" example data : customer received code : 1493 customer received code : 4933 customer received code : 1234 customer received code : 2334 customer sent code : 555 customer received code : 493 customer sent code : 777 i appreciate if can provide solution. thanks,

Linking cells in excel file -

i want link 2 cell in excel sheet. can edit cell values both side. for example: i have 2 sheets in excel. sheet01 sheet02 a1 cell of sheet01 connected a1 cell of sheet02. i can edit sheet01 cell , display value in sheet02 sheet02 cell have =sheet01!a1 now want way edit sheet02 a1 cell that's display data in a1 cell of sheet01. simply, both side communication 2 linked cell in excel. use code "sheet1" object : private sub worksheet_change(byval target range) if not intersect(target, range("a1")) nothing thisworkbook.sheets("sheet2").range("a1").value = target.value end if end sub you can copy code "sheet2" object. have change sheets("sheet2") part sheets("sheet1") .

javascript - Why is IE ignoring width, height on inline link tag? -

pre-req: <a href="#a" onclick="mywindow=window.open(\'https://<server ip>/clickherenotes.html#<div name aaa>\',\'mywindow\',width=600, height=300); return false;">click here.</a> by clicking on link above, embedded html page opened target div name aaa displayed. below toggle function have used in html script tag: div { display: none; } div:target { display: block; } problem: when link above clicked in chrome opens popup window, while displaying whole div html content when try open link in ie 11 , pop window appears window size not wrap around html content of div in concern. there no scroll bar. things have tried far, did not work: adding scrollbar=yes adding min-height adding % in width , height . removing width , height . adding char after href=# . what property should use display pop window complete div html content? try instead add attribute overflow:scroll div

java - need to save all the values coming in for loop? -

if (username.equals(registereduser)) { jsonarray nameobject = msg.getjsonarray("namelist"); (int j = 0; j < nameobject.length(); j++) { jsonobject name = nameobject.getjsonobject(j); username = name.getstring("firstname"); userweight = name.getstring("weight"); weight = double.parsedouble(userweight); } } here need save username , weight coming within loop , convert userweight in double ,and extracting save values within same class?? your version: arraylist<string> username = new arraylist<string>(); arraylist<double> weight = new arraylist<double>(); if (username.equals(registereduser)) { jsonarray nameobject = msg.getjsonarray("namelist"); (int j = 0; j < nameobject.length(); j++) { jsonobject name = nameobject.getjsonobject(j); username = name.getstring("firstname"); userweight ...

objective c - How could i add phonebook contacts to my chat app in ios by using xmpp framework and openfire server? -

i new chat application , making in objective-c. wanted know how save phonebook contacts user. know how fetch contacts address book dont have idea xmpp framework , openfire.if me. first know how fetch contacts.now every contact need add xmpp roaster.like below call method called @ contact fetching class. [[self appdelegate] addnewbuddytomyaccount:tempnumber withnickname:[[tempcontactlist objectatindex:i] fullname]]; //in terms tempnumber phone number jid. in xmpp class follow below code add roster nsstring * buddynamejid = [nsstring stringwithformat:@"%@@servername",buddyuserid]; xmppjid *jid = [xmppjid jidwithstring:buddynamejid]; //if don't need permission use below line otherwise comment [[self xmpproster] acceptpresencesubscriptionrequestfrom:jid andaddtoroster:yes]; //here adding our contact our roster check once in roaster in openfire [[self xmpproster] adduser:jid withnickname:nickname]; hope helps.