Posts

linux - How to allocate memory dynamically for class using new in C++? -

have following class: class mem { private: int data; public: mem(){} mem(int a) { data=a; } void datadis() { cout <<"valu of "<< data << endl; } }; how allocate memory 10 object of class using parametrized constructor , new operator? since need use new directly, can ten separate objects: mem * mem1 = new mem(42); // , on you can't specify initialisers when allocating array new ; you'll have let them default-initialised, reassign them: mem * mems = new mem[10]; mems[0] = mem(42); // , on don't forget assign them smart pointers (or delete them when you've finished them, if weird requirement use new forbids other forms of sensible memory management). when find working under less insane restrictions, use std::array or std::vector instead of mucking around raw memory allocations: std::vector<mem> mems = {42, 6...

sockets - Linux UDP max size of receive buffer -

what's maximum size of linux udp receive buffer? thought it's limited available ram, when set 5gb rmem_max: echo 5000000000 > /proc/sys/net/core/rmem_max and 4gb actual socket buffer (in erlang): gen_udp:listen(port, [{recbuf, 4000000000}]) when measure buffer utilization, shows: # netstat -u6anp | grep 5050 udp6 1409995136 0 :::5050 :::* 13483/beam.smp i can't exceed 1.4gb. smaller buffer sizes, e.g. 500mb, actual buffer size matched configured value. system debian 6.0, machine has 50gb ram available. it seems there limit in linux. have tried setting rmem_max 2^32-1 success. root@xxx:/proc/sys/net/core# echo 2147483647 > rmem_max root@xxx:/proc/sys/net/core# cat rmem_max 2147483647 2^32 much: root@xxx:/proc/sys/net/core# echo 2147483648 > rmem_max root@xxx:/proc/sys/net/core# cat rmem_max -18446744071562067968 setting 5000000000 yields: root@xxx:/proc/sys/net/core# echo 5000000000 > rmem_max...

Android ExpandableList - Image Loader - Simple Adapter -

i need our help. i need create expandablelistview , put inside more images loaded url. now have this: i take text file xml dunno how show in image image dinamic. this code: main.java public class main extends expandablelistactivity { static final string key_discounted_price = "discounted_price"; static final string key_price = "price"; static final string key_discount = "discount"; static final string key_thumb_url_seller = "seller_image_url"; static final string key_thumb_url = "image_url"; static final string key_description = "description"; static final string key_title_offerta = "title_offerta"; string contenuto_nodo; arraylist <string> array_contenuto_nodo =new arraylist<string>(); arraylist<hashmap<string, string>> songslist = new arraylist<hashmap<string, string>>(); static final string shades[][] = { // sh...

html - jQuery Masonry with InfiniteScroll -

i have problem adding infinite scroll masonry plugin. i'm trying add boxes html file. here's code: var $container = $('#tiles'); $container.imagesloaded(function() { $container.masonry({ itemselector: '.item', columnwidth: 252, gutterwidth: 43 }); }); // infinite scroll $container.infinitescroll({ navselector: '#page-nav', // selector paged navigation nextselector: '#page-nav a', // selector next link (to page 2) itemselector: '.item', // selector items you'll retrieve loading: { finishedmsg: 'no more pages load.', img: 'http://i.imgur.com/6rmhx.gif' } }, // trigger masonry callback function(newelements) { // hide new items while loading var $newelems = $(newelements).css({opacity: 0}); // ensure images load before adding masonry layout $newelems.imagesloaded(function() { // show elems they're ready $newele...

android - ProgressDialog with Soap method -

here trying display progressbar when calling soap service , dismiss progressbar when response came service, progressbar not appear . submits data directly , when tried force application, crashes... i want display progress bar soap method starts , dismiss when gets over... please tell me ??? protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); setcontentview(r.layout.register); button btnenter = (button) findviewbyid(r.id.btregister); btnenter.setonclicklistener(new view.onclicklistener() { @override public void onclick(view arg0) { if (name.equals("")) { textvalidation.settext("please enter name."); } else if (number.equals("")) { textvalidation.settext("please enter contact number."); } else { textvalidation.settext(""); ...

Matlab: error message running Quantisnp -

i run program called quantisnp used matlab in code. not familiar matlab @ all. got below error message , no output. idea how fix it? fyi, don't have access source code of program.... ??? error using ==> chol matrix must positive definite. matlab:posdef highly appreciate help jean it's hard trying answer question without seeing code here general info problem facing: what see matlab error message. assume quantisnp compiled matlab program can't debug it. in short says @ point program trying calculate cholesky factorization using chol() function, matrix inside not positive definite. of time problem happens because matrix zero, in turn [potentially] caused invalid input parameter check see if parameters using (1) valid , (2) match environment. if there input csv or txt file, make sure path correct. make sure numbers make sense. there zeros or lines somewhere should not there? depending on version of quantisnp have, may have access --verbose switc...

spring mvc - could not instantiate bean class org.springframework.validation.BindingResult -

im getting following exception in spring controller not instantiate bean class [org.springframework.validation.bindingresult]: specified class interface. sorry im new in spring here controller @controller public class sendpasswordcontroller { @resource private javamailsender mailsender; //@autowired //private userservice userservice; @resource private userservice userservice; @resource private changepasswordservice changepasswordservice; @resource private emailsenderservice emailsenderservice; @requestmapping(value = "/emailform" ,method= requestmethod.get) public modelandview sendemail(@modelattribute(value="emailpasswordform") bindingresult result,httpservletrequest request){ modelandview mav = new modelandview("emailform"); string username= null; string password=null; authentication auth = securitycontextholder.getcontext().getauthentication(); ...