Posts

Featured post

c++ - Move semantics and virtual methods -

in c++11 guided in cases pass objects value , in others const-reference. however, guideline depends on implementation of method, not on interface , intended usage clients. when write interface, not know how implemented. there rule of thumb writing method signatures? example - in following code fragment, should use bar1 or bar2 ? class ifoo { public: virtual void bar1(std::string s) = 0; virtual void bar2(const std::string& s) = 0; }; you can stop reading here if agree correct signature depends on implementation. here example shows why believe so. in following example, should pass string value: class foo { std::string bar; foo(std::string byvalue) : bar(std::move(byvalue)) { } }; now can instantiate foo in efficient manner in cases: foo foo1("hello world"); // create once, move once foo foo2(s); // programmer wants copy s. 1 copy , 1 move foo foo3(std::move(t)); // programmer not need t anymore. no copy @ in other case

java - Why is my servlet session not persistent? -

my servlet working expected other when close browser (i not deleting cookies), session lost. how can save session indefinitely until invalidate or delete cookies? @webservlet(name="servletone", urlpatterns={"/", "/servletone"}) public class servletone extends httpservlet { private static final long serialversionuid = 1l; public void doget(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { httpsession session = request.getsession(true); string newvalue = request.getparameter("newvalue"); if (session.isnew()) { session = request.getsession(true); session.setattribute("myattribute", "value"); } if (newvalue != null) session.setattribute("myattribute", newvalue); requestdispatcher rd = request.getrequestdispatcher("test.jsp"); rd.forward(requ

jquery - cakephp 2x + ajax pagination + prototype js -

i want create add/edit/delete , active/deactive (with ajax) in listing page. here have uploaded demo http://mehul.pw/cp/categories/index right pagination working fine. when change status , use pagination not working. trying solve 3hr here have mentioned below code controller code below: public $helpers = array('js' => array('prototype')); public $components = array(); public function beforefilter() { parent::beforefilter(); } public $paginate = array( 'limit' => 1, 'order' => array( 'category.category_id' => 'asc' ) ); public function index() { $data = $this->paginate('category'); $this->set('categories',$data); } public function update($field,$value,$id = null,$pageno,$sortkey,$sortdir) { if (!$id) { $this->session->setflash(__('invalid id event', tru

android - PhoneGap - target-densitydpi on viewport -

Image
i'm creating app android , ios using phonegap. after creating "helloworld" app phonegap's template see target-densitydpi=device-dpi on viewport default . okay, that's fine decided run tests jquery mobile ui , do not use target-densitydpi on viewport (by way if do, website should small on high dpi devices). since need images of app great @ low , high resolution devices, decided run tests on galaxy s4. first, target-densitydpi=device-dpi removed : <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height" /> the document.width 360px, created 360px image , blurry @ gs4 screen. <img src="360img.jpg" style="width:360px;"> second, target-densitydpi=device-dpi enabled : <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=d

active directory - PowerShell Clear-ADAccountExpiration not performing in the same way as the manual method -

Image
i have issue when using powershell clear-adaccountexpiration reset account expiration date never in active directory. here's account going expire: get-aduser osbor_ri -properties * | select accountexpirationdate,accountexpires | fl accountexpirationdate : 31/12/2013 17:00:00 accountexpires : 130330692000000000 as can see expire on 31/12/2013 17:00:00 . want clear expiration , set never expire; use following cmdlet : clear-adaccountexpiration osbor_ri this clears accountexpirationdate varible in ad doesn't clear accountexpires 0 instead it's set 9223372036854775807 each time. get-aduser osbor_ri -properties * | select accountexpirationdate,accountexpires | fl accountexpirationdate : accountexpires : 9223372036854775807 but when use manual method in ad set account never expire accountexpires varible set 0 . get-aduser osbor_ri -properties * | select accountexpirationdate,accountexpires | fl accountexpirationdate : accountexp

java - OnLong Click ListView Pop-UP -

Image
i implement in listview longclick, there succeeded :) create sort of pop-up more possibilities, example, paste, delete, remove, etc ... make understand found picture on internet :) ve mail below. thank in advance try use pop menu this.. public class mainactivity extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); button button = (button) findviewbyid(r.id.button2); registerforcontextmenu(button); } @override public void oncreatecontextmenu(contextmenu menu, view v, contextmenuinfo menuinfo) { super.oncreatecontextmenu(menu, v, menuinfo); getmenuinflater().inflate(r.menu.main, menu); } public void showpopup(view v) { popupmenu popup = new popupmenu(this, v); getmenuinflater().inflate(r.menu.main, popup.getmenu()); popup.show(); popup.setonmenuitemclicklistener(new onmenuitemclicklistener() { @override

jquery - ajax call not reset old data -

i using ajax in website, working fine not success data on next call, mean if on first call, data 1 , 0 , on second call data 0 , 1, showing on 2nd call 1, 0, 0, 1 function checkform(){ var userid = $("#userid").val(); var email = $("#email").val(); $.ajax({ url:path+"ajax_getpass.php", data:{userid : userid, email : email}, cache:'false', type:'post', datatype:"json", success: function(data_send){ $(document).ajaxcomplete(function(event, request) { //data = $.parsejson(data); alert(data_send.email); alert(data_send.userid); }); } }); return false; } please tell me wrong. this because add more , more functions ajaxcomplete() every time ajax request successful. when success code called first time, 1 function called ajaxcomplete() . next request, function added, 2 functions called. use code instead: $.ajax({ url:path+"ajax_g