Posts

Showing posts from August, 2011

Meteor - data not available with Iron Router -

i trying achieve pretty simple: load template , fill data. however, template rendered several times, , first time null data. i found various posts issue stating rendering occurs every time subscription adds record clients database, , tried applying proposed solutions, still have first rendering without data. how can fix that? router.configure({ layouttemplate: 'layout', loadingtemplate: 'loading', notfoundtemplate: 'notfound' }); router.route('/team/:_id/cal', { name: 'calendar', waiton: function() { return [ meteor.subscribe('userteams',meteor.user()._id), meteor.subscribe('teamusers', this.params._id)]; }, action : function () { console.log("action:"+this.ready()); if (this.ready() && template.currentdata != null) { this.render(); } }, data: function(){ var team = teams.findone({_id:this.pa

c++ - How do I validate integer input? -

so making little calculator program game brother plays because bored. took c++ course last semester in college (now taking java course find bit more confusing) , found fun make these little programs. usual i'm getting carried away , must perfectionist , bothering me. now in game, , in real life, numbers seperated commas make easier read. because of this, that's how numbers going inputted calculator brother. tell him not put in commas when typing in number , put in prompt there should not commas can't sure. so, best if code doesn't mess every time that's not number put in. what i've got far pretty good. if put in letters prompt user again , if put letters in after numbers (not inbetween, messes found) ignore letters , work properly. if put in commas though, returns same thing (0 , 5) although i'm putting in. have no idea if comma acting cut off point or what. here's code getting integers: #include <iostream> using namespace std; int main

c# - Reflection error: "parameter type mismatch" -

i trying understand reflection in c# , trying following code work. first method (getusername) works second method (addgivennumbers) giving me exception error of "parameter type mismatch". created class library 2 methods , trying use reflection in main console application. class library code: namespace classlibrarydelete { public class class1 { public string getusername(string account) { return "my name " + account; } public int addgivennumbers(int num1, int num2) { return num1 + num2; } } } code in main console application: using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; using system.reflection; namespace consoleapplicationdelete_reflection { class program { static void main(string[] args) { assembly assemblyinstance = assembly.loadfrom(@"c:\users\xyz\desktop\de

c++ - Wrapping pointers into an iterator for copying into an STL container -

i have pointer data want put string. thought using std::copy should safest approach. however, in visual studio 2010 warning warning c4996: 'std::_copy_impl': function call parameters may unsafe - call relies on caller check passed values correct. disable warning, use -d_scl_secure_no_warnings. and of course warning correct. there checked_array_iterator objects described on msdn checked_array_iterator can used wrap pointer , make compatible stl iterators. the problem is, checked_array_iterator can used target, not source. so when try use this, application crashes or doesn't compile: char buffer[10] = "test"; std::string s; // these parameters external call , shown here illustrate usage. char *ptargetadress = &s; const char *obegin = buffer; const char *oend = obegin+sizeof(buffer); std::string *p = reinterpret_cast<std::string *>(ptargetadress); std::copy(obegin, oend, p->begin()); // crash stdext::checked_array_iterator<

wordpress - WP_Query code outputs the PHP in the HTML instead of results -

i have page supposed display 3 of latest posts in category. php code make work below <section id="projects"> <div class="container"> <div class="row"> <h2><span class="w200">latest </span><span class="w600 green">roofing projects</span></h2> <p class="text-center pad_bottom">click view latest project</p> <?php //latest projects loop $latestproj = new wp_query('cat=3&posts_per_page=3'); if ($latestproj->have_posts()) : while ($latestproj->have_posts()) : $latestproj->the_post(); ?> <div class="col-lg-4"> <?php if (has_post_thumbnail()) { the_post_thumbnail('square-thumbnail'); ?> <p class="proj_title"><?php the_title(); ?></p> <p><?php the_title(); ?></p>

How to Run Rails on Shared Server Using Heroku -

Image
i have website http://example.com , to host ruby on rails generated app http://example.com/projects/ruby . i using heroku zerigo dns addon (or open openshift if works). i tried installing ndeploy through cpanel [siteground][1] (my web host) not seem allow access apache or command line(?). my goal present project through website (not through cloud9 or heroku domain). can please point me, in right direction. on heroku when try press "add domain" control panel receive message: *"can't have more 1 domains / check *** larger plan accommodates needs"* if you're using heroku host rails app (which uses amazon e3), you'll not hosting on shared hosting at all . your fix come the following : all you're doing heroku custom domains (which need pro account for), forwarding traffic domain.com/path heroku app. now, don't know how heroku deal being routed - subfolder - know fact thing here dns setup domain. in section, need a

java - How make jcomponents change its sizes according to the screen resolution -

i've created application using jframes , jinternal frames. wanted make custom close , minimize buttons made jframe decorated. , made fit screen of given resolution using below codes. public dimension screensize = toolkit.getdefaulttoolkit().getscreensize(); public rectangle winsize = graphicsenvironment.getlocalgraphicsenvironment().getmaximumwindowbounds(); public int taskbarheight = screensize.height - winsize.height; public int width = (int) screensize.getwidth(); public int height = (int) screensize.getheight()-taskbarheight; in constructor ive typed this.setsize(width, height); and way managed make decorated jframe fit screen. want make other components in side jframe change sizes according screen resolution.is there way make components change sizes, instead of assigning dimensions each every components separately. i.e jdesktoppane1.setpreferredsize(new dimension(width*9/10, height*88/100)); i found difficult arrange components according

html - Why my rendering of this site's font gives different results? -

Image
this site , according plugin, uses monospace 12px on text editor (the part left). tried replicating same font css locally, results different: the font, rendered on site, looks thinner rendering. how can replicate same font ientically? edit: should've said don't use bold @ all, , changing font-weight 100 has no effect. you need set font-weight numerically, you'll need research weights font supports. font-weight: 900;

html5 - What better? HTML image from url or server? -

what better? html image url or server? i want know makes site more faster <img src="url"> or <img src="image.jpg"> that depends on speed of server, it's data link , it's load how going refer image. trying optimize quality of image might give better edge reference method.

html - Allow only specific email address' domain to register through JQuery (preferably) -

i trying make registration form within want register specific domains' emails. e.g. want register emails companyx, companyy, companyz. hence acceptable emails be:- myname@companyz.com myname@companyy.com myname@companyx.com any idea how in jquery? update this wrote, uptill now ($input) if ( (preg_match("/^\s+@companyx\.com$/i", $input) || (preg_match("/^\s+@companyy\.com$/i", $input) || (preg_match("/^\s+@companyz\.com$/i", $input) ) { } else { //error. } thanks an email going contain 1 @ split input value , take second part str = str.split('@').slice(1); then check if in acceptable list var alloweddomains = [ 'x.com', 'y.com', 'z.com' ]; if ($.inarray(str[0], alloweddomains) !== -1) { //acceptable }else{ //not acceptable } here working example in jsfiddle: http://jsfiddle.net/uwmyk/2/ type in email , click run.

apache - cant get virtual host to work in wamp -

version :2.5 know there many guides not work reason , can't did in virtual host <virtualhost *:80> documentroot "d:/wamp/www" servername localhost <directory "d:/wamp/www"> options indexes followsymlinks allowoverride require local </directory> </virtualhost> <virtualhost *:80> documentroot "c:/elgg" servername elgg.local serveralias elgg.local <directory "c:/elgg"> allowoverride require granted </directory> </virtualhost> in hosts file 127.0.0.1 localhost ::1 localhost 127.0.0.1 elgg.local ::1 elgg.local in conf file # virtual hosts include conf/extra/httpd-vhosts.conf i did when type elgg.local searches actual website last 10 apache lines [fri oct 16 10:33:49.873625 2015] [mpm_winnt:notice] [pid 1576:tid 668] ah00418: parent: created child process 1252 [f

jquery - How to add specific height of an element to another -

i've got html code that: <section> <div> </div> </section> <section> <div> </div> <section> i don't have specific height of of element. , wanna section height , give inner div height. how can jquery? i've tryed this: $(document).ready(function() { var contentheight = $('.content').parent().height(); $(".content").height(contentheight); }); $(window).resize(function() { var contentheight = $('.content').parent().height(); $(".content").height(contentheight); }); but takes height of first section , apply of inner divs. in $(window).resize section, replace code this: $(window).resize(function() { $(".content").each(function(){ $(this).css('height', $(this).parent().height()+'px'); }); }); the reason first ".content" affected, $('.content') returns array of matching elements,

xcode - Implement animation like iPhone default mail app compose mail -

Image
i want implement animation iphone default mail app while clicking on compose mail button animation of background , foreground view in app. please see attached image below. i totally new animation.please me implementing it. kind of appreciated. thanks. try , https://github.com/lukegeiger/lgsemimodalnavcontroller happy coding, cheers :d

r - Strange behavior of y axis in histograms -

i want put set of histograms of different variables on same scaled y axis using ggivs. however, once axes meaningfully larger highest count variable start strange , start plotting bars in negative direction. data http://rpubs.com/elinw/116698 here reproducable example # no values specified iris %>% ggvis(~sepal.width) %>% layer_histograms(width = 1) %>% add_axis("y", title = "count", title_offset="50") add_axis("x", title = "width", title_offset="50") #0 150 iris %>% ggvis(~sepal.width) %>% layer_histograms(width = 1) %>% add_axis("y", title = "count", title_offset="50", values = seq(0,150, = 10)) %>% add_axis("x", title = "width", title_offset="50") #0 175 iris %>% ggvis(~sepal.width) %>% layer_histograms(width = 1) %>% add_axis("y", title = "count", title_offset="50",

php - Filter on tag. Check if tag is in database string. Laravel -

i looking query check if $tag-variable (a string) part of string put in database through input field. user can add article en give tags separating comma. work , user can go article/{tag} url, not able show articles specific tag. so need do? need check if $tag part of string that's in database (in "tags" column). tried , controller. don't know if contains()-function works. here controller-code: public function gettag($tag) { $articles = article::where('tags',contains('tags', $tag))->get(); return view("article.tagfilter")->with('articles',$articles); } the right solution here : $articles = article::where('tags', 'like', '%'.$tag.'%')->get(); thanks lamzozo!

Changing background image in TeeChart Delphi XE8 at run-time -

i use gallery pictures (metal, wood, stone, clouds, etc.) available @ design time under chart/panel/image/gallery. if set @ design time, can disable @ run time with: g.backimage := nil; but if want set particular value, e.g. with g.backimage := 'metal'; i 'incompatible types' error, because compiler requires tbackimage value. not have source codes, , cannot find appropriate values on several google searches. thinking could enum, tried typecasting one: g.backimage := tbackimage(1); but generates exception. tried "guess" names, tbimetal, tbmetal, tmetal, , on, no avail... what values?! thank you tbackimage class methods must call. chart.backimage.loadfromfile('full/path/to/imagefile');

whatsapi - How send text message with link in WhatsApp using what's API chat -

i using whatsapp chat in php send messages. php script work fine, url inside text message doesn't render clickable link. shown plain text instead. $msg= "hello !. \n http://example.com "; what doing wrong? your php variable seen plain text because pure string, nothing more. goal let clickable link , guess shown in webpage. in case, should put html code inside variable. starting code, valid solution can this: $msg= "hello !. \n <a href='http://example.com "'>click here</a>; otherwise, can implement function: function make_links_clickable($text){ return preg_replace('!(((f|ht)tp(s)?://)[-a-za-zа-яА-Я()0-9@:%_+.~#?&;//=]+)!i', '<a href="$1">$1</a>', $text); }

How to take address of an overloaded operator defined as a friend in class body in C++ -

how can take address of overloaded operator defined friend in class body? i tried following struct s { friend bool operator==(s, s) { return true; } }; int main() { bool (*f)(s, s) = &operator==; } but gcc gives error test.cc: in function ‘int main()’: test.cc:6:30: error: ‘operator==’ not defined bool (*f)(s, s) = &operator==; ^ which can fixed declaring operator in (global) namespace: bool operator==(s, s); is there way take address without redeclaring operator? a name first declared in friend declaration within class or class template x becomes member of innermost enclosing namespace of x, is not accessible lookup (except argument-dependent lookup considers x) unless matching declaration @ namespace scope provided http://en.cppreference.com/w/cpp/language/friend , emphasis mine. generally, should declare friends outside of class, unless explicitly want hide them lookup except adl (which might i

haskell - Yesod build error because of the duplicate definition for symbol "hsprimitive_memcpy" -

i followed "yesod quick start guide" install yesod in windows 10. but, when issued stack build command, failed. environment windows 10 (64bits) stack-0.1.5 (for windows10 64bits) haskell platform 7.10.2-a (from haskellplatform-7.10.2-a-x86_64-setup.exe) alex-3.1.4.log ghc runtime linker: fatal error: found duplicate definition symbol hsprimitive_memcpy whilst processing object file c:\users\xxxxx\appdata\roaming\stack\snapshots\x86_64-windows\lts-3.8\7.10.2\lib\x86_64-windows-ghc-7.10.2\primitive-0.6.1.0-5jnw7oeuytm9dmkxelgxvb\hsprimitive-0.6.1.0-5jnw7oeuytm9dmkxelgxvb.o caused by: * loading 2 different object files export same symbol * specifying same object file twice on ghci command line * incorrect `package.conf' entry, causing object loaded twice. ghc: panic! (the 'impossible' happened) (ghc version 7.10.2 x86_64-unknown-mingw32): loadobj "c:\\users\\xxxxx\\appdata\\roaming\\stack\\snapshots\\x86_64-windows\\lt

android - How to build more effective design for sqlite operations -

i working on sqlite , android app. there xml file, take information of database, tables, tables count, column types... when app starts, tables should created. there no specific count of tables , table columns. should design percect dynamic structure. did thing; dynamic sqlquery unknown tables count... left easy thing. my constructor ; public database(context context,string tablename, string [] a) { super(context, database_name, null, database_version); this.tables=a; this.table_name=tablename; } my query builder, not matter how many tables count , types... private string querybuild(string [] ss){ stringbuilder stringbuilder = new stringbuilder(); for(int i=0;i<ss.length;i++){ if( % 2 == 0){ stringbuilder.append(ss[i]); stringbuilder.append(" "); } if(i % 2 == 1){ stringbuilder.append(ss[i]); if(i!=ss.length-1)

entity framework - EF code first add model related exist childs -

i try add new model db model have child exists , got error: "a referential integrity constraint violation occurred: property value(s) of 'category.id' on 1 end of relationship not match property value(s) of 'lesson.categoryid' on other end." for example: public class category { public int id { get; set; } public string name{ get; set; } public list<lesson> lessons{ get; set; } } public class lesson { public int id { get; set; } public string name{ get; set; } public list<category> categories { get; set; } } i think category id still 0 until db generate new id , lesson.categoryid filled in 0 not exist in categories save code: db.categories.add(obj); db.changetracker.entries() .where(x => x.entity basemodel && x.state == entitystate.added && ((basemodel)x.entity).id > 0) .tolist().foreach(x => x.state = entitystate.unchanged); any idea how fix that? anyway

R subtract string from text and create 4 new variables base on the subtracts -

i have following data in r: product_description can al sol 355ml exp 2014 can al 7up 330ml std vintage 50s 2015 zz_can al heineken light 500ml 473 13 zz_can al tecate 710ml mx 2009 can al sol 355ml carnaval 2012 can al heineken 330ml 4x6 nl 1508 zz_can al carta blanca light 355ml 2010 can al carta blanca 355ml cl/co 2012 can al strongbow red berries 400bg/gr/ro and create 4 columns splitting content in 4 new variables: brand, type, capacity , description. i following (not sure if clear without columns): brand type capacity description sol 355ml exp 2014 7up 330ml std vintage 50s 2015 heineken light 500ml 473 13 tecate 710ml mx 2009 sol 355ml carnaval 2012 heineken 330ml 4x6 nl 1508 carta blanca light 355ml 2010 carta blanca 355ml cl/co 2012 strongbow red berries 400bg/gr/ro so far i've used gsub function still not getting want. data$descrip <- gsub("can al", " ", data$ma

spring - QueryDSL dynamic predicates -

i need querydsl querying. i'm using library spring data jpa. service class: @service("tblactivityservice") public class tblactivityservice implements abstractservice<tblactivity> { @resource private tblactivityrepository tblactivityrepository; @override public list<tblactivity> findall(predicate predicate) { return (list<tblactivity>) tblactivityrepository.findall(predicate); } } i have dynamic list of filters: @entity @table(name = "sys_filters") public class sysfilter implements serializable { private static final long serialversionuid = 1l; @id @generatedvalue(strategy = generationtype.identity) @basic(optional = false) @column(name = "filter_id") private integer filterid; @joincolumn(name = "user_id", referencedcolumnname = "user_id") @manytoone(fetch = fetchtype.eager) private sysuser userid; @size(max = 45) @column(name = "table_name") private string tablename; @size(max = 45) @c

java - Hibernate many-to-many produces null member -

i have 2 entity classes many-to-many relation on there fields. here are: public class tcustomerprofile { ... @manytomany(fetch = fetchtype.eager, cascade = {cascadetype.persist, cascadetype.merge},mappedby = "customers") private list<tuserprofile> users; ... } public class tuserprofile{ ... @jointable(name = "t_user_authorization", joincolumns = {@joincolumn(name = "user_id" ,referencedcolumnname ="user_id")/*,@joincolumn(name = "entity1" ,referencedcolumnname ="entity")*/ }, inversejoincolumns = { @joincolumn(name = "customer_id" ,referencedcolumnname ="customer_id")/*,@joincolumn(name = "entity" ,referencedcolumnname ="entity")*/} ) @manytomany(fetch = fetchtype.eager) private list<tcustomerprofile> customers; ... } now question: how possible 1 of users in tcustomerprofile.users null ? data combination in 3 tables (including join table t_user_au

java - Read static field of interface via reflection -

i've got interface: public interface interface { public static final string field1 = "bar"; public static final string field2 = "foo"; ......... } i'm trying read field name via reflection using code: field[] fields = interface.class.getfields(); (field f : fields) { ............ } the problem array has length zero. why? edit: i'm using proguard , think problem related interface obfuscation. i running same code have provided , able print name of fields interface. import java.lang.reflect.field; public class prop { public static void main(string[] args) { field[] fields = interface.class.getfields(); (field f : fields) { system.out.println(f.getname()); } } } interface interface { public static final string field1 = "bar"; public static final string field2 = "foo"; } ouput: field1 field2

.net - What exception to use as base for fatal runtime exceptions in c#? -

i working on windows forms project , class library project in visual studio 2012. if have 1 or more fatal runtime exceptions .net exception use base? know applicationexception used non-fatal application exception. dont see 1 .net recommends fatal application exception. or define own base exception fatal runtime exceptions? if yes .net exception derive it? thanks

ios - Swift NSArray out-of-index with no apparent reason -

i'm working popups impressions , did far declaring nsarray var queue = [popupclass]() then i'm populating aforementioned array 5 static instances of class right in viewdidload method: var queue = [pop1, pop2, pop3, pop4, pop5] i'm putting first element @ bottom of array given amount of times: for (var = 0; < 12; i++) { queue[0].impression++ queue.append(queue[0]) queue.removeatindex(0) } this works fine if put instruction line line in viewdidload function. if put same code in method (named refreshimpressions) , recall method still in viewdidload, app crashes because array goes out-of-range @ first element. override func viewdidload() { super.viewdidload() refreshimpressions() } any appreciated. sorry if english might sound bad it's not mother language.

.htaccess - Mis-configured domain, causing 104 (connection reset by peer) error on heroku website -

i have misconfigured heroku website. shows error 104 (read error: connection reset peer) upon typing url , hitting enter. subsequently refreshing url couple of times makes url load correctly (some kind of fallback kicks in? - not knowingly configured any). url http://damadam.in/ (it's naked domain). i bought domain godaddy. in godaddy's control panel have dns zone file, host www points damadam.herokuapp.com (under cname). http://damadam.in set forward http://www.damadam.in . lastly, in heroku control panel both http://damadam.in , http://www.damadam.in have damadam.herokuapp.com dns target (could last configuration problem)? can me set thing up? this not http response code, rather error number indicating wrong connection. "connection reset peer" means that, on route computer final destination, node decided forcefully stop , reset connection. on configuration level don't think able this. if there kind of dns misconfiguration, not see read e

c# - WPF, covariance, contravariance, and binding in .Net -

i need make settings manager can't use appsettings or applicationsettings because need specific behaviour (adding/removing settings @ runtime, loading from/saving in multiple files...). the problem i'm encountering finding solution end result want. here exemple of should in use case : public partial class mywindow : window { private settingsmanager _settingsmanager; public myclass() { _settingsmanager.add(new option(){name = "option1", displayname = "option 1", defaultvalue = "sometext", value = "sometext"}); _settingsmanager.add(new option(){name = "option2", displayname = "option 2", defaultvalue = 5}); _settingsmanager.add(new option(){name = "option3", displayname = "option 3"}); _settingsmanager["option2"] = 10; _settingsmanager["option3"].defaultvalue = brushes.black; _settingsmanager["option3"]

javascript - How to get the last character of a string by coffeescript? -

i have string below: str = "abcdefg123" i want last character(3), how make coffeescript? i newcomer coffeescript, hope can me, in advance! enjoy coffeescript destructuring assignement , splats : str = "abcdefg123" [..., lastchar] = str alert lastchar

java - IMAP, setting custom mail flag support on exchange server? -

is example below (java, java mail api) supported exchange server? exchange server support setting custom mail flags? javamail: setting custom flags on imap mail , searching mails custom flags flags processedflag = new flags("processed"); folder.setflags(msgs, processedflag, true); // or msg.setflags(processedflag, true);

javascript - Get names and visibility of all columns -

i'm using jquery datatables , trying name , visibility of columns in table? i have tried: $( 'table' ).datatable().columns().every( function () { console.log( this.data() ) } ); it prints data in table, don't know how access column names , visibility instead of data() . i have looked both @ column().nodes() , columns().every() cannot find i'm looking for. solution you can use column().visible() column visibility , column().header() th node column can use text in header. for example, consider code below every column data, visibility , header text: $( 'table' ).datatable().columns().every( function () { // column data console.log("column data", this.data() ); // column visibility console.log("column visibility", this.visible() ); // column header console.log("column header", $(this.header()).text() ); } ); demo see this jsfiddle code , demonstration.

Visual Studio Community 2015 Services not available -

the problem can't sign in visual studio, can't use it. my 30 day license expired , means have sign in in order use it. hit sign in button. white window saying "we're getting things ready" shows , after while labled: "sorry, ran problem", saying "the online service not available. please try again later.". when checked service status, said online. edit: { i used fiddler debug network connection.. , found out program or system can't establish connection server: http://go.microsoft.com:443 } any ideas how fix , sign in? change visual studio proxy settings in c:\program files (x86)\microsoft visual studio 14.0\common7\ide\devenv.exe.config to <system.net>     <defaultproxy usedefaultcredentials="true" enabled="true">         <proxy usesystemdefault="true" />     </defaultproxy>     <settings>         <ipv6 enabled="true"/>     </settin

python - How to set order of pairing groups in Charm crypto -

i trying implement scheme using charm crypto framework. need limit order of pairing groups. mentioned in docs pairing groups of prime order p. there way set , retrieve order of group? here initialization code: from charm.toolbox.pairinggroup import pairinggroup,zr,g1,g2,gt,pair group = pairinggroup('ss512') # way limit order of group. g= group.random(g1) you cannot arbitrarily limit order of group, because statically defined. changing order result in wrong math. see pairingcurves.py actual curve/group definitions. charm doesn't provide api randomly generate groups. have use other means. can define own bilinear group different types of pairings ( a, a1 , d, e, f, g) , load through file path : group = pairinggroup('path/to/your.curve', param_file=true) it tricky find curve, task shouldn't taken lightly. or use existing curve fits needs, need fit definition pbc framework syntax. alternatively, try use miracl or relic groups. the bilinear

c++ - Capturing a Lambda's static in a Nested Lambda -

in this answer use code: std::vector<std::vector<int>> imat(3, std::vector<int>(10)); std::for_each(imat.begin(), imat.end(), [&](auto& i) { static auto row = 0; auto column = 0; std::transform(i.begin(), i.end(), i.begin(), [&](const auto& /*j*/) { return row * column++; }); ++row; }); but notice misbehavior in capturing static auto row depending upon compiler. clang 3.7.0 yields : 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 6 7 8 9 0 2 4 6 8 10 12 14 16 18 gcc 5.1.0 yields : 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 and visual studio 2015 gives me compile time error: an internal error has occurred in compiler. if change capture nested capture capture row explicitly compiler error: identifier in capture must variable automatic storage duration decla

Call a function (ofstream) C++ -

hello have probleme code.i don't know how call function ofstream. //username username(ofstream& reg); //password password(ofstream& reg); //email email(ofstream& reg); //gender gender(ofstream& reg); line(22) error is: expected primary-expression before '&' token line(24) error is: expected primary-expression before '&' token line(26) error is: expected primary-expression before '&' token line(28) error is: expected primary-expression before '&' token remove ofstream & . function calls don't include types.

java - Android Studio Onclick Open Navigation Item -

i'm new in android studio. i'm confused linking navigation drawer button. i have onclicklistener: public void clickfunc(view view) { //codehere i.add(new navitem("tip us", r.drawable.ic_details, navitem.item, webviewfragment.class, "http://www.google.com")); } when click in button want go navigation drawer. i've downloaded project fits need uses navigation drawer , want use button menu (not navigation drawer) anyone knows how it?

objective c - OSX How to display only one icon in dockbar for same application launched from 2 different locations -

i have application findersync extension support. i want achieve silent update application. approach came @ moment, installing new version of app ~/library/application support/../..., , whenever clicks app /applications, redirect user application support one. that means end 2 versions same app. 1 in /applications , other 1 in application support. i have issues after launching application both above locations. if user first starts app /applications, selects keep in dock, closes app, updates app copying new app app support , after starts app app support, end 2 dock icons. whenever start application, findersync extension automatically installed os. can viewed in system preferences->extensions. once user quits app , deletes bundle, os automatically deletes extension, no longer available in extensions pref pane. if opened application both above locations, deleting app /applications not remove entirely findersync extension extensions pref pane. after remove second application

ruby on rails - Dynamic Sitemap Errors -

i'm trying dynamic_sitemaps gem work site, readme technical , bit on head @ moment. i'm running errors when trying generate sitemap bit of code. # can have multiple sitemaps above – make sure names different. # automatically link pages using routes specified # using "resources :pages" in config/routes.rb. # automatically set <lastmod> date , time in page.updated_at: # sitemap_for :offers it's returning below error argumenterror: collection given sitemap_for must respond find_each. performance. use model.scoped activerecord relation responds find_each. i'm looking have sitemap contain offer posts etc. any appreciated! if model's name offer, try sitemap_for offer.all (note: #scoped deprecated, #all seems better option going forward)

ios - How to resize a UITableview to fit the dynamic number of rows -

Image
i'm building view controller elements of uiview , 1 uitableview. view larger iphone screen put elements in uiscrollview , configured auto layout. the number of rows in uitableview dynamic, , need content visible in single screen. don't want enable uitableview scroll property because complete messy working master uiscrollview , uitableview scroll i have been researching days on stackoverflow posts problem , couldn't find problem. this code trying resize uitableview , uiscrollview @iboutlet weak var scrollview: uiscrollview! @iboutlet weak var tableview: uitableview! override func viewdidload() { super.viewdidload() // configuring datasource delegate self.tableview.datasource = self self.tableview.delegate = self // sizing elements inside scrollview var contentrect = cgrectzero view:uiview in self.scrollview.subviews { contentrect = cgrectunion(contentrect, view.frame) }

excel - Remove exact text in Cell A if it exists in Cell B -

i have 2 excel columns: first column 1. dog 2. gorilla 3. lion second column 1. dog; monkey; fish 2. insect; cobra 3. lion; cat what want removing duplicate column 2, if in column must removed: 1. monkey; fish 2. insect; cobra 3. cat who can me? try this: =substitute(trim(substitute(substitute($b1,$a1,""),";",""))," ","; ")

javascript - AngularJS: HTML select to use values from map with ascending order on key -

i have map(bidirectional) of states. composed of statename , statecode. populated following html code cannot filter statecode or statename in ascending order. <div class="col-sm-2"> <select ng-model="location.statecode" ng-change="loaddistricts();" ng-options="statename (statecode, statename) in stateoptions | orderby:'statecode'" class="form-control" id="state"></select> </div> //json object stateoptions = {'mh':'maharashtra','gj':'gujarat','mp':'madhya pradesh'}; you inverted statecode , statename : ng-options="statename (statecode, statename) in stateoptions" also, stateoptions object, keys probably inserted alphabetically, depending on js virtual machine. orderby filter here pointless, because (from documentation ): orders specified array expression predicate. ordered alphabetically stri

java - Spring boot with JPA and ManyToMany: JsonIdentifyInfo not working properly -

i've 2 classes causing problem: teacher , schoolclass ( class java keyword already). both have long id. a teacher can have many classes , class can have many teachers. if request teacher (only importent vars) : { "classes": [ { "teachers": [ { "classes": [ 1 ], } ], } ] } but if request class (complete) : { "timestamp": 1445530016078, "status": 500, "error": "internal server error", "exception": "org.springframework.http.converter.httpmessagenotwritableexception", "message": "could not write content: java.lang.integer cannot cast java.lang.long (through reference chain: at.scool.model.db.schoolclass[\"teachers\"]->java.util.hashset[0]->at.scool.model.db.teacher[\"classes\"]->java.util.hashset[0]); nested exception com.fasterxml.jackson.databind.jsonmapp

ios - Swift initializer doesn't return value? -

swift documentation says. unlike objective-c initializers, swift initializers not return value. please explain below syntax. let instanceofstring = string() it initialize string object calling initializer , return it. value assigned instanceofstring . isn't it? the swift documentation refers syntax of type's init methods. the syntax omits return type in signature , method not contain return statement: init() { } obviously the call of initializer ( string() ) return value. difference objective-c init method in pure swift types not free return different object target of method—it's implicitly allocated instance of target type. the exception it's possible return nil in failable initializers.

sql - How to use rollup function in oracle -

i trying use group rollup oracle function, not getting right. here data format ( l1_proj_id level 1 project id etc.....) proj_id hours_charged l1_proj_id l2_proj_id l3_proj_id l4_proj_id ------------------------------------------------------------------------- 1100.10 20 1100 1100.10 null null 1100.11.01 30 1100 1100.11 1100.11.01 null 1100.11.02 40 1100 1100.11 1100.11.02 null 1100.12.01.01 50 1100 1100.12 1100.12.01 1100.12.01.01 i need roll totals , output should proj_level hours_charged -------------------------- 1100 140 1100.10 20 1100.11 70 1100.11.01 30 1100.11.02 40 1100.12 50 1100.12.01 50 1100.12.01.01 50 please, let me know if there other easy way do. as of can data like... select l1_proj_id, sum(hours_charged) hours_charged table group l1

c++ - Very slow filling of sparse matrix and no memory gain in Eigen -

i trying implement example given in eigen tutorial pseudocode. far understand, illustrates recommended method filling sparse matrix, provided number of non 0 entries per column known. the pseudocode found under header " filling sparse matrix "and written follows: 1: sparsematrix<double> mat(rows,cols); // default column major 2: mat.reserve(vectorxi::constant(cols,6)); 3: each i,j such v_ij != 0 4: mat.insert(i,j) = v_ij; // alternative: mat.coeffref(i,j) += v_ij; 5: mat.makecompressed(); // optional my attempt transform c found below. have (hopefully) written vee() such, create 2500 non-zero elements per column. therefore 2500 should correspond 6 in example. set 3000 test make.compressed well. unfortunately, don't understand behaviour of programme. i=0...3000 in seconds, stuck minutes. goes 6000 , stuck again minutes. why , how better performance? furthermore, memory usage strange. can see @ times

symfony - manyToMany connection add existing entity or create a new one -

imagine connection person x address (manytomany). user wants add person same address, has previous person. person address address +------------------------+ +-------------------------------+ | person_id | address_id | | id | postcode | city |... | +------------------------+ +-------------------------------+ | 1 | 1 | | 1 | 15800 | new york |... | | 2 | 1 | | 2 | 25385 | london |... | +------------------------+ +-------------------------------+ person +------------------+ | id | name | ... | +------------------+ | 1 | jack | ... | | 2 | peter | ... | +------------------+ is there automatic way to: check if same address exists. if add connection instead of create duplicate address. when update jack (from example) , address, add new address instead of updating address of peter. when delete check if there address connected person. if not delete address, otherwise delete connection

Joomla 3.4 PHP basic:About JTable::getInstance in libraries/joomla/table/table.php file -

i trying read , understand joomla core php code when came across function. located in libraries/joomla/table/table.php line 268. @ end of function in line 305, returns object created $tableclass , don't understand is, $tableclass class defined? following complete list of function: public static function getinstance($type, $prefix = 'jtable', $config = array()) { // sanitize , prepare table class name. $type = preg_replace('/[^a-z0-9_\.-]/i', '', $type); $tableclass = $prefix . ucfirst($type); // try load class if doesn't exist. if (!class_exists($tableclass)) { // search class file in jtable include paths. jimport('joomla.filesystem.path'); $paths = self::addincludepath(); $pathindex = 0; while (!class_exists($tableclass) && $pathindex < count($paths)) { if ($trythis = jpath::find($paths[$pathindex++], strtolower($type) . '.php'