Posts

Showing posts from February, 2014

c# - How can I initialize an instance of a derived class from an instance of the base class? -

i've looked @ how can create instance of derived class instance of base class , include private fields? , create instance of derived class base class either i'm not getting it, or they're not quite i'm looking for. i have class, derived another, implementing particular interface: public class derivedclass : baseclass, iderivedclass baseclass implements ibaseclass , iderivedclass inherits ibaseclass . sometimes, want able initialize derived class, when have instance of base class. create constructor copies each of properties instance of base properties of instance of derived class, there way? along lines of: baseclass bc = new baseclass(); derivedclass dc = new derivedclass() : bc; is do-able? if not, why not? i'm prepared accept might not possible, if so, i'd quite interested if can explain why. no, not possible. you have create object since has have characteristics of second object. can't copy 1 another. might object invalid

Delphi Firedac Memory Tables -

i trying replace delphi clientdatasets worked fine slow on large data firedac memorytables create firedac memory table in data module , populate form. in form check record count of memory table , contains records. close memory table , reopen returns empty table after opening. dataform.mtdebtran.filename := cdsdir + '/debtran.fds'; dataform.mtdebtran.createdataset dataform.mtdebtran.createdataset; dataform.mtdebtran.open; dataform.builddebtrantemp1(p1,p2,p3,p4,true,true); dataform.mtdebtran.savetofile(cdsdir + '/debtran',sfbinary); showmessage(inttostr(dataform.mtdebtran.recordcount)); dataform.mtdebtran.close; dataform.mtdebtran.open; showmessage(inttostr(dataform.mtdebtran.recordcount));` is real code, , complete? you're calling createdataset twice in succession dataform.mtdebtran.createdataset dataform.mtdebtran.createdataset; for no apparent reason, anyway if mtdebtran dataset supposed contain data before first call createdataset, call em

c# - MVC Stream Picture rotated -

i want use rotated image in mvc application. purpose worte controller returns rotated image, cant working. this command: public actionresult picturestreamrotate(string filename) { image image = image.fromfile(filename); image.rotateflip(rotatefliptype.rotate90flipnone); memorystream stream = new memorystream(); image.save(stream, imageformat.jpeg); return file(stream, "image/jpeg"); } the image streamed invalid. dies have idea. input picture jpg file. btw. if remove thw line image.rotateflip wont work. this happens because stream's position after written data. toarray() get's in stream start. alternatively, set position 0 or seek start of image data. try in linqpad: var x = new memorystream(); x.writebyte(123); x.readbyte().dump(); it gives -1 result... then x.position=0; and 123 back. btw, toarray() copies data, not want, guess.

What's the difference when installing docker with 2 of these following command? -

when comes install docker on centos, found 2 different ways it. the first 1 : yum install docker-engine the second 1 is: yum install docker-io and in case installed docker using first one, continue second 1 error appeared, this: error: docker-engine conflicts docker-1.8.2-10.el7.centos.x86_64 error: docker-engine-selinux conflicts docker-selinux-1.8.2-10.el7.centos.x86_64 so can tell me what's difference between them? this dates from june 2015 , when docker announced "new apt , yum repos" that when new packages ( like 1 centos ) named docker-engine (initially replace lxc-docker* )

cryptography - Issues with a Node.js implementation of AES256 CBC -

Image
let me start off saying new cryptography. i'm trying implement cipher block chaining mode in node.js. my problem after encryption without decryption stops working 1 decryption function call. here's code: var crypto = require('crypto'); var encryptionmethod = 'aes-256-cbc'; var vector = new buffer([0xf1, 0x4c, 0xb6, 0xbd, 0x82, 0x93, 0x3c, 0x97, 0x6a, 0x4b, 0x4a, 0xd2, 0xad, 0xd5, 0xa8, 0x6d]); var key = new buffer([59, 92, 128, 239, 136, 26, 19, 26, 226, 234, 53, 71, 157, 113, 209, 96, 111, 83, 167, 123, 217, 107, 124, 31, 238, 176, 58, 110, 161, 82, 81, 69]); var cipher = crypto.createcipheriv(encryptionmethod, key, vector); cipher.setautopadding(false); var decipher = crypto.createdecipheriv(encryptionmethod, key, vector); decipher.setautopadding(false); var encrypt = function(array) { return cipher.update(new buffer(array)); }; var decrypt = function(buffer) { return decipher.update(buffer); }; var data = []; (var = 0; < 32; i++) { dat

how to find information inside the zip file in alfresco-4.2.2 version -

we using alfresco-4.2.2 version.we uploading zip files.let's have uploaded test.zip. want know zip file information how many files inside zip file.when search forms saying files stored in c:\alfresco\alf_data\contentstore path , stored in .bin format , couldn't find zip file have uploaded.is there way find information? you not familiar alfresco development, think first thing check jeff potts' tutorial . once got familiar content models , custom behaviours , custom actions , can following : design custom model (type or aspect) in order include meta information (ex. file size, number of included files, compression ratio, ....) either develop rule action extract meta data file , set properties (you need setup rule on each , every folder want ....) or trick custom behaviors onaddaspect instance, if aspect my:zipfile !

c# - Email sent through localhost but not sent when I try to send from my Server -

email sent through localhost not sent when try send server. what do. note : use port 25 , host : mail.mydomain.com. failure sending mail. could me please? i have used code: public static string sendmail(string host , string , string pass , int port , string pto, string subject, string body, string attach) { string host = host; string receiveremailaddres = pto; string senderemailaddresss = from; string senderemailpassword = pass; smtpclient mymail = new smtpclient(); mailmessage mymsg = new mailmessage(); mymail.host = host; mymail.port = port; mymsg.to.add(new mailaddress(receiveremailaddres)); mymsg.subject = subject; if (attach != string.empty) { attachment data = new attachment(attach); mymsg.attachments.add(data); } mymsg.isbodyhtml = true; mymsg.from = new mailaddress(senderemailaddresss); mymsg.bo

c# - Handling form submit event -

i have following form: @using (html.beginform(new { returnurl = viewbag.returnurl, @class = "form-vertical login-form", id = "loginform" })) <button type="submit" class="btn green pull-right"> login <i class="m-icon-swapright m-icon-white"></i> </button> } and javascript handling event function $(document).ready(function () { $("#loginform").submit(function () { alert('handler .submit() called.'); return false; }); } however doesn't work @ all. the alert never triggered that's normal, never assigned form id or class . @ generated html in browser understand mean. you using wrong overload of beginform helper. try instead: @using (html.beginform(null, null, new { returnurl = viewbag.returnurl }, formmethod.post, new { @class = "form-v

ruby on rails 4 - error : gem install sqlite3 -v '1.3.11'` succeeds before bundling -

when tryed deploying rails application, log said error below. ebug [4b7b573d] error occurred while installing sqlite3 (1.3.11), , bundler cannot continue. make sure `gem install sqlite3 -v '1.3.11'` succeeds before bundling. cap aborted! sshkit::runner::executeerror: exception while executing [----]: bundle exit status: 5 bundle stdout: error occurred while installing sqlite3 (1.3.11), , bundler cannot continue. make sure `gem install sqlite3 -v '1.3.11'` succeeds before bundling. bundle stderr: nothing written sshkit::command::failed: bundle exit status: 5 bundle stdout: error occurred while installing sqlite3 (1.3.11), , bundler cannot continue. make sure `gem install sqlite3 -v '1.3.11'` succeeds before bundling. bundle stderr: nothing written tasks: top => deploy:updated => bundler:install (see full trace running task --trace) deploy has failed error: #<sshkit::runner::executeerror: exception while executing [------]: bundle exit status:

html - vertical-align only one inline block element -

i have 3 inline block elements, image , 2 pieces of text. modify class image such middle aligned while other 2 text blocks remain top aligned. seems work if set .subimg have vertical-align:top; , .subsection have vertical-align:middle; not the other way around. why , how fix it? thanks here's code: demo html <div id="about"> <div class="section"> <img class="subimg" src="https://cdn.photographylife.com/wp-content/uploads/2014/06/nikon-d810-image-sample-6.jpg" alt="image"> <div class="subsection"> <h2>blah</h2> <hr> <p>blah<br>blah<br>blah<br>blah<br>blah<br>blah<br></p> </div> <div class="subsection"> <h2>blah</h2> <hr> <p> blah

Android application crashes when callling Intent -

android application crashes when call intent give proper solution public class informationactivity extends activity { button btn_submit; checkbox iz_check,bc_check,vc_check,ac_check,uc_check; edittext no_et; @override protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); setcontentview(r.layout.activity_info); btn_submit = (button) findviewbyid(r.id.btnsubmit1); iz_check= (checkbox) findviewbyid(r.id.check1); bc_check=(checkbox) findviewbyid(r.id.check2); vc_check=(checkbox) findviewbyid(r.id.check3); ac_check=(checkbox) findviewbyid(r.id.check4); uc_check=(checkbox) findviewbyid(r.id.check5); no_et=(edittext) findviewbyid(r.id.edittext7); btn_submit.setonclicklistener(new onclicklistener() { @override public void onclick(view arg0) { // todo auto-generated method stub //string str = no_et.gettext().tostring();

java - how to read file from resource folder in eclipse -

i'm trying read xml file resource folder inside webcontent in eclipse project. problem i'm unable read file resources folder working fine giving path outside(ie,e:/new/test.xml). file file = new file(request.getsession().getservletcontext().getcontextpath()+"/resources/new/test.xml"); can please me solve issue..thanks in advance. you can read content classpath follows getclass().getresourceasstream("/new/test.xml"); in eclipse webcontent not in classpath, default thing in classpath /src/test see what's in classpath go project-settings -> java build path, add folders on source tab, folders in classpath.

Symfony bower vesionized packages -

official symfony2 documentatation writes: bower not have "lock" feature, means there's no guarantee running bower install on different server give exact assets have on other machines. more details, read article checking in front-end dependencies. but can init bower.json , in file have dependencies precized version like #bower.json "dependencies": { "html5shiv": "3.7.1", "bootstrap-sass-official": "3.3.0", } so if use bower install should install precized version of packages. dont understand bower.lock neeeded ? symfony website warns situation. for example there lock file in composer in way when define php dependency in composer.json following. "require": { "php": ">=5.3.3", } it means php version should @ least 5.3.3 or above. in situation lock file important make server's synced. but in requirements there no need wonder about. beca

c# - Adding Column to populated DataSet -

i'm trying add column dataset has sql table data. wanted add column after data loaded keep track of values in database , values new in datagrid. can know rows add database. appreciate help. here code, i'm trying column show @ point, worry updating rows new column later. sqlcom.commandtext = @"insert members (firstname, lastname) values ('" + textbox1.text +"', '"+ textbox2.text +"')"; sqlcom.executenonquery(); sqldataadapter sqladapt = new sqldataadapter("select * members", thisconnect); dataset ds = new dataset(); sqladapt.fill(ds, "members"); //add column dataset? ds.tables["members"].columns.add("indb"); datagridview1.datasource = ds; datagridview1.datamember = "members"; thisconnect.close(); try this, ds.tables["members"].columns.add(new datacolumn("indb",

php - Apply different tax based on user role and product category (Woocommerce) -

i need apply different tax if user have specific role, in certains product's categories. example: if customer role "vip" buy item of category "bravo" or "charlie" tax applied @ 4% instead 22% this code in part wrote me part taken on google, don't understand wrong. please can me? function wc_diff_rate_for_user( $tax_class, $product ) { global $woocommerce; $lundi_in_cart = false; foreach ( $woocommerce->cart->get_cart() $cart_item_key => $values ) { $_product = $values['data']; $terms = get_the_terms( $_product->id, 'product_cat' ); foreach ($terms $term) { $_categoryid = $term->term_id; } if (( $_categoryid === 81 ) || ( $_categoryid === 82 ) )) { if ( is_user_logged_in() && current_user_can( 'vip' ) ) { $tax_class = 'reduced rate'; }

sql server - Get records where one column is same but another column is different -

i'm trying compare 2 "lists" in same table , records customerid column has same value storeid different. lists (table definition) name listid storeid customerid comparinglist1 1 10 100 comparinglist1 1 10 101 comparinglist1 1 11 100 comparinglist1 1 11 102 comparinglist1 1 11 103 comparinglist1 1 11 104 comparinglist2 2 10 100 comparinglist2 2 10 101 comparinglist2 2 11 100 comparinglist2 2 11 102 comparinglist2 2 11 103 comparinglist2 2 12 104 comparinglist2 2 12 105 query select comparinglist2.customerid customerid, comparinglist1.storeid expectedstoreid, comparinglist2.storeid actualstoreid lists comparinglist2 left join lists comparinglist1 on comparinglist1.customerid = comparingli

Jquery - get "defined" height of an element -

in code, element (tr) has inline style tag defines height of 31px. after rendering, height of tr expands 32px, because of content. i'm trying read height of 31px via jquery, these methods computed height of 32px. my question is: have read style attribute , extract height there, or there way getting value using jquery (or native javascript). you can use .height trheight = document.getelementbyid("mytr").style.height;

django - Query on neo4j parent class doesnot return anything -

i have defined parent class of person , , subclass of father following: class person(models.nodemodel): first_name = models.stringproperty() middle_name = models.stringproperty() last_name = models.stringproperty() class father (person) profession = models.stringproperty() after creating number of father s, can of them father.objects.all() . however, running code person.objects.all() nothing found (i.e. [] )! as far know last query should return objects well! there solution? are using neo4django? if so, believe fixed in master on github . can install github using pip- pip install -e git+https://github.com/scholrly/neo4django/#egg=neo4django . if still isn't working, consider raising issue , i'll see can do.

ios - how to show view controller from UIPreviewAction in swift -

i support 3d touch, did when using strong pulled cell appeared controller , user picked up, shown action, there button show want when user clicks on it, controller opens. how can show controller? @available(ios 9.0, *) override func previewactionitems() -> [uipreviewactionitem] { let showaction = uipreviewaction(title: "show", style: .default) { [weak self] (action: uipreviewaction, vc: uiviewcontroller) -> void in guard let weakself = self else { return; } if let _popaction = weakself.popaction { _popaction() } self?.showviewcontroller(vc, sender: nil) print("show city controller") } return [showaction] } i changed code @available(ios 9.0, *) override func previewactionitems() -> [uipreviewactionitem] { let showaction = uipreviewaction(title: "show", style: .default) { [weak self] (action: uipreviewaction, vc: uiviewcontroller) -> void

ios - Content offset stays constant -

i've got uipageviewcontroller in app, set this: self.pageviewcontroller = [self.storyboard instantiateviewcontrollerwithidentifier:@"mainpageviewcontroller"]; self.pageviewcontroller.datasource = self; self.pageviewcontroller.delegate = self; self.pageviewcontroller.view.frame = cgrectmake(0, 0, self.view.frame.size.width, self.view.frame.size.height); [self addchildviewcontroller:self.pageviewcontroller]; [self.view addsubview:self.pageviewcontroller.view]; [self.pageviewcontroller didmovetoparentviewcontroller:self]; i've made uiviewcontroller conform uiscrollviewdelegate , added code set scrollview delegate self : (uiview *currentview in self.pageviewcontroller.view.subviews) { if ([currentview iskindofclass:[uiscrollview class]]) { uiscrollview *scrollview = (uiscrollview *)currentview; scrollview.delegate = self; break; } } then i'm trying use method find current page, though contentoffset stays same wheneve

logging - How to get "max" attribute value of DefaultRolloverStrategy in log4j2 in Java -

i have 1 concern in log4j2. in below appender definition, default rollover strategy employed shown below: <defaultrolloverstrategy max="5" /> i need access value of max in java customizations. please me how value can retrieved. can appender logger not aware how max value of defaultrolloverstrategy defined within appender. <rollingfile name="test_file" filename="${sys:logs}/test.log" filepattern="${sys:logs}/test.log.%i" append="true"> <patternlayout> <pattern>%d %-5p [%c{1}] [customdata: %data] [%t] %m%n</pattern> </patternlayout> <policies> <sizebasedtriggeringpolicy size="500 kb" /> </policies> <defaultrolloverstrategy max="5" /> <filters> <thresholdfilter level="debug"/> <thresholdfilter level="off" onmatch=&

oncreateoptionMenu in android toolbar -

Image
hello friends want create option menu below image so create below menu.xml file: <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:id="@+id/live_cart" android:orderincategory="100" android:showasaction="always" android:icon="@drawable/cart" android:title=""/> <item android:id="@+id/overflow" android:orderincategory="100" android:showasaction="always" android:icon="@drawable/ic_menu_overflow" android:title=""> <menu> <item android:id="@+id/action_dasbboard" android:title="logout" android:showasaction="never" /> <item android:id=&q

html - How to set css to a specific selector using jQuery -

consider following html: <div class="bl-dark separator"> <div class="bl-icon-wrapper"> <div class="bl-icon-border"></div> <div class="bl-icon-scale-bg dark"></div> <div class="bl-icon-background"></div> <div class="bl-icon-dark icon"></div> </div> </div> when click occurs user, selector bl-icon-wrapper have class added using jquery, updated html be: <div class="bl-dark separator"> <div class="bl-icon-wrapper selected"> <div class="bl-icon-border"></div> <div class="bl-icon-scale-bg dark"></div> <div class="bl-icon-background"></div> <div class="bl-icon-dark icon"></div> </div> </div> now in css have selector filled: .selected .bl-ico

visual c++ - Typedef to surrounding type in C++ -

is there way build typedef inside type declaration declared (surrounding) type without stating type's name? example: class x { public: typedef <fill in magic here> mytype; //... }; background: seems silly on first look. need because build compile-time-reflection of data classes using macros. there macro inserted declaration of data class needs deal type inserted into. far found working solutions msvc , g++ both rely on think flaws in implementation. may not work on newer version. clang not "eat" either of these solutions. my current solution msvc defines method , takes it's address it's name , calls small helper "returns" type of it's class. (clang , g++ expect full name of method including it's class name). my current solution g++ defines static method return type std::remove_reference(decltype(*this)) . (clang , msvc not allow this in static context). i absolutely prefer standard conform solution special solution

fabricjs - Multiple fabric curved text onjects in a single canvas -

i'm adding multiple curved text in single canvas fabric.js. have added first object in canvas. when i'm going add second object in canvas, object controls displayed perfectly. starting position of text not @ top-left corner of object. , don't know i'm wrong. if knows issue solution, answer appreciated. here code. <html> <head> <script src="//code.jquery.com/jquery-1.12.0.min.js"></script> <script src="fabric.js"></script> <script src="fabric.curvedtext.js"></script> <script type="text/javascript"> $(function () { var canvas = new fabric.canvas('c'); var uppercurvedtext = new fabric.curvedtext('upper curved text', { top: 0, left: 500, textalign: 'center', radius: 500, fontsize: 30, spacing: 30,

list - Function always return Nil -

i trying resolve anagrams assignments. , can't figure out problem behind getting list() when running sentenceanagrams function. ! type word = string type sentence = list[word] type occurrences = list[(char, int)] def combinations(occurrences: occurrences): list[occurrences] = occurrences match { case nil => list(nil) case x :: xs => (for {z <- combinations(xs); <- 1 x._2} yield (x._1, i) :: z).union(combinations(xs)) } def subtract(x: occurrences, y: occurrences): occurrences = { if (y.isempty) x else { val ymap = y.tomap withdefaultvalue 0 x.foldleft(x) { (z, i) => if (combinations(x).contains(y)) { val diff = i._2 - ymap.apply(i._1) if (diff > 0) z.tomap.updated(i._1, diff).tolist else z.tomap.-(i._1).tolist } else z } }} -- def sentenceanagrams(sentence: sentence): list[sentence] = { def sentenceanag(occ: occurrences): list[sentence] = if (occ.isempty) list(list()) else (for { comb <- combinatio

Is there a way to change the DirText font in NSIS script -

in nsis script want change text of dirtext string red in mui_page_directory, how can this? please suggest. ps: using getdlgitem able modify text box , title bar only. !include mui.nsh !define mui_page_customfunction_show ondirpageshow !insertmacro mui_page_directory !insertmacro mui_page_instfiles !insertmacro mui_language "english" function ondirpageshow findwindow $0 "#32770" "" $hwndparent getdlgitem $1 $0 0x3ee setctlcolors $1 ff0055 transparent functionend

transactions - Spring 3.1 - DefaultMessageListenerContainer - How to identify errors in ErrorHandler -

info :: have defaultmessagelistener implementation xa transaction. have used messagelistener implementation. scenario:: xa transaction between db , jms q publish. in case of "data error" in either of them, need "move" source message different q , continue processing rest of messages. problem:: now, if db transaction fails dataintegrity error (primary key violation) then, xa transaction rolls @ container (and not in messagelistener implementation). original message rolls q, , message listener gets stuck message indefinitely -receiving , failing processing. how can check exceptions - , handle them differently in container can continue rest of messages. ginz well, that's point of xa transaction - either commits or nothing does. if want database transaction not have bearing on jms transaction, need @transactional(propagation=propagation.requires_new) on method upstream of listener. catch , handle exception in listener , jms transaction c

c# - enum property inconsistent accessibility -

i new @ csharp, , not understand problem. public abstract class player { protected behaviour fbehaviour; public behaviour fbehaviour { get; set; } the error says error 6 inconsistent accessibility: field type ... less accessible field ... i've tried changing everything, nothing worked. it means class behavior not public, player , trying expose public. change behavior public.

c++ - Deduce first template parameter in multiple parameter template by parameter -

first question , explanation of i'm trying might approaching problem wrong. is possible deduce first template parameter in multi parameter template parameters while specifying other parameters. example: template<class a, class b> b function(a object) { return b(a); } called like: function<btype>(ainstance); i not find way make work. edit: example might fit better problem below indicated me first comment got example: template<class a, a::b foo> void function(a object) { object.dosomethingwithtypea::b(foo); } called like: function<a::binstance>(ainstance); the difference second template parameter dependent on specific type of first can not switch template parameters around. now description of trying do: i trying create templates universal functor class can take either free function or member function , wrap functor. i succeeded in set out want make bit more user friendly. templated function create functor

java - Why Spring MVC 4 and Hystrix integration not working without Spring boot API? -

before start let me tell i'm trying integrate spring mvc 4 application hystrix(i.e. using hystrix-javanica full annotation support). below piece of code.... configuration class: @configuration public class beanconfig { @bean public hystrixcommandaspect hystrixcommandaspect() { return new hystrixcommandaspect(); } } hystrix enabled service class @service(value="userrepository") public class userrepositoryimpl implements userrepository{ @override @hystrixcommand(fallbackmethod = "failservice", commandproperties = { @hystrixproperty(name = "execution.isolation.thread.timeoutinmilliseconds", value = "500") }, threadpoolproperties = { @hystrixproperty(name = "coresize", value = "30"), @hystrixproperty(name = "maxqueuesize", value = &qu

int - How to deal with big float numbers in python -

some part of code generates big int number, further used in other calculations.this number generated calling factorial function . since in other calculation , float numbers , big int involved ,so getting error saying "overflowerror: long int large convert float". is there anyway work around limitation ? here attaching code . import numpy np #=============================alpha def alpha(li,dtype=float): ai=1.0 mi in range(1,li+1): ai=ai*(1-(1/(2.0*mi))) return ai def gamma(li,dtype=int): return np.power(np.exp(1)/li,li)*(np.math.factorial((li))) def j1j2(xi,deltai,dtype=int): xii=np.abs(xi) j1i=np.power(np.abs(xii-deltai),2.0) j2i=np.power(np.abs(xii+deltai),2.0) return int(np.floor(j1i)),int(np.ceil(j2i)) #========================*********** def r(xi,sigmai,ni,dtype=float): ui=xi/sigmai a1i=np.power(np.exp(1)/ni,ni) a2i=np.power(ui,2.0*ni) a3i=(np.power(ui,2.0)) a4i=np.exp(-a3i) ri=a1i*a2i*a

php - woocommerce: join post and product category -

i'm working on e-commerce website , know if it's possible have same category posts , woocommerce products ? both articles , products specific category. i've tried https://wordpress.org/support/topic/relating-a-post-to-a-product-category make products categories appears in posts don't know how display them in posts loop. <article <?php post_class(); ?>> <header> <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> <?php the_tags('<ul class="entry-tags"><li>','</li><li>','</li></ul>'); the_category( ' ' ); ?> </header> <div> <?php the_excerpt(); ?> <?php if ( has_post_thumbnail() ) { the_post_thumbnail(); } ?> </div> </article> thanks in advance. checkout https://wordpress.org/support/topic/relating-a-post-to-a-

motionevent - Android Motion Event -

i trying android motion event. however, not know why cant go > case motionevent.action_move: here codes. @override public boolean ontouch(view v, motionevent event) { int action = event.getaction(); switch (action){ case motionevent.action_down: startx = (int)event.getx(); starty = (int)event.gety(); selecting=false; break; case motionevent.action_move: selecting=true; break; case motionevent.action_up: if(selecting){ endx = (int)event.getx(); endy = (int)event.gety(); selected=true; } selecting=false; break; } } no matter how swipe , touch, if remove if(selecting) condition in case motionevent.action_up, show same output. start: {498.0, 365.0} end: {0.0, 0.0} selecting: false selected: false after change public boolean ontouchevent(motionevent eve

php - Redirection to login on user auth with Laravel 5.2 -

i have laravel 5.2 application running ok in live server. running ok in ubuntu 14.04 apache server. now using mac made fresh installation of app using mamp pro application. runing ok in frontend when try login backend there redirection doesn't allow me authenticated. db same, user should authenticated. when type user , password , hit send screen shows: redirecting http://localhost/admin/dashboard then screen refresh again , shows: redirecting http://localhost/admin/auth/login i have think maybe related session, stablished to: 'driver' => env('session_driver', 'file'), so not know why can reason. idea? update - include summary of routes.php this routes.php file (chunks of it) // admin area route::get('admin', function () { return redirect('/admin/dashboard'); }); route::group([ 'namespace' => 'app\http\controllers\admin', 'middleware' => 'auth.admin', ], function () {

c++ - http client in proxygen? -

hi using proxygen facebook create simple hhtpclient . trying run default httpclient example. using following command build it: g++ -std=c++11 -o my_echo curlclient.o curlclientmain.o -lproxygenhttpserver -lfolly -lglog -lgflags -pthread but getting following error: curlclient.o: in function `curlservice::curlclient::connectsuccess(proxygen::httpupstreamsession*)': /home/kshitij/proxygen/httpclient/samples/curl/curlclient.cpp:69: undefined reference `proxygen::httpupstreamsession::newtransaction(proxygen::httptransactionhandler*)' curlclientmain.o: in function `main': /home/kshitij/proxygen/httpclient/samples/curl/curlclientmain.cpp:91: undefined reference `proxygen::httpconnector::httpconnector(proxygen::httpconnector::callback*, folly::hhwheeltimer*)' /home/kshitij/proxygen/httpclient/samples/curl/curlclientmain.cpp:102: undefined reference `proxygen::httpconnector::connect(folly::eventbase*, folly::socketaddress const&, std::chrono::duration<long,

wordpress - Paginate On Custom Page Template -

i not quite understand wordpress. maybe stupid question. i create custom page, blog name. blog posts entered. want ask how create pagination << pre [1] [2] [3] ... next >> , post number determined settings> reading> blog pages show @ .... post. this code. <div class="page-content"> <?php $paged = (get_query_var('page')) ? get_query_var('page') : 1; $args_recent_posts = array( 'post_type' => 'post', 'paged' => '$paged'); $loop_recent_posts = new wp_query( $args_recent_posts ); if ( $loop_recent_posts->have_posts() ) : function the_excerpt_max_charlength($charlength) { $excerpt = get_the_excerpt(); $charlength++; if ( strlen( $excerpt ) > $charlength ) { $subex = mb_substr( $excerpt, 0, $charlength - 5 ); $exwords = explode( ' ', $subex );

php - RedirectRule with conditions in htaccess -

so far have learnt rewriterule ^([^/]*)/$ index.php?page=$1 problem 1: how parse url parameters after point point? e.g. want page http://example.com/index.php?page=x&id=2&err=10 appear http://example.com/x/?id=2&err=10 . given parameters id or err not exists. may or may not present others. problem 2: specific pages suppose page=a or page=b , if id exists, there third parameter well. e.g. want page http://example.com/index.php?page=a&id=10&name=abe appear http://example.com/a/abe/10/ , http://example.com/index.php?page=a&id=10&name=abe&err=101 appear http://example.com/a/abe/10/?err=101 edit 30 jan, 16 ok. after searching found implemented using {query_string} . when place rewriterule ^([^/]*)$ index.php?page=$1&%{query_string} [nc,l] in htaccess ajax goes haywire. want working implement index.php , no other pages. url rewrite parameters using rewritecond rule able solve problem 1, however, yet implement problem 2.

algorithm - Efficient data structures for data matching -

what efficient data structures matching data? example, suppose presented follow scenario: <time available> <buy or sell> <company name> <buy or sell price> <amount buy or sell> so file may contain: 0 sell yahoo $100 #1 2 sell yahoo $14 #1 2 sell yahoo $28 #1 .. 95 other yahoo sells <$125 , amount #1 3 sell yahoo $17 #1 5 sell yahoo $33 #1 9 buy yahoo $125 #100 is possible match last buy previous 100 sells in o(n) time, n = 100 if buy matched lowest selling price corresponding company wants buy (or 1 comes first in case of tie)? i know naive solution sort list , go in order, takes longer o(n) time. efficient data structures handling problem , similar ones it? try using hash map company name heap of sell orders, ranked price. insertion of sell order o(log n) , buy order becomes constant if buy doesn't use sell order, or o(log n) if (your problem statement doesn't specify)

delphi - How to access to a private variable used as by a property ( designTime package) from another unit (runtimepackage) -

in order create component, created designtime , runtime packages, runtime package (lets call rp140) contains code of component , requires rtl.dcp, designtime package (lets call dclrp140) contains register procedure , requires designide, runtime package , rtl.dcp. need access private variables declared in unit belongs "dclrp140" package, unit belongs "rp140", created simple code contains relevant part, make easier understand: unit mycomponentregister; interface uses classes, mycomponent; type tevent = procedure(sender: tobject) of object; tmycomponent = class(tcomponent) private fmyproperty: string; fmyevent: tevent; public constructor create(aowner: tcomponent); override; published property myproperty: string read fmyproperty write fmyproperty default initial_value; property myevent: tevent read fmyevent write fmyevent; end; procedure register; implementation procedure register; begin registercomponents('samp

javascript - How to unwrap text from a span in text block? -

Image
so have big <div> block text in it. , word user double-clicks on wrapping in <span> element how can delete span element , return word it's normal place, w/o span wrapping it, whole text return starting position? edit: sorry absence. here's code of double-click function wraps div, user have double clicked on in span , adds class span. looking that! function ondoubleclick(){ var selection=window.getselection().getrangeat(0); var selectedtext=selection.extractcontents(); var span=document.createelement("span"); epic.get(span).addclass('highlightedtext'); span.appendchild(selectedtext); selection.insertnode(span); } this might want, expect evil 'regex in html'-links in comments :p. it's dependent on fact if <div> has text , spans in or many other (sub)children dom-nodes. var html = $('#mydiv').html(); var new_html = html.replace(new regexp('<span>[uu]ser</span>&

jquery - on() doesn't work as expected and does not work for newly loaded content -

my chrome extension follows: $(document).ready(function() { ... $("input[type!='password'], textarea").on("keypress", function (event) { ... }); }); this reacts expected loaded content not work inputs or textareas loaded later. i though on supposed do, using wrong? i've played around try solve no success $(doocument).on("keypress", "input[type!='password'], textarea".... here live example in jsfiddle , first input works expected, generated ones don't. $(document).on("keypress", "input[type!='password'], textarea", function (event) { alert("this works!"); }); the listener being attached document , , keypress events checked against input[type!='password'] , textarea . if html markup structured in way there 1 parent container of input[type!='password'] , textarea , replace $(document) $('.parent-container') a

php - Doctrine Set Multiple Criteria One At A Time Instead Of All At Once -

i'm using kendoui framework grid returns json of users current filter settings. its result looks filters. "filter":{"logic":"and","filters":[{"field":"name","operator":"contains","value":"o"},{"field":"name","operator":"startswith","value":"w"}]} i need iterate on array , create criteria doctrine filter by. every sample i've seen though shows happening @ once won't work scenario. i'm using symfony 3.0, code below creates repository. $repository = $this->getdoctrine()->getrepository('appbundle:company'); then rest of code currently. $company_total = $repository->findall(); $company_records = $repository->findby(array(),$sort,$pagesize,($page-1)*$pagesize); $data["total"] = count($company_total); foreach($company_records $company){

php - PayPal IPN Listener - SSL Certificate Handshake Failure -

running php 5.3.28 , curl 7.30.0 (openssl/0.9.8y & libssh2/1.4.2) on windows server 2008 r2 using iis. i'm creating ipn listener paypal instant payment notifications using sandbox environment, no matter ssl certificate errors like: error:14077410:ssl routines:ssl23_get_server_hello:sslv3 alert handshake failure here code (where $fields correct fields post back): $ch = curl_init(); curl_setopt($ch, curlopt_url, 'https://www.sandbox.paypal.com/cgi-bin/webscr'; curl_setopt($ch, curlopt_post, true); curl_setopt($ch, curlopt_postfields, $fields); curl_setopt($ch, curlopt_returntransfer, true); curl_setopt($ch, curlopt_failonerror, true); if ($result = curl_exec($ch)) { echo 'result = '.$result.'<br>'; } else { echo 'result = '.$result.'<br>'; echo 'errno = '.curl_errno($ch).'<br>'; echo 'error = '.curl_error($ch).'<br>'; } curl_close($ch); so, understan

angularjs - Controller As inheritance with $controller -

i have pretty big question issue thought might easy split in smaller ones. so, i'm trying use $controller inherit parentcontroller, things not working expected. i have jsfiddle here . , code. angular .module("app",[]) .controller('parentcontroller', parentcontroller) .controller('childcontroller', childcontroller) parentcontroller.$inject = ['$scope'] childcontroller.$inject = ['$controller', '$scope']; function parentcontroller($scope) { var vm = this; vm.foo = 'parent foo'; } function childcontroller($controller, $scope) { $controller('parentcontroller vm', {$scope: $scope}); var vm = $scope.vm; // view model } and simple html <div> {{vm.foo}} </div> when configure app use parentcontroller, this <body ng-app="app" ng-controller="parentcontroller vm"> it works fine. but now, childcontroller, not wo

delphi - How to get a token passed as header using datasnap? -

in client application i'm using following code add token in header: restrequest.params.additem('authorization', 'bearer ' + mytoken, trestrequestparameterkind.pkhttpheader, [trestrequestparameteroption.podonotencode]); i'd token in server using datasnap. i've tried use answer here , here without success. is possible? how can this? edit i verify datasnap executes tidcustomhttpserver.doparseauthentication and doparseauthentication calls fonparseauthentication if assigned. so, how can hack datasnap assign own onparseauthentication ? i think solve problem. i have same problem. if authentication header used eidhttpunsupportedauthorisationscheme error, need setup onparseauthentication. started looking today , in test app "desktop" can following. procedure tmainform.formcreate(sender: tobject); begin fserver := tidhttpwebbrokerbridge.create(self); fserver.onparseauthentication := doparseauthentication;// <-adde

Git submodule status - how to show current branches in submodules -

checking status of submodules in main repository command: git submodule status produces output (without clear information branches): 491e03096e2234dab9a9533da714fb6eff5dcaa7 vendor/submodule1 (v1.51.0-560-g491e030) 8bccab48338219e73c3118ad71c8c98fbd32a4be vendor/submodule2 (v1.32.0-516-g8bccab4) is possible check current branches on submodules without: cd vendor/submodule1 git status cd ../submodule2 git status ? this command don't work: git submodule status -b answer hidden in git submodule foreach : git submodule foreach 'git status' you can make simpler assign alias: git config --global alias.sb "submodule foreach \"git status\"" now git sb give nice information branches in submodules: entering 'vendor/submodule1' on branch master branch up-to-date 'origin/master'. nothing commit, working directory clean entering 'vendor/submodule2' on branch master branch up-to-date 'origin/master

c# - How to bind to an unbindable property without violating MVVM? -

i using sharpvector's svgviewbox show static resource images this: <svgc:svgviewbox source="/resources/label.svg"/> which works fine. however, wish control image shown through binding view model. the problem i'm experiencing source property of svgviewbox not bindable. how can around limitation without violating mvvm (e.g., passing control view model , modifying there)? what looking called attached properties. msdn offers topic on title " custom attached properties " in case may simple this namespace myproject.extensions { public class svgviewboxattachedproperties : dependencyobject { public static string getsource(dependencyobject obj) { return (string) obj.getvalue(sourceproperty); } public static void setsource(dependencyobject obj, string value) { obj.setvalue(sourceproperty, value); } private static void onsourcechanged(dependency