Posts

Showing posts from July, 2012

nested forms - Rails 4 - setting associated foreign key value -

i have model called project , called invite. the associations are: project has_many :invites invite belongs_to :project i want allow users create projects send invites other users join them in working on project. i have form create invites follows: <%= simple_form_for(@invite, :url => invites_path) |f| %> <%= f.hidden_field :recipient_id, :value => get_recipient_id %> <%#= f.hidden_field :project_id, :value => current_user.profile.project_id %> <%= f.hidden_field :project_id, :value => @invite.project_id %> <%= f.label :email %> <%= f.email_field :email %> <!-- field should use :date_picker- isnt working --> <%= f.input :expiry, :as => :date, :label => "when need response invitation?" %> <%#= f.input :expiry, :as => :date_picker, :label => "when need response invitation?" %...

c# - LINQ to SQL - Count number of certain item types in each order -

for sake of simplicity of post, suppose have data in orders table follows. here customerid foreign key customers table. question : how can write linq query find count of vegetables (v) , fruits (f) each customer ordered? orders table : orderid | customerid | ordertype 1 | 11 | v 2 | 11 | v 3 | 11 | f 4 | 11 | v 5 | 12 | v 6 | 15 | f 7 | 15 | v 8 | 15 | f i can count number of orders each customer follows. but how number of vegetables , number of fruits in each order? : var query1 = o in orders group o o.customerid grp select new {customerid = grp.key, ordercount = grp.count()}; you can use subquery: var query1 = o in orders group o o.customerid grp select new { customerid = grp.key, ordercount = grp.count(), ordercounts = g in grp...

php - Extending EnitityType - constructor arguments not passing -

i have extended symfony\bridge\doctrine\form\type\entitytype following class namespace main\form\type; use /* ... */ class extendedentitytype extends entitytype { /** * @param formbuilderinterface $builder * @param array $options */ public function buildform(formbuilderinterface $builder, array $options) { /* ... */ } /** * @param optionsresolver $resolver */ public function configureoptions(optionsresolver $resolver) { $resolver->setdefaults( [ 'invalid_message' => 'the selected entity not exist', ] ); } /** * @return string */ public function getparent() { return entitytype::class; } then registred service <services> <service id="main.type.extended_entity" class="main\form\type\extendedentitytype"> <tag name="form.type_extension" extended-type="symfony\component\form\extension\core\type\entitytype"/> <argument type="ser...

javascript - CSS isn't linking to HTML -

i'm not able link external css html. have code in head of index.html file: <head> <title>twenty html5 up</title> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <link rel="stylesheet" href=".../assets/css/main.css" /> </head> my file directory looks this: /node-html /views /assets /css /main.css /fonts /js /images index.html index.js how can fix this? index.html same level assets. try this: <link rel="stylesheet" href="assets/css/main.css" />

amazon web services - AWS API Gateway to S3 - PUT Content-Encoding .Z Files -

i have run issue using api gateway proxy s3 (for custom authentication), in not handle binary data (which known issue). i'm uploading either .gz or .z (unix compress utility) files. far understand it, data not maintained due encoding issues. can't seem figure out way decode data binary. original leading bytes: \x1f\x8b\x08\x08\xb99\xbew\x00\x03 after passing through api gw: ��9�w� ... followed filename , rest of data. one way of 'getting around this' specify content-encoding in header of put request api gw 'gzip'. seems force api gw decompress file before forwarding s3. the same not work .z files compressed unix compress utility. should specify content-encoding 'compress'. does have insight happening data, shed light on issue? also, know possible work-around's maintain encoding of data while passing through api gw (or decode once it's in s3)? obviously access s3 api directly (or have api gw return pre-signed url accessin...

module - Global variable not defined after separating functions to separate Python file -

continuing write dictionary attack script project. my script calls upon 2 functions perform actual dictionary attack on ssh. first declared global variable in get_args() function in main.py , following main() function def get_args(): # stuff parsing blah blah global service, username, wordlist, address, port, delay service = args.service username = args.username wordlist = args.password address = args.address port = args.port delay = args.delay return service, username, wordlist, address def main(): service, username, wordlist, address = get_args() # output , stuff # ssh bruteforce if service == 'ssh': if address none: print r + "[!] need provide ssh address cracking! [!]" + w else: print c + "[*] address: %s" % address + w sleep(0.5) global port if port none: print o + "[?] port not set. automatically set 22 [?]"...

mysql - Will DISTINCT always return a same order of values for a same SQL? -

i have sql statement pattern select id table [conditions] order [orders] limit 10000 offset 0 and return value below: id ----- 1 0 0 0 0 1 1 1 2 2 ... then want distinct value order of first appearance, since there's order in sql, , distinct or group both happened before order in sql, tried below sql. select distinct id (select id table [conditions] order [orders] limit 10000 offset 0) tmp; and result want: id ---- 1 0 2 ... my question is: can ensure in same pattern sql, distinct return distinct id order first appearance? thanks. ---------------notes------------------ below can ignored. noticed many peoples recommended try group by, tried below sql well: select id (select id table [conditions] order [orders] limit 10000 offset 0) tmp group id; but returning reordered alpha-beta order (it's not integer order because column char column real id string), not want. id ---- 0 1 10 100 .... if want results in particular order, need specify in ...

Why is my c# code not working? -

i have made console program in c# to-do task manager. not work when code reached: using system; using system.collections.generic; using system.io; using system.linq; using system.text; using system.threading.tasks; namespace to_do_list { class program { static void main(string[] args) { string path = @"c:\todotask.txt"; console.writeline("to-do program"); while (true) { if (console.readline() == "exit") { environment.exit(0); } if (console.readline() == "add") { console.writeline("please write task , press enter"); string task = console.readline(); console.writeline("task added"); try { streamwriter sw = new streamwriter(path); sw.writeline(task); } catch...

vb.net - Export to text file from Access missing carriage return at the end of the line -

i have database in access , need export information text file problem have is not exported in correct format. example of text file been exported: info|info1|info3|info4|info5|info6|info7|info8| <this wrong format info|info1|info3|info4|info5|info6|info7|info8 <this correct format as can see, code inserting vertical line @ end of row instead of carriage return. please see code , great: dim connetionstring string dim cnn oledbconnection connetionstring = "connection string.accdb;" cnn = new oledbconnection(connetionstring) dim dtresult new datatable cnn.open() 'change query dim dataadap new oledbdataadapter("select * table", cnn) dataadap.fill(dtresult) cnn.close() 'change path desired path dim ruta string = "path want put text file\" dim archivotxt string = "filename of text file.txt" if not directory.exists(ruta) directory.createdirectory(ruta) end...

How to use templates or dynamic content for php email sending -

phpmailer option send email, , mail() function too, thing generating dynamic content email body, , subject not best. for example i've created php file body templates or class same, difficult maintain. what recomend organizing code? is there way create email templates? (like twig). how organize folders , files? there doc recommendation that? help it's no different you're doing in php generate dynamic html. except instead of sending generated html output via web server client ua, you're sending email ua via mta. 20 years ago thought invent templating engine generate dynamic content (it called php). turns out it's still incredibly useful today. let's have template file looks email. <table> <?php foreach($rows $row) { ?> <tr> <?php foreach($row $column) { ?> <td><?=$column?></td> <?php } ?> </tr> <?php } ?> </table> let's have temp...

systemjs - Angular 2 app slow to load -

i have been reading how system js slow in loading angular 2 apps dependencies, wondering if there way speed up. have small app started @ www.foxridgesc.com if notice, based on angular seed app, takes bit load first time. have put scripts @ bottom etc, still slow. ideas how speed things up? my code here. https://github.com/judsonmusic/foxridgesc

Can I use something like scipy.stats, in Python, to create a fitness function responds like a distribution -

Image
i need create normalised fitness function positive values 0→∞. want experiment, starting (input→output) 0→0, 1→1, ∞→0. maths bit weak , expect not hard, if no how. so output of function should heavily skewed towards 0 , need able change input value produces maximum output, 1. i make linear function, triangular distribution, need set maximum value @ input distinguished (above value looks same.) merge 2 simple expressions this: from matplotlib import pyplot plt import numpy np math import exp def frankenfunc(x, mu): longtail = lambda x, mu: 1 / exp((x - mu)) shortail = lambda x, mu: pow(x / mu, 2) if x < mu: return shortail(x, mu) else: return longtail(x, mu) x = np.linspace(0, 10, 300) y = [frankenfunc(i, 1) in x] plt.plot(x, y) plt.show() this ok , should work, actual values returns don't matter used in binary tournament. still it's ugly , i'd flexibility use statistical distributions scipy or similar if possible. ...

ruby on rails - ActiveRecord order not working -

in controller, after reprioritizing "child", lists children in new order: @child.parent.children.sort_by{|g| g.priority } this, surprisingly, doesn't work: @child.parent.children.order(priority: :asc) why doesn't .order work? instead of sorting correctly, it's sorting previous order before operation run, assume it's using cached results (the query run before in operation). how 1 bust cache, if indeed problem? i've tried @child.reload after reprioritizing no avail. if have ordering on children association might try use reorder apply new ordering: @child.parent.children.reorder(priority: :asc)

php - Alphabet accordion from database jquery -

Image
so im trying display data database in alphabetical order using accordion. here code: <head> <title>headcount - create new project</title> <link href="jquery-ui/jquery-ui.css" rel="stylesheet" /> <script src="jquery-ui/jquery.js"></script> <script src="jquery-ui/jquery-ui.js"></script> <script> $(document).ready(function(){ $("#myaccordion"). accordion({heightstyle:"content"}); $(".source li").draggable({helper:"clone"}); $("#cart").droppable({drop:function(event,ui){ $("#items").append($("<li></li>").text(ui.draggable.text())); }}); }); </script> <style> #myaccordion { width:400px; float:left; margin:25px; } li { ...

javascript - dhtmlxgrid smart rendering and split mode error after sorting -

when use dhtmlxgrid smartrendering , split mode, found error after sorting. have posted question here . i thought had solved problem, didn't. after testing, found when use smart rendering , split mode, error appears after sorting rows. var mygrid; mygrid = new dhtmlxgridobject('gridbox'); mygrid.setimagepath("../../../codebase/imgs/"); mygrid.setheader("sales,book title,author,price,in store,shipping,bestseller,date of publication"); mygrid.setinitwidths("50,80,250,70,70,70,70,100"); mygrid.setcolalign("right,left,left,right,center,left,center,center"); mygrid.setcoltypes("ed,ed,ed,price,ch,co,ro,ro"); var combobox = mygrid.getcombo(5); combobox.put("1","1 hour"); combobox.put("12","12 hours"); combobox.put("24","24 hours"); combobox.put("48","2 days"); combobox.put("168","1 week"); combobox.put("pick",...

ember.js - ember - How to create a user for those who use facebook login -

i'm still quite new ember , i've created custom user signup/login system firebase backend , torii add-on user authentication. i've looked around , there's plenty of tutorials/info on how incorporate facebook login, have done, that's me right now... log in , give session, doesn't create user in users database i've set up. whereas if use custom login, creates user model , saves in users database can retrieve. of right if try retrieve users database logged in through facebook, gives error since not in database, though have uid assigned firebase. so right there seem 2 different kinds of users in app, ones use custom sign , in users table/database, , users sign in using facebook, can't log in. how create user when signs app first time using facebook have same capabilities uses custom sign up? so far have facebook sdk loaded in initializer , have button triggers sign in action in controller passes in "facebook" provider. import ember ...

android - Gravity of BitmapDrawable doesn't work -

Image
i have bitmapdrawable in xml: <?xml version="1.0" encoding="utf-8"?> <bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:antialias="true" android:automirrored="true" android:dither="true" android:gravity="bottom" android:filter="true" android:src="@drawable/test" /> i used bitmap imageview below: <imageview android:id="@+id/detail_img" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/coloraccent" android:src="@drawable/bitmap_drawable"/> the result: can see there padding in top , bottom. , bitmap didn't aligned bottom of imageview, set android:gravity="bottom" in bitmap xml. tried android:gravity="top" , didn't work. what...

javascript - add an object declared on the controller in Angular JS -

i angularjs beginner , have issue. want add data media-object in html using object declared in script inside controller, can't find directive must use. here code: <!doctype html> <html lang="en" ng-app="confusionapp"> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- above 3 meta tags *must* come first in head; other head content must come *after* these tags --> <title>ristorante con fusion: menu</title> <!-- bootstrap --> <link href="../bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"> <link href="../bower_components/bootstrap/dist/css/bootstrap-theme.min.css" rel="stylesheet"> <link href="....

how to Add Apache License 2.0 in an Android App which is using a library powered by Apache -

i need app use library project powered apache, i'm liable use library if add apache license 2.0 in app. question add license in app? is okay, if add boilerplate notice in section of app. boilerplate notice: copyright [yyyy] [name of copyright owner] licensed under apache license, version 2.0 (the "license"); may not use file except in compliance license. may obtain copy of license at http://www.apache.org/licenses/license-2.0 unless required applicable law or agreed in writing, software distributed under license distributed on "as is" basis, without warranties or conditions of kind, either express or implied. see license specific language governing permissions , limitations under license.

Change chef-server settings port -

i have chef-server installed, , wanted run on different port. changed port in default.rb file. chef-server running on different port when trying access via browser redirects default url, says connection refused, because not running on default port. what did miss? please find nginx section of file. default['private_chef']['nginx']['enable'] = true default['private_chef']['nginx']['ha'] = false default['private_chef']['nginx']['dir'] = "/var/opt/opscode/nginx" default['private_chef']['nginx']['log_directory'] = "/var/log/opscode/nginx" default['private_chef']['nginx']['log_rotation']['file_maxbytes'] = 104857600 default['private_chef']['nginx']['log_rotation']['num_to_keep'] = 10 default['private_chef']['nginx']['log_x_forwarded_for'] = false default['private_chef'][...

java - nested tag on opennlp -

hey i'm trying make training data opennlp detect location name within sentences. stuck @ : <start:location> <start:location> north manchester <end> hospital <end> i need detect 2 object, name of hospital , city name. can achive that? i'm using opennlp library version 1.6 on java 8 the way formatted tags won't work way thinking, because outer tag take contents of inner tag string literally far know (and you'll never hit on weird). duplicate sentence 2 different tags, 1 city name, , 1 hospital. also, should have more context around tags in sentence (use complete sentences if can). at point, you'll have start thinking semantics, because in terms of entity extraction ontological thinking, hospital not location entity, can related one. thought, kind of academic, interesting if it's relevant.

Where can I get SharePoint 2013 training course? -

i want learn sharepoint 2013. looking videos , course material. have found many websites providing course material sharepoint 2013 don't know 1 go with. want proceed step step through each topic don't miss anything. refer msdn articles sharepoint 2013 detail understanding examples - https://msdn.microsoft.com/en-us/library/office/jj162979.aspx refer inside sharepoint 2013 book.

reactjs - react + webpack - pass POST data to build -

coming php background, used have index.php 2 things: serve webpage if no parameters set; or serve json data when specific post parameter included in request. something this: // -- index.php <?php if ($_post["some_parameter"]) { ... echo json_encode(somearraydata); exit(0); } ?> <html> ... </html> i have built complete frontend application npm, webpack, webpack-dev-server, , react. having completed first part, how can serve json data instead of html when request includes specific post parameter? i can see 2 ways of doing this: build frontend usual , everytime build bundle, modify index.html , inject php code in it, , rename index.php. have run folder via apache or nginx, i'd able run index.php script. method downright ugly , worst way it. run separate php server serves data or redirects static webpack-generated build. requests should start server, , server determines whether serve data or redirect ...

JSF PrimeFaces - Save value of selected tablecell on buttonclick -

prerequisites: jsf 2.1 primefaces 5.2 glassfish 3.1 story: i got datatable displaying editable values. amount of columns dynamic. in same form button calling save-action of bean save edited data. function self working fine implementation: <p:datatable id="datatable" scrollable="true" widgetvar="wigvardatatable" value="#{mybean.datalist}" var="data" editable="true" editmode="cell" rowkey="rowkey"> <p:columns var="col" value="#{mymodel.columnlist}" style="font-size: 12px"> <f:facet name="header"> <h:outputtext value="#{col.header}" /> </f:facet> <p:celleditor> <f:facet name="output"> <h:outputtext value="#{mymodel.getvaluefortablecell(data, col).value}" /> ...

excel vba - Vlookup Function in vba having repeated task -

i found lookup vba google , did modification. however, have hard time figure out way resolve issue of duplicating coding same task (explain below) objective 1 value , return multiples value @ 1 time. below of steps: the raw data table (data analysis) c8 o399 the lookup value a5 a172 , return result placed @ t5 t172 (at sheet name "graph") then repeat again next duplicating test code @ step 1 , 2 slight different column i definite again raw data table (data analysis) c8 i399 - *different column 1st step the lookup value a5 a172 , return result placed @ v5 v172 ( @ sheet name "graph") i repeat again 1 , 2 until finish lookup multiple return (approximately around 15 values) so having hard time put loop value of column , table changing every lookup. two columns of lookup table raw data allow every lookup task (this different vkloop need specific column for) point add raw data go few thousand line , seeing code using "collection" storeage. not...

ruby on rails - Arrange items in an array by the time they were added to that array? -

basically have collection model , post model, collection has many posts , post belongs many collections. i'll push posts @collection.posts array using << , replicate post being added collection. there way order posts in @collection.posts time pushed array? if yes, how? all relevant models: user.rb class user < activerecord::base has_many :posts, dependent: :destroy has_many :collections, dependent: :destroy end post.rb class post < activerecord::base belongs_to :user has_many :collectables has_many :collections, through: :collectables end collection.rb class collection < activerecord::base belongs_to :user has_many :collectables has_many :posts, through: :collectables end collectable.rb class collectable < activerecord::base belongs_to :post belongs_to :collection end i guess adding order scope definition of association work: # in collection.rb has_many :posts, -> { order('collectables.creat...

Postmark SendMessageAsync Message not sending Email c# -

here code snippet send email using postmark public async task<bool> sendemail(custommailmessage mailmessage) { headercollection headers = new headercollection(); if (mailmessage.headers != null) { var items = mailmessage.headers.allkeys.selectmany(mailmessage.headers.getvalues, (k, v) => new { key = k, value = v }); foreach (var item in items) { headers.add(item.key, item.value); } } var message = new postmarkdotnet.postmarkmessage() { = mailmessage.to, cc = mailmessage.cc, bcc = mailmessage.bcc, = mailmessage.fromname + "<" + mailmessage.from + ">", trackopens = true, subject = mailmessage.subject, textbody = mailmessage.body, htmlbody = mailmessage.htmlbody, headers = headers, }; if (mailmessage.attachmentspath != null) { foreach (string file in mailmessage.attachmentspath)...

sql server - STIntersect geography,geometry datatype -

i have circle , point, point intersects circle in geometry not in geography. declare @circle geography = geography::point(39.10591303215, 21.923140028856, 4120).stbuffer(500) declare @geogpoint geography = geography::point(51.590294, 25.16387, 4120) select @circle,@geogpoint.tostring(),@geogpoint,@circle.stintersects(@geogpoint) declare @circle1 geometry = geometry::point(39.10591303215, 21.923140028856, 4120).stbuffer(500) declare @geomgpoint geometry = geometry::point(51.590294, 25.16387, 4120) select @circle1,@geomgpoint.tostring(),@geomgpoint,@circle1.stintersects(@geomgpoint) i have lot of circle , point,problem geometry intersecting , geography few. for geography , buffer in units per srid. 4120: select unit_of_measure sys.spatial_reference_systems spatial_reference_id = 4120 gives 'metre' you therefore adding 500m buffer point. now, what's distance between 2 (unbuffered) points? declare @circle geography = geography::point(39.10591303215, 2...

sql - Combining output of two queries -

table1: col1 col2 john new york jimmy london jerry mumbai jack perth table2: col1 col3 john 10 jimmy 20 jerry 40 jack 30 query 1 select col1,col2 table1 query 2 is select col1,col3 table2 now since col1 of both queries same, want merge both queries , require following o/p col1 col2 col3 john new york 10 jimmy london 20 jerry mumbai 40 jack perth 30 thanks. try this, select t1.col1 ,t1.col2 ,t2.col3 table1 t1 inner join table2 t2 on t1.col1 = t2.col1

Can't get mongoose findById() working -

from mongo shell db.messages.find({_id:objectid('57b12ca68ea2e15c182044f3')}) works , prints record screen. from express http://localhost:3000/messages/57b12ca68ea2e15c182044f3 app.get('/messages/:id', function (req, res) { console.log('searching user id: ' + req.params.id); // message null, have tried without "mongoose.types.objectid" still null message.findbyid(mongoose.types.objectid(req.params.id), function(err, message) { console.log('found record'); res.setheader('content-type', 'application/json'); res.send(json.stringify(message)); }); }); i null response every time. have tried without using objectid wrapper still null values. mongodb connection fine because have message.find({}, function(err, messages) { ... } returns messages successfully. what doing wrong? turns out incorrectly defined _id: string in mongoose schema file caused issue. removing _id definition solves ...

.net - Change IIS PreloadEnable to True Globally -

i have vendor application uninstall , reinstall application in iis. each time, need reinstate preload settings through command below after installation has completed: appcmd set app "<site>/<sub_site>" /preloadenabled:true this because default value preloadenabled "false". however, looking @ way change default values "preloadenabled" true not need execute above command. advice me how so? i using iis 8.5 i managed find solution this. modify default value via configuration editor under system.applicationhost/sites path. sample command: appcmd set config -section:system.applicationhost/sites "/[name='<site>'].applicationdefaults.preloadenabled:true" /commit:apphost replace <site> accordingly.

High Availability in CEPH monitor -

i have 4 node ceph architecture shown in figure. ceph architecture ceph.conf contains [global] fsid = 23923667-d7af-4138-a6e5-2e38fb999e2d max open files = 131072 mon_initial_members = host1, host2 mon host = 10.xx.xx.1,10.xx.xx.2 public_network = 10.xx.xx.xx/27 cluster_network = 10.xx.xx.xx/27 the first monitor has been attached using following command ceph-deploy mon create-initial second monitor has been added cluster following command ceph-deploy mon add 10.xx.xx.2 we testing high availability cases setup. case 1: brought down node 10.xx.xx.2 , tested connection. ceph , responding monitor 10.xx.xx.1 case 2: brought down node 10.xx.xx.1. unable access ceph cluster via 10.xx.xx.2. is there other way create setup second node becomes master when first node down ? [edit1] the scenario is intial monitor node = mon.a additional monitor node =mon.b,mon.c when bring down mon.b , mon.c ceph working fine. but when bring down mon.a entire ceph cluster gets di...

pdo - Unicode characters not displayed properly with PHP and Vertica db -

summary i'm trying query vertica database using php 7.0.9 , pdo via odbc connection, special characters such accented letters , euro symbol not displayed in generated html page. according vertica docs : all input data received database server expected in utf-8, , data output vertica in utf-8 environment setup os centos linux release 7.2.1511 kernel 3.10.0-327.28.3.el7.x86_64 php 7.0.9 packages installed: php70w-cli-7.0.9-1.w7.x86_64 php70w-7.0.9-1.w7.x86_64 php70w-pear-1.10.1-1.w7.noarch php70w-odbc-7.0.9-1.w7.x86_64 php70w-mbstring-7.0.9-1.w7.x86_64 php70w-common-7.0.9-1.w7.x86_64 php70w-process-7.0.9-1.w7.x86_64 php70w-xml-7.0.9-1.w7.x86_64 php70w-pecl-xdebug-2.4.0-1.w7.x86_64 php70w-pdo-7.0.9-1.w7.x86_64 additional packages: unixodbc-2.3.1-11.el7.x86_64 vertica-client-7.2.3-0.x86_64 relevant configuration files: /etc/vertica.ini [driver] drivermanagerencoding=utf-16 odbcinstlib=/usr/lib64/libodbcinst.so errormessagespath=/opt/vertica loglevel=4 lo...

asp.net - Failed to execute 'send' on 'XMLHttpRequest' -

i have following code in json : function getcrbycrno(crno) { var params = { "crno": crno }; $.ajax({ type: "post", data: json.stringify(params), contenttype: "application/json; charset=utf-8", url: appcojs.getbaseurl() + '/hcis/license-services/se.tcc.clu.services.licenserequest.licenserequest.svc/getcrbycrno', datatype: "json", async: false, complete: getcrbycrnocompleted }); when try execute code asp.net had error: "networkerror: failed execute 'send' on 'xmlhttprequest': failed load ' please advice me ... regards. try setting async:false async:true. i'm not sure why works, guess because html5 newer xml.

sharepoint - How to end workflow when user delete workflow task? -

i have document library start approval workflow, approval task added in task list. the issue facing when delete task list, workflow still remains in in progress state. there out of box way end workflow when user delete task? terminate in-process workflow you can find item on approval workflow triggered (that is, item or document being approved) , view running workflows ...asuming item has not been deleted. from workflows menu item, can terminate running workflow. remove workflow list on other hand, if item or document no longer exists, option remove workflow list or library. you can go workflow settings page list or library contained item being approved , go " remove workflow " page stop in-process workflows of specific workflow template selecting option remove workflow. be aware this stop running instances of workflow , you'll need republish or reattach workflow list before you'll able trigger again on items.

android - Fragment not visible in ViewPager -

i have viewpager want add fragments to. viewpager viewed correctly on screen unfortunately not hold content. i have seen suggestion in posts replace getsupportfragmentmanager() with getchildfragmentmanager() but need actionbar . unfortunately childfragmentmanager not available in appcompatactivity . while debugging have realized fragment's oncreateview() method called , returns layout. question: how can make fragments visible? , main difference code sample ? activity: public class viewpageractivity extends appcompatactivity { private viewpager mviewpager; private list<location> locationlist = new arraylist<>(); private locationsbasehandler db; private custompageradapter madapter; private location mlocation; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_viewpager); locationlist.add(somedata); ...

r - PCA on Control and treated data for different timepoints with replicates -

i new pca, , have confusion. have data has 12 samples of 6 control , 6 treated. there 2 time-point each control , treated , 3 replicates each time-points makes total 12 samples. my data looks : c21 c22 c23 c41 c42 c43 t21 t22 t23 t41 t42 t43 ensg00000000003 660 451 493 355 495 444 743 259 422 204 149 623 ensg00000000005 0 0 0 0 0 0 0 0 0 0 0 0 ensg00000000419 978 928 1161 641 810807 1265 361 998 326 239 1055 ensg00000000457 234 248 444 192 218 326 615 122 395 134 100 406 ensg00000000460 1096 919 1253 693 907 1185 1648 381 1119 422 269 1267 now want carry out pca on data, showing every gene , point control samples , point treated samples (to calculate euclidean distance between genes control , treated). first 6 samples should taken control point , last 6 samples should taken treated. note: need genes plotted on pca graph control , treated samples (not samples self). i did pca aready take...

javascript - Cannot match any routes: "" -

app.routing.ts import { modulewithproviders } '@angular/core'; import { routes, routermodule } '@angular/router'; import { pushcomponent } './push/push.component'; const approutes: routes = [ { path: 'push', component: pushcomponent} ]; export const approutingproviders: any[] = []; export const routing: modulewithproviders = routermodule.forroot(approutes); app.component.ts import { component } '@angular/core'; @component({ moduleid: module.id, selector: 'app-root', template: ` <h1>{{title}}</h1> <nav> <a [routerlink]="['/push']">push1</a> <a [routerlink]="['/push']">push2</a> </nav> <nav> <a routerlink="/push" routerlinkactive="active">push3</a> <a routerlink="/push" routerlinkactive="active">push4</...

java - How to get the index value of an object using ContentAccessor? -

let's i'm trying add content control figure captions.if figure caption has cc need index value of sdtrun para , delete sdtrun after retaining text value. re-insert text value para using index value of sdtrun. int sdtcount = 0; int indexsdt = 0; list<string> text1 = new arraylist<string>(); list<object> objects = p.getcontent(); classfinder sdts = new classfinder(sdtrun.class); new traversalutil(p, sdts); stringbuilder sd = new stringbuilder(); (object o : sdts.results) { sdtrun sdtrun = (sdtrun) o; if (sdtrun.getparent() instanceof p) { contentaccessor ca = (contentaccessor) sdtrun.getparent(); indexsdt = ca.getcontent().indexof(sdtrun); classfinder text2 = new classfinder(text.class); new traversalutil(sdtrun, text2); (object o1 : text2.results) { text tex = (text) o1; sd.append(((text) tex).getvalue()); ...

Conditional coloring in excel/pivot -

Image
hi, i trying set sheet, analyze , compare data within' pivot table (on left) data extracted manually data source (on right). assume table on right portfolio, , table on left stat overview of possible positions. column "s" given as: =if(isna(match(o7,$b$7:$b$119,0)),"", "misa") which lets me know if position on list on left, , column "a" given as: =if(isna(match(b8,$o$4:$o$19,0)),"","1") which lets me know whether asset within list held in portfolio. so inquiry now, list on left have row colored, whenever asset held in portfolio, whenever there "1" in column "a", particular row should colored. have naturally played around conditional formatting, cant seem work. dont know if due fact pivot table vs. function in column "a"??? thanks, psb please make sure range does't have '$'before range column , row numbers. '$' refers static values. in be...

Login on and android app with password stored in DB hashed with PHP Password Hashing -

i'm using php 5.5 password hashing manage login in web application. http://php.net/manual/en/book.password.php our passwords stored in our database hashed using php password hashing. when user wants login compare hashed password database 1 typed user using password_verify . i want expand application allow login android application. the solution have found call php process using post , send password , user name it. process answer 0 or 1 indicating whether login information matches stored username / password pair or not. question: is approach above best approach? yes possible... recommended: it better , safe develop api in server using rest (now login ) can expand functionality in future. additional : might need pass token or current session id server app along other data once created session. bcoz when need store data in sessions in server app should pass session id in every request server details session. because server ...

javascript - How do I create a class decorator for mixing new methods into a React component when using Typescript? -

i'm trying create decorator mix new methods react component. i've gotten desired result via following: function testdecorator(target) { const testmethod = function testmethod() { return 'successfully mixed testmethod component'; }; target.prototype.testmethod = testmethod; } @testdecorator export class testcomponent extends react.component<{}, {}> { // ... render() { console.log('this.testmethod', this.testmethod()); // outputs "successfully mixed testmethod component" } } this compiles , outputs expected value, produces transpiler error: property 'testmethod' not exist on type 'testcomponent'. there way avoid error? i.e. possible teach typescript values mixed (react component) class via decorator? right there no way omit error except of removing type checks casting any or interface have method defined. here pending request: class decorator mutation

php - Yii - call member function out of Yii? -

i know it's not legal, , looking odd. it's necessary me. have 2 project, 1 custom open-cart , second in yii. main project in opencart. yii project kept in main project root. now want call yii function in opencart. please me , tell how call yii function in main project ? this yii function :- $sm=yii::app()->getsecuritymanager(); if ($salt === null) $salt = yii::app()->params['password_security_salt']; if($salt==null) $salt=md5 (mt_rand ().mt_rand ().mt_rand ().mt_rand ()); $pass=sha1($salt.$pass.$salt); return $sm->hashdata($pass,$key).':'.$salt; ..................... i want create new function manually opencart project. please me create new project same functionality yii (upper function) function. you can use yii functionality outside of yii project initialising application so: // in someotherfile.php outside of yii project require_once('framework/yii.php'); $config = require_once(...

odoo 8 website javascript python -

i'm beginner odoo , must create website. want use javascript on website. when read many forums, don't understand how can use javascript. actually, have checkbox on website , when tick checkbox, result change automatically. don't know if it's possible odoo.

asynchronous - How to control sequence of Kafka Messages sent Asynchronously -

i have developed kafka version : 0.9.0.1 application. one important aspect of application messages need consumed in correct sequence. because propagating database rows between 2 databases. means need ensure records within each unit of work sent uow-insert arriving before uow-update. if use asynchronous message production, how can guarantee messages consumed in correct sequence? i employ kafka producer send callback notified whether or not each message successfuly sent. i have acks=all , retries=0 , batch.size=16384 , kafka topics have single partition. my consumer can cope duplicate messages, e.g. in case of retries being necessary, consumers cannot cope messages out of sequence. my retry approach fail fast, e.g. messages fails send report records log record sequence number (lrsn) or relative byte address (rba) , stop sending messages. then reset source database logs reported lrsn or rba , restart message production. for example send messages message ...

How to accept dynamic inputs in qt -

hi in linux if give command su asks password , if enter right password login's super user ,in similar fashion how can through qt application what classes used,is possible ..? you can qlineedit class connect signal returnpressed method save first string, change echo mode setechomode() , set qlineedit::password , when user erite second time see write ***** , when press enter can password in same method connected returnpressed signal. void mainwindow::on_lineedit_returnpressed() { if (ui->lineedit->echomode() == qlineedit::password) { _pwd = ui->lineedit->text(); ui->lineedit->setechomode(qlineedit::normal); // job after getting password here } else { _loggin = ui->lineedit->text(); ui->lineedit->setechomode(qlineedit::password); } }

ruby on rails - 503: Instagram is rate limiting your requests -

for past 2 days, have been facing issue. 503: instagram rate limiting requests there 2 types of query causes error. though there no discern-able consistency can find. get https://api.instagram.com/v1/users/self/media/recent.json?access_token=<user token>: 503: instagram rate limiting requests. https://api.instagram.com/v1/users/self.json?access_token=<user token>: 503: instagram rate limiting requests. i have searched documentation ( https://www.instagram.com/developer/ ) unable find references 503 errors. the other links have been looking @ following. instagrm rate limit issue https://imranakbar.wordpress.com/2012/09/13/rate-limit-exceeded-instagram-error/ as using instagram-ruby gem, seems service unavailable? raise instagram::serviceunavailable, error_message_500(response, "instagram rate limiting requests.") refer link more information on instagram-ruby gem https://github.com/facebookarchive/instagram-ruby-gem/blob/master/lib/faraday/...

ruby on rails - How can i use form_for so as to get a hidden_field value using params in controller#create -

i need help.i need current_user.id (i use devise gem) articles#create . wanna pass means form_for , hidden field . i've written: <%= form_for :article, url: articles_path |f| %> <p> <%= f.label :title %><br/> <%= f.text_field :title %> </p> <p> <%= f.label :text %><br/> <%= f.text_area :text %> </p> <p> # it's here <%= f.hidden_field :user_id %> i've got: <input type="hidden" name="article[user_id]" id="article_user_id"/> but need: <input type="hidden" name="article[user_id]" id="article_user_id" value="2"/> i've written html code in new.html.erb <input type="hidden" name="article[user_id]" id="article_user_id" value="<%= current_user.id%>"/> and active record saved object database.i inspect params , don...

c# - Speed up model instantiation for EF6 / sqlite db -

i have large collection of 12000 data entries example , want insert them via ef6 sqlite database. time consumes the instantiation of data models: at moment loop 12000 times 'new myitem()' downloaded12000items.foreach(result =>{ var myitem= new myitem { id = result.id, description = result.description, property1 = result.property1 } resultlist.add(myitem); }); unitofwork.itemrepository.insertrange(resultlist); how can speed instantiation of models or there maybe way insert data faster sqlite database? edit: have explain problem better. bottleneck not insert() database. use ef6 .insert(somemodel) have create instance of modelclass of entity. have 12000 times, instantiation of 12000 modelclasses takes time. my question was, there possibility fasten instatiation process of model classes, maybe cloning or else? or, there maybe chance insert data sqlite db without using .insert(somemodel), maybe using direct sql command or ...

Switching int and string arrays in Java -

i've been working on assignment time , i'm stuck. purpose make int array numbers 1-5, , make string array 6-10, put 6-10 in int array , 1-5 in string array, , afterwards stuff it. i've done of "stuff" ( multiply, add etc ) can't figure out how switch 2 arrays each other. i've tried few methods found on stackoverflow couldn't implement them. methods tried commented out here's code : import java.util.*; import java.io.*; public class rebel { public static void main (string[] args) { int[] numbers = {1,2,3,4,5}; string[] words = {"6", "7", "8", "9", "10"}; system.out.println(numbers.getclass().getname()); // test data type before converting system.out.println(words.getclass().getname()); // test data type before converting for(int = 0; < numbers.length; i++) // prints out int array { system.out.println(numbers[i]); } for(i...