Posts

c++ - std::cout not printing the value with out endl (newline specifier) -

below c++ program multiply 2 strings (integers in strings) , produce integer result in string. believe due cout flush problem. can explain how print value without endl or text string before printing answer. #include <iostream> using namespace std; string multiply (string s1, string s2) { char str[10]; string ans=""; int m=s1.length(); int n=s2.length(); if (!s1.compare("0") || !s2.compare("0")) return "0"; int *res = new int[m + n]; (int = m - 1; >= 0; i--) { (int j = n - 1; j >= 0; j--) { res[m + n - - j - 2] += (s1[i] - '0') * (s2[j] - '0'); res[m + n - - j - 1] += res[m + n - - j - 2] / 10; res[m + n - - j - 2] %= 10; } } (int = m + n - 1; >= 0; i--) { if (res[i] != 0) { (int j = i; j >= 0; j--) { ...

sharepoint jquery autocomplete clear textbox if no value -

i created textbox works on autocomplete function based on data list. need clear textbox if user has not selected item or has entered wrong text. below code $.ajax({ url: "http://address/_vti_bin/lists.asmx", type: "post", datatype: "xml", data: soapenv, contenttype: "text/xml; charset=\"utf-8\"", success: function (xmlresponse) { var domelementarray = $("z\\:row", xmlresponse); var datamap = domelementarray.map(function () { return { value: $(this).attr('ows_airportcode'), id: $(this).attr('ows_airportcode') }; }); var data = datamap.get(); //find sharepoint portal search box (this poor selector, not named sharepoint, inamingcontainer getrs in way) $("input[title='airportcode required field']")....

java - OrientDB Complete Embedded Cluster Test -

i trying create simple test that: activates full server embedded instance ( embedded server , distributed configuration ) creates initial test database in document mode during first run ( create database ) opens test database ( open database ) insert sample record fetch sample record add node , repeat i can understand steps individually having difficulty piecing simple test case. example, api documentation assumes remote connection. not sure whether applicable method here, , if so, url should specify. once have completed steps 1, 2 , 3 correctly, should able refer api documentation steps 4 , 5. as novice user, find difficult interpret documentation in context. or clarification appreciated. i trying run test junit test. here have far: public class testorientdb { private static final logger log = logger.getlogger(testorientdb.class); @test public void testfullembeddedserver() throws exception { log.debug("connectiong database server..."); string...

python - Image flickering in PyGame? -

i'm trying send "waves" of enemies code: wavechooser = random.randint(1, 4) print wavechooser if wavechooser == 1: wave1() but when run this, enemies send using wave1() keep flickering. wave1() code runs fine wihtout wavechooser, wavechooser comes problem. i'm guessing because wavechooser in while statement, values of wavechooser keep changing. so question is, how keep enemy opaque? prefer not change if statement because want send multiple waves @ once. wave1() code: def wave1(): global timer global timer1 global angle speed = random.uniform(0.1, 0.9) index = 0 # removing enemies enemy1 in enemies: if enemy1[0] < 330: enemy.pop(index) enemy1[0] -= speed index += 1 enemy1 in enemies: screen.blit(enemy, enemy1) as said, part seems working fine individually. edit: also, after send wave, can't seem able send one. need post more code? edit: of outputted values of wavechooser 3 ...

algorithm - master theorem and recurrence -

Image
i given recurrence t(n) = 3t(n/2) + n^2 lg(n) is possible use master theorem find t(n) = theta(f(n))? there polylogarithmic function f(n) understand there limited 4th case. 4th case apply here? master's theorem not have constrains regards f(n) function: so = 3, b = 2, c = log2(3), , fall in third case , solution o(n^2 log n)

ruby on rails - Comments to a specific product appear for all products -

hello developing demo ecommerce app, have created products, users , comments. each product page should show comments specific product. can comment product , can see comments product a, then, if check page of product b, see comments of product a. basically, comments mixed in long list instead of being sorted product... here github : https://github.com/adsidera/freshobst following partial products/_comment.html.erb comments <div class="product-reviews"> <% @comments.each |comment| %> <div class="row" style="padding-left:4%;"> <hr> <p><small><%= comment.user.first_name %><em><%= " #{time_ago_in_words(comment.created_at)} ago" %></em></small></p> <div class="rated" data-score="<%= comment.rating %>"></div> <p><%= comment.body %></p> <% if signed_in? ...

best way to access JCR data AEM 6.0/ cq5 -

i know, in following 3 ways, 1 should used access jcr data. resolverfactory.getserviceresourceresolver(map authinfo); resolverfactory.getresourceresolver(map authinfo); session.getservice('servicename', null); could please share knowledge on these specific methods , how provide authinfo , in scenarios each of these methods used. it seems, aem 6.0 onwards getadministrativeresourceresolver method deprecated because of security reasons ?? thank you, sri from aem 6.1 cannot use "admin" access nodes. have detailed solution here resourceresolverfactory getserviceresourceresolver throws exception in aem 6.1 and here's have done read , write data jcr. public class interacthelper { @reference private resourceresolverfactory resolverfactory; private resourceresolver resourceresolver; @activate private void activate(componentcontext context) { ... map<string, object> param = new hashmap<string, object>(); // aem_subserv...