Posts

Showing posts from July, 2010

javascript - Let table width surpass page width dynamically? -

i'm making table dynamically generated number of s in each row. want tables width surpass width of page, keep each of s innerhtmls stay on single line - keep table looking clean. currently, tables s expand contain text within them, prevent text wrapping, until tables width reaches pages width, @ point of text within s wrap, making table untidy , inconsistent. how go doing this? css: table { min-width: /*width of table*/; }

Changing all Web Reference Url's in Visual Studio Solution , Possible? -

i have visual studio 2012 solution many projects in it. these projects consume web-services of them have references web url. when switch server server , need change of these url's. i know how dynamically change web references in final app, keep in mind these web services in development environment , modified daily basis , hard change reference url one-by-one in solution. is there way change solution's web reference url's ? regards, saeed. you have dll provides url , projects access dll url. way 1 file needs changing. the url provided via environment variable, or file in defined directory, each project reads when starts. the above 2 ideas might combined. have dll reads url somewhere , provides calling project. clever dll might know difference between machines execute tests , choose appropriate url. there visual studio editor, using menu => edit => find , replace => replace in files .

java - CPU usage increases in time -

i making game (asteroids, ship destroys asteroids bullets) , have problem: if spawn 50 asteroids @ start , cpu usage 2-3% . ok. if spawn 5 asteroids , play game , moment when there 50 asteroids (increasing each level, when destoy previous), cpu usage becomes 20% in addition if destroy 49/50 asteroid , leave one alive, cpu usage still 20% , though there nothing compute ( mean moving, collssion detection, etc.) i have main gameloop timertask public void startgameloop() { timer.schedule(gamelooptask, 0, 17); timer.schedule(updatescoreandlifestask, 2000, 300); // update score views } class gameloop extends timertask { public void run() { game.updatestate(); openglview.requestrender(); } } public void updatestate() { ship.move(); for(int i=0; i<asteroids.size();i++) // asteroids , ship.bullets arraylists asteroids.get(i).move(); for(int i=0; i<ship.bullets.size();i++) ship.bullets.get(i).move(); detect...

sql - Spring MVC - Executing an Oracle Stored Procedure using java? -

i have jdbctemplate connection , namedparameterjdbctemplate connection variable between spring mvc application , oracle database. have stored procedure in oracle database takes either 0 or 1 input parameter, , not return upon completion. i need understanding how execute stored procedure. eventually need send execution thread complete without having user sit , wait, need step first. i have looked @ other questions on site , feels explanations aren't giving me can work with. need advise can offered. all have far isn't correct: public void processretrostoepay() throws sqlexception{ //callablestatement cs = spaejdbctemplate.preparecall("rp_retro_process(?)"); //cs.execute(); } as per java callablestatement api , should use syntax: "{?= call <procedure-name>[(<arg1>,<arg2>, ...)]}" "{call <procedure-name>[(<arg1>,<arg2>, ...)]}" and per oraclecallablestatement api ,...

concatenation - Concatenate multiple SQL scripts using CodeSmith template -

i'm trying create simple tool concatenating sql scripts using codesmith. i have template just: header (check whether tables exists, begin transaction) body (concatenated scripts should placed here) footer (commit or rollback transaction) scripts stored in separate .sql files. need pick these files through codesmith explorer during template generation, don't know uitypeeditor choose. i've tried filenameeditor, allows choose 1 file. is there existing uitypeeditor purpose? or need create such myself? if wish pick fie filenameeditor best choice. if wish choose multiple files i'd create own . if have parse sql files i'd recommend selecting base folder using uitypeeditor , using directoryinfo list of files matching pattern in directory. if looking concat output of various templates can done via generator project file (see project options -> single file) out of box or update master template accomplish this.

c# - Do Loop, an efficient break method? -

i have section inside method similar too: do { // query // query if query != null { // return } }while(some query != null) obviously not work, because query not declared until inside loop. 1 solution tried bool flag = false; { // query if query == null { flag = true; // or break; } // query if query != null { // return } }while(flag != true) neither method satisfies me, , quite not sure if considered coding practice, irks me. has pretty has been go solution in cases until point, due garbage nature of flag, wanted find out if there better way handle future reference, instead of making junk variable. should note other solution thought of arguably uglier. solution being run query once outside loop, , convert while loop , recall query again inside itself, rather loop. while code works above solution, wondering if had better solution not require arguably pointless variable. th...

c - Sentinel vs. passing around a count -

i have structure in c contains array on perform stack operations. if stack full, need prevent pushing element past end of array, , return error condition. is better style include size of stack element of structure, , pass number of elements stack_push() function, or should have sentinel element @ end of stack array? how going implement stack_push() function? if requires scanning end of array looking empty slot insert pushed element into, need sentinel value anyway (e.g., null, if array contains pointer elements). note algorithm going o( n ). on other hand, keeping track of number of active elements within array allows algorithm o(1) pushes (and pops). saves trouble of allocating 1 element in array, may significant if it's array of structs. generally speaking, stack data structures implemented using array , counter.

java - Enable FormDataMultiPart or @FormDataParam in JAVAEE Glassfish -

trying implement kind of image upload function found internet sources recommending using formdatamultipart or formdataparam jersey. jersey nice webframework , part of javaee. problem is, both interfaces not available in api. use javaee api maven javax.javaee-api version 7. <dependency> <groupid>javax</groupid> <artifactid>javaee-api</artifactid> <version>7.0</version> <scope>provided</scope> </dependency> it seems both not part of javaee standard. question how enable image upload glassfish using javaee api. best using kind of workaround enable image upload jersey. thanks answering include following dependencies: <dependency> <groupid>com.sun.jersey</groupid> <artifactid>jersey-json</artifactid> <version>1.18.1</version> </dependency> <dependency> <groupid>com.sun.jersey</groupid> <...

What are Window and Decor in Android UI? -

i want know meanings of window , decor in android ui. what tasks? how different each-other? 1) window in android ui? an existing question on stackoverflow give enough. 2) decor in android ui? from android-developer blog "the decorview view holds window's background drawable." hope helps you.

Is it encouraged to query a MongoDB database in a loop? -

in sql database, if wanted access sort of nested data, such list of tags or categories each item in table, i'd have use obscure form of joining in order send sql query once , loop through result cursor. my question is, in nosql database such mongodb, ok query database repeatedly such can previous task follows: cursor = query items each item in cursor tags = query item's tags i know can store tags in array in item's document, i'm assuming somehow not possible store inside same document. if case, expensive requery database repeatedly or designed used way? no, neither in mongo, nor in other database should query database in loop. , 1 reason performance: in web apps, database bottleneck , devs trying make small amount of db calls possible, whereas here trying make many possible. i mongo can want in many ways. of them are: putting tags inside document {itemname : 'item', tags : [1, 2, 3]} knowing list of elements, not need loop find infor...

java - EnumSet from array, shortest variant? -

i need enumset array (which given through varargs method parameter). first, surprised there no varargs constructor method in enumset (there enumset#of(e first, e... rest) ). workaround, used following variant: enumset<options> temp = enumset.copyof(arrays.aslist(options)); however, triggers java.lang.illegalargumentexception: collection empty . so, ended following, looks ridiculous: enumset<options> temp = options.length > 0 ? enumset.copyof(arrays.aslist(options)) : enumset.noneof(options.class); if course moved utility method, still, i'm asking myself if there simpler way using existing methods? this 2 lines, less complex: enumset<options> temp = enumset.noneof(options.class); // make empty enumset temp.addall(arrays.aslist(options)); // add varargs i don't consider worse other kind of variable declaration class doesn't have constructor want: someclass variable ...

c++ - How to render text in SDL2? -

i wondering how render text sdl2. found api called sdl_ttf , tutorials, not work situation. i'm using sdl_window , sdl_renderer , whereas tutorials specific sdl_surface . is possible use sdl_ttf sdl_render/sdl_window ? if so, how? yep, possible, given have renderer , window plus don't have thoughts on dabbling surfaces might want mind on creating texture, here sample code ttf_font* sans = ttf_openfont("sans.ttf", 24); //this opens font style , sets size sdl_color white = {255, 255, 255}; // color in rgb format, maxing out give color white, , text's color sdl_surface* surfacemessage = ttf_rendertext_solid(sans, "put text here", white); // ttf_rendertext_solid used on sdl_surface have create surface first sdl_texture* message = sdl_createtexturefromsurface(renderer, surfacemessage); //now can convert texture sdl_rect message_rect; //create rect message_rect.x = 0; //controls rect's x coordinate message_rect.y = 0; // contr...

date - java calendar display name style for day of month with ordinal indicator -

this question has answer here: how format day of month “11th”, “21st” or “23rd” in java? (ordinal indicator) 12 answers can java used different styles of day_of_month? i.e. "21st" , "22nd" rather "21" , "22"? also 'st' , 'nd' @ end of dates called future reference? jdk (including java 8) not offer solution out of box, , other libraries jodatime not. can @ question on so ideas. furthermore, think can reasonably try solution ordinal day numbers english, other languages? important reason why no library can give support. in jodatime or jsr-310 there might english-only handwritten solution possible on base of introducing specialized field, example in jsr-310 interface java.time.temporal.temporalfield , surely lot of work.

merge - SAS how groupformat works -

i found on sas official website. use groupformat option in statement ensure 1. formatted values used group observations when format statement , statement used in data step 2. first.variable , last.variable assigned formatted values of variable and example uses illustrate usage of groupformat proc format; value range low -55 = 'under 55' 55-60 = '55 60' 60-65 = '60 65' 65-70 = '65 70' other = 'over 70'; run; proc sort data=class out=sorted_class; height; run; data _null_; format height range.; set sorted_class; height groupformat; if first.height put 'shortest in ' height 'measures ' height:best12.; run; but don't understand how example shows groupformat "ensures" formatted values used group observations when format statement , statement used in data step . look @ results , without groupformat statement: 4805 4806 data _n...

regex - vi: s: change K_KP4:"4", into myvars.setvar(K_KP4,"4") -

i though had when tried s/^\(k_.+\):\("."\),/myvars\.setvar(\1,\2)/g i have 100 lines or k_kp4:"4" want change i think problem \1 \2 refer different instances of same grouping pattern, means id'ing 2 different groups in vi regex impossible??? no luck sed isn't there way of having name capturing group, a=>(k_.+) ? in vi(m) regex, need escape + make act metacharacter. :%s/^\(k_.\+\):\("."\)/myvars.setvar(\1,\2)/ also, g flag :s means replace instances on line . if there 1 instance per line, post suggests, g unnecessary , instead need specify command should run on lines in file -- :%s/...

Uncaught TypeError: undefined is not a function :When clicking kendo Action Sheet List buttons? -

i have problem when trying load kendo action sheet control in application. problem when try click list .it shows undefined not function. html: <ul id="actions"> <li><a href="#" data-action="view">new appointment</a></li> <li><a href="#" data-action="rename">view info</a></li> </ul> js: $("#actions").kendomobileactionsheet({ type: "tablet" }); $("#kendogrid").on("click", "tr", function () { var customerid = $(this).attr("id"); $("#actions").data("kendomobileactionsheet").open(this); }); if clicking grid shows kendo action sheet.which contains links .when try click link error . the data-action attribute of action sheet items points javascript function must globally available. should have functions ...

c# - FileNotFoundException With FTP -

i trying upload files more 1 trying single fileupload practice getting file not found exception task under. private static void uploadfiletoftp(string source) { string ftpurl = @"ftp://ftp.yuvarukhisamaj.com/wwwroot/shtri/"; //“@ftpurl”; // e.g. ftp://serverip/foldername/foldername string ftpusername = "yuvarukh";//“@ftpusername”; // e.g. username string ftppassword = "cxhv5rzeu";//“@ftppassword”; // e.g. password try { string filename = path.getfilename(source); string ftpfullpath = ftpurl; ftpwebrequest ftp = (ftpwebrequest)ftpwebrequest.create(ftpfullpath); ftp.credentials = new networkcredential(ftpusername, ftppassword); ftp.keepalive = true; ftp.usebinary = true; ftp.method = webrequestmethods.ftp.uploadfile; filestream fs = file.openread(source); byte[] buffer = new byte[fs.length]; fs.read(buffer, 0, buffer.length); fs.close();...

r - change color of only one bar in ggplot -

i want color 1 bar in ggplot. data frame: area <- c("północ", "południe", "wschód", "zachód") sale <- c(16.5, 13.5, 14, 13) df.sale <- data.frame(area, sale) colnames(df.sale) <- c("obszar sprzedaży", "liczba sprzedanych produktów (w tys.)") and code plotting: plot.sale.bad <- ggplot(data=df.sale, aes(x=area, y=sale, fill=area)) + geom_bar(stat="identity") + scale_fill_manual(values=c("black", "red", "black", "black")) + xlab(colnames(df.sale)[1]) + ylab(colnames(df.sale)[2]) + ggtitle("porównanie sprzedaży") i have 1 bar colored , 3 others have default color (darkgrey, not black, looks bad me). how can change color of on bar or how name of default color of bars put them instead of black? option 1: change color of 1 bar. following henrick's suggestion, can create new variable nas default color , character strings/fact...

java - Finding uppercase in linkedlist and returning new linkedlist with found elements? -

i have write method search linkedlist(listnode, cointaining 1 char per listnode), finding uppercase chars, copy them new listnode , returning new listnode. code far, fails junit testing (provided prof.) this list node: public class listnode { public char element; public listnode next; } and method ive wrote, dont seem work: public static listnode copyuppercase(listnode head) { listnode newlistnode = mkempty(); if(head == null){ throw new listsexception("lists: null passed copyuppercase"); }else{ char[] sss = tostring(head).tochararray(); for(int = 0; < sss.length ; i++ ) if(character.isuppercase(sss[i])){ newlistnode.element = sss[i]; } newlistnode = newlistnode.next; } return newlistnode; } what worng code? why fail? expanding on @enterbios's answer (+1 him), try following: public static listnode toup...

mysql - Rewriting javascript code to php, what is the difficulty level -

this question has answer here: how can prevent sql injection in php? 28 answers im wondering better use security. can written in php? id switch of functions of site javascript. var withdrawing; function withdraw() { withdrawing=false; $.msgbox({ title:"withdraw funds", content:"<div id=\"_withdraw_content\"><br><small>enter valid <?php echo $settings['currency_sign']; ?> address:</small><br><input id=\"w_valid_ltc\" type='text' class='l' style='width: 100%;'><br><br><small>enter amount paid-out:</small><br><input id=\"w_amount\" type='text' class='l' style='width: 100px; text-align: center;'><br><br><small><small>min. value: <b>0.001</b> ...

c++ - int variable initialization failed in function -

i have function wants return vector, inside of function setup int counter (seasoning), increase 1 after each loop. when debug function, see counter not initialize, , correspondingly first 29 calculations (seasoning < 30) got 0 value. please see code, thanks! vector<float> richardrollprepayment::computingcpr( float maturity, float settledtime, float frequencypreyear, float couponrate, vector<float> mortgagerate ) { vector<float> cprvector(ceil((maturity-settledtime) * frequencypreyear)); float seasonality[] = { .94, .76, .73, .96, .98, .92, .99, 1.1, 1.18, 1.21, 1.23, .97 }; int seasoning = int(settledtime) * 12; (int = 0; < cprvector.size(); i++) { if (seasoning < 30) { cprvector[i] = (.2406 - .1389 * atan(5.952*(1.089 - couponrate/mortgagerate[i]))) * (seasoning/30) * seasonality[seasoning%12]; seasoning++; } else { cprvector[i] = (.2406 - .1389 * atan(5.952*(1.089 ...

php - Laravel 4 Multiple Search Fields -

i creating search function in laravel 4 application. it working great, in fact functioning well, thing when search example in postcode field , click search. i want value search stay in text input. setting value php variable in standard php/html. i have included controller function , text input field see below. appreciated, thanks. public function postsearch() { $search_order_from_date = input::get('search_order_from_date'); $search_order_to_date = input::get('search_order_to_date'); $search_order_type = input::get('search_order_type'); $search_order_status = input::get('search_order_status'); $search_order_agent = input::get('search_order_agent'); $search_order_assessor = input::get('search_order_assessor'); $search_order_postcode = input::get('search_order_postcode'); $orders = db::table('orders') // ->where('order_date', '>=', $search_order_from_date,...

postgresql - PHP Fatal error: Allowed memory size of xxx bytes exhausted (tried to allocate XX bytes) -

i have php script splits large file , inserts postgresql. import has worked before on php 5.3 , postgresql 8.3 , mac os x 10.5.8. moved on new mac pro. has plenty of ram (16mb), mac os x 10.9.2, php 5.5.8, postgresql 9.3. the problem when reading large import file. tab-separated file on 181 mb. have tried increase php memory 2gb (!) no more success. guess problem must in code reading text file , splitting it. error: php fatal error: allowed memory size of 2097152000 bytes exhausted (tried allocate 72 bytes) in /library/filemaker server/data/scripts/getgbifdata.php on line 20 is there better way this? read file , split lines, again split each line \t (tab). error on line: $arr = explode("\t", $line); here code: <?php ## have tried here, memory_limit in php.ini 256m ini_set("memory_limit","1000m"); $db= pg_connect('host=127.0.0.1 dbname=my_db_name user=username password=pass'); ### sett error_state: pg_set_error_verbosity($db,...

How to implement skype-like action bar design in android(custom action bar) -

Image
i intermediate android developer , have app should have custom designed action bar.i have researched , noticed skype uses customised action bar @ top.how did implement that?i need pointing right direction , rest can myself. below screenshot of skype design talking about. i posting might find helpful.the action bar in android bit rigid , doesn't offer developer freedom styling it.instead style window title bar suit design taste. that's how achieved design. tutorials on how on internet,and best thing simple.

Can someone help me with one of the pagination effect using javascript? -

http:// jsfiddle.net /mbh9w/2/ i want show 3 consecutive numbers in row.(ex:1 2 3) click "next" button, , shows 4 5 6, 7 8 click "prev" button, , shows 4 5 6, 1 2 3 can me code in javascript? thanks lot!!! you can use bootstrap paginator plugin purpose. can configured fit needs. snippet: <div id="example"></div> <script type='text/javascript'> var options = { currentpage: 3, totalpages: 10 } $('#example').bootstrappaginator(options); </script>

java - send response to local file -

i've got simple html page 1 button <html> <head> <script> function sender() { var oreq = new xmlhttprequest(); oreq.open('get', 'http://localhost:8888?param2=value2', true); oreq.onreadystatechange = function() { if (oreq.readystate == 4) { if (oreq.status == 200) { alert(xmlhttp.responsetext); } if (oreq.status == 404) { alert("404040404!"); } } }; oreq.send(); } </script> </head> <body> <button id="click" onclick="sender();">send</button> </body> </html> and i've got simple http server written on java nothing except reading incoming requests , showing console. but how send response file server? example file located th...

vb.net - assigning integers to array as user enters them -

i working on problem in text book. interface allows user enter number of each car type sold. add total button should use array accumulate numbers sold each car type. should display in lblnew , lblused total of each sold. there way use loop add new integers arrays intnew() , intused() without knowing how many numbers user enter? (im concerned intnew() right now) public class frmmain dim total integer = 0 private sub frmmain_load(sender object, e eventargs) handles me.load ' fill list box values lstcartype.items.add("new") lstcartype.items.add("used") lstcartype.selectedindex = 0 end sub private sub btnadd_click(sender object, e eventargs) handles btnadd.click ' adds amount sold appropriate total ' declare accumulator array , variables dim intnew() integer = {} 'dim intused integer = {} dim index integer = 0 dim intsold integer dim inttotal integer ' update array value if lstcartyp...

hibernate too many sql -

i have test1 class , test2 class they 1 one , fetch type lazy. @entity @table(name = "test1") public class test1 { @id @generatedvalue(strategy = generationtype.identity) @column private int id; @column(name="name") private string name; @onetoone(cascade = cascadetype.all,fetch = fetchtype.eager) @joincolumn(name = "test2_id") private test2 test2; ... } @entity @table(name = "test2") public class test2 { @id @generatedvalue(strategy = generationtype.identity) @column private int id; @column(name="name") private string name; @onetoone(mappedby = "test2") ... } i want records database : criteria dc2 = sessionfactory. getcurrentsession().createcriteria(test1.class,"mr"); list<test1> reports2= dc2.list(); for(test1 test:reports2){ test.gettest2().getname(); } but console show sql is: hibe...

JavaScript unit test tools for TDD -

Image
i've looked , considered many javascript unit tests , testing tools, have been unable find suitable option remain tdd compliant. so, there javascript unit test tool tdd compliant? karma or protractor karma javascript test-runner built node.js , meant unit testing. the protractor end-to-end testing , uses selenium web driver drive tests. both have been made angular team. can use assertion-library want either. screencast: karma getting started related : should using protractor or karma end-to-end testing? can protractor , karma used together? pros : uses node.js, compatible win/os x/linux run tests browser or headless phantomjs run on multiple clients @ once option launch, capture, , automatically shutdown browsers option run server/clients on development computer or separately run tests command line (can integrated ant/maven) write tests xunit or bdd style supports multiple javascript test frameworks auto-run tests on save proxies requests ...

dns - Do Google Analytics store sent data to non existing domains? -

please, knows: google analytics store sent data non existing domains? if yes, how access them? problem forgot create custom dimensions in google analytics admin page , sent data 2 weeks ago web site as: ga('send','pageview',{'dimension1':placeid,'dimension2':videoid,'dimension3':date}); i need somehow data 2 weeks ago. the metric "pageview" can see, how access data 'dimention1','dimensiot2' if not created before? possible? created dimensions on admin page, in report empty of cause. thanks you can try pulling data using api console, date range.

MySQL calculated column using two tables -

i've got table of clubmembers integer id (pk) i've got table lists couple of ids (life members of club) i want create view clubmembers, plus column calculates membership type works this: if (clubmember.id in lifemembers) result = "life" elseif (clubmember.datejoinedclub on 1 year ago) result = "full" else result = "probationary" but have no idea how in sql. use left join , case , this: select cm.*, case when lm.id not null 'life' when now() > date_add(cm.datejoinedclub, interval 1 year) 'full' else 'probationary' end `result` clubmembers cm left join lifemembers lm on cm.id = lm.id

sql server - Join with comma-separated data returned from function using SQL -

i trying hard on this, unable solve it. have data coming comma-separated column, , splitting function, , need return comma-separated values. i doing outer join applicationdocument table . here query: select pa.id, ad.id, ad.documenttitle, ad.path , s.value dbo.applicationdocument ad right join dbo.postapplication pa on ad.applicationid = pa.id join dbo.post p on pa.jobid = p.id outer apply dbo.fnsplit(p.requireddocuments,',') s s.value = ad.documenttitle cross apply (select value dbo.fnsplit(p.requireddocuments,',') value =ad.documenttitle) s

objective c - Manipulating Facebook/JSON data -

i'm trying handle facebook json data , transform nsmutable dictionary, i'm getting (null) when try print data. although when try count, number. user_likes nsmutabledictionary globally defined. i'm getting (null) on line: nslog(@"user likes: %@", user_likes); this code: nsstring *query = @"select page_id, type page_fan uid = me() "; // set query parameter nsdictionary *queryparam = @{ @"q": query }; // make api request uses fql [fbrequestconnection startwithgraphpath:@"/fql" parameters:queryparam httpmethod:@"get" completionhandler:^(fbrequestconnection *connection, id results, nserror *error) { if (error) { nslog(@"error: %@", [error localizeddescription]); } else { user_likes = [nsjsonserialization jsonobjectwithdata:results options:kniloptions error:&error]; nslog(@"user likes: %@", user_likes); nsinteger* n_user_likes = [results count]; nsinteger* n_user_likes2 = [use...

javascript - If = one class, but has two classes -

i have validation script validates 2 different classes. want add additional class select boxes generate array onmouseover. problem is, select boxes have 2 classes, 1 validation, 1 array, , script doesn't recognize unless has exact name. if using == doesn't work @ all, using = tries validate elements on page, without classes. i'm wondering how can make efficient without breaking rest of pages using script. this example of html <div class="select-styled"> <select id="pm" name="pm" class="selvalidate pmpop" onmouseover="pmpop();"> <option value="foo">foo</option> <option value="">- remove -</option> </select> </div> here validation script for (i=0; i<thisform.elements.length; i++) { if (thisform.elements[i].classname = "selvalidate" || thisform.elements[i].classname == "req" || thisform.elemen...

c++ - Data Validation in a Constructor? -

i beginner oo-programming, , question handling data validation in particular design. have read this thread similar problem, , second solution, recommends re-designing constructor interface such invalid values impossible, wonder whether idea applicable case. have outlined thoughts below , know if people agree ideas. i have die class, constructed passing vector of probabilities. probabilities must non-negative, , must add 1.0. class die { public: die(/* probability vector. */); int roll(); } i can think of several options implement data validation: the die constructor protected , accepts std::vector<double> . have static public method performs data validation, , returns pointer new die object if successful, , null otherwise. create probabilityvector class, wraps around std::vector<double> , , implement data validation there (with protected constructor + public static method above). die constructor accepts (pointer a) probabilityvector . implement...

Why is this c++ program not working? -

write program have base class number , 2 derived classes: square , cube . calculate square number (a*a ) , cube of number (a*a*a) #include <iostream> #include <conio.h> using namespace std; class number { protected: int ; int y; public: a*a = y; a*a*a=y }; class square : number { int , y; public: (a*a) = y; }; class cube : number { int a, y; public: (a*a*a) = y; }; int main() { int a; cout << "enter number "<< endl; cin >> >>endl ; cout << " square of number : " << (a*a); cout << "enter number "; cin >> a; cout << " cube of number : " << (a*a*a); return (0); } public: a*a = y; a*a*a=y is not function. the private: protected: public: sections define how function or variable can seen outside of class. cannot assignment within them: need put assignments function, such function in...

php - unexpected T_STRING in buddypress member header -

in buddypress can add member profile fields member header, beside user avatar. in buddypress member-header.php section commented out so: <?php /*** * if you'd show specific profile fields here use: * bp_member_profile_data( 'field=about me' ); -- pass name of field */ do_action( 'bp_profile_header_meta' ); ?> this changed to add profile field data "location": <?php bp_member_profile_data( 'field=location’ ); do_action( 'bp_profile_header_meta' ); ?> this code used gives me t_string error in return. have no php experience think it's easy fix, given wordpress developers practically spell out how use feature. any appreciated. the syntax highlighter shows error. have funky quote: bp_member_profile_data( 'field=location’ ); <--here change to: bp_member_profile_data( 'field=location' );

Firebase - Request only new data using the Streaming API in Ruby or Python -

i've posted in firebase's google group haven't received answer thought try here. let me outline current scenario i have global messages bucket stores messages room. path messages/room_1/ store prioritized list of messages room 1. i want stream latest messages rooms can send push notifications offline users. want listen /messages path ruby or python backed server , send notifications offline users. my problem when start listening /messages path entire set of data, can millions of messages. after initial bulk load, new incoming messages in real time. there way skip initial bulk load of data , new messages start of streaming connection? fyi, i'm using examples page: https://www.firebase.com/blog/2014-03-24-streaming-for-firebase-rest-api.html

internet explorer - Javascript alerts not working for browser MSIE on Xbox One -

this 1 may simple. javascript alerts not working on msie xbox one. i've tested them on pc, osx, nokia phone, iphone. javascript works i'm using socket.io. here code: function changegamertag() { if (socket.socket.connected) { socket.emit('partyup add user', prompt("enter gamertag: ") + '['+ masterrace + ']'); } else { alert('party server offline.'); } } you try library jquery ui: https://jqueryui.com/dialog/ . see example under 'view source' libraries & css include. use show dialog: $('<div title="oops"><p>party server offline.</p></div>').dialog();

javascript - Triggering an 'error' type eventlistener on a HTTPRequest? -

i have httprequest use send below: cw.xhr.load({ "method": "get", "rdata": datajson, "url": "php/entries.php", "responce": { "load": formatresults, "error": errorloading } -- cw.xhr xhr request use send above object. in httprequest, have added eventlistner on "load" , "error" this works fine , if echo entries.php, trigger 'formatresults' js function , can capture response text request. what want know however, how trigger error eventlistener type? if don't want echo back, say, search results, alert there no results, want trigger 'errorloading' function. (no jquery please) guys! return either status code other 200 (such 400) or object represents error server, call error handler function. function formatresults(response){ if(response.error){ this.errorloading({error: response.error}); return; } if(resp...

csv - SUPERCSV OutOfMemoryError: Java heap space in CsvListReader -

i know question being asked before limit csvlistreader 1 line i facing same issue, can please tell me changes made tokenizer overcome issue... in case occurring in different line number everytime, not consistent.sometimes occurs @ line 5000 of csv , other time occur @ 6000 if go debug mode , step on code 1 one never occurs. can me issue. pardon me asking same question again, can't seem find solution on own. one of csv line @ throws error "???" japanese text "ci","1","2014-04-01","bmw","","","","","","3","528","",0,0,"","","c","","","1","f","1"," 8"," 8",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,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...

python - django rest framework nested objects -

i'm trying find elegant solution problem encountered using django rest framework. have parent model child object , 1 one relationship. our requirements child object optional, can null , can patched null existing value. additionally, if parent object deleted child object should well. this simple set-up recreates problem: class childserializer(serializers.modelserializer): class meta: model = child class parentserializer(serializers.hyperlinkedmodelserializer): class meta: model = parent parent_value = serializers.charfield(required=false, max_length=1024) child = childserializer(read_only=false, required=false, many=false) class parent(models.model): class meta: app_label = "testparent" parent_value = models.charfield(max_length=1024, null=true, blank=true) class child(models.model): class meta: app_label = "testparent" child_value = models.charfield(max_length=1024, null=true, blank...

html - How Do I Get Rid of the Extra White Space at the Bottom of My Nav Bar? -

i've figured out how center nav bar , stick top of screen... reason when got stick top of screen adds random white space... there way can remove it? mineflow.us thanks. just set in css: body { padding:0 !important; margin:0 !important; }

c# - How to call Thread.Join for all threads in Win Forms -

i have windows form listed below. has multiple background threads, sta , etc… have function named myfinalpiece() . need join threads associated form before calling method. how can call thread.join here threads (irrespective of how many threads there)? note: if add new thread in future call should work without break. code public partial class form1 : form { int lognumber = 0; public form1() { initializecomponent(); } private void form1_load(object sender, eventargs e) { writelogfunction("**"); //......other threads //..main thread logic //all threads should have been completed before this. myfinalpiece(); } private void myfinalpiece() { } private void writelogfunction(string strmessage) { string filename = "mylog_" + datetime.now.tostring("yyyymmmmdd"); filename = filename + ".txt"; using (streamwriter w = file...

How to merge multiple csv files into 1 SAS file -

i started using sas 3 days ago , need merge ~50 csv files 1 sas dataset. the 50 csv files have multiple variables 1 variable in common i.e. "region_id" i've used sas enterprise guide drag , drop functionalities manual , took me half day upload , merge 47 csv files 1 sas file. i wondering whether has more intelligent way of doing using base sas? any advice , tips appreciated! thank you! example filenames: 2011census_b01_aust_short 2011census_b02a_aust_short 2011census_b02b_aust_short 2011census_b03_aust_short . . 2011census_xx_aust_short i have more 50 csv files upload , merge. the number , type of variables in csv file varies in each csv file. however, csv files have 1 common variable = "region_id" example variables: region_id, tot_p_m, tot_p_f, tot_p_p, age_0_4_yr_f etc... first, we'll need automated way import. below simple macro takes location of file , name of file inputs, , outputs dataset work directory. (i'd use conc...

Can i call a function using new in c++? -

i want know suppose have function say int add(int i, int j) { return (i+j); } at point can call function using new like int result = new add(3,4); thanks in advance. new returns pointer dynamically allocated object. syntax of form new t(optional initializer expression) . need int* result = new int(add(3,4));

mongodb - Increment all array elements -

i have document this: { "_id" : objectid("534527e489e46c16787bda0f"), "packages" : [ { number: 1 }, { number: 2 } ] } i want increment packages.number @ once. possible? i tried db.collection.update({}, {$inc: {"packages.number": 1}}) didn't work. no isn't possible , reason given in use of positional $ operator. , says when used ever first match found. so did not try match in array, in value in positional operator use index in: db.collection.update( { "packages.number": 1 }, { "$inc": { "packages.$.number": 1 } } ) but in general cannot update members of array @ once, can retrieve document , update in client code before writing back.

javascript - Adding bootstrap.js to browserify? -

so trying figure out how this? downloaded bootstrap-sass via bower , added bootstrap javascript shim. a few things have me confused, bootstrap.js file looks this. //= require bootstrap/affix //= require bootstrap/alert //= require bootstrap/button //= require bootstrap/carousel //= require bootstrap/collapse //= require bootstrap/dropdown //= require bootstrap/tab //= require bootstrap/transition //= require bootstrap/scrollspy //= require bootstrap/modal //= require bootstrap/tooltip //= require bootstrap/popover this kind of self explanatory, still confusing @ same time, leave commented that? when add bootstrap shim include bootstrap.js file, or should link ones need? just save myself hacking away (which doing in meantime), i'd try information on how include bootstrap.js browserify. edit: think might have concat files need , include script, because when browserify bootstrap.js above. i'll try without comments, if fails i'll concat scripts 1 file , see hap...

uiview - Unable to hide status bar on iOS 6,7 when presenting viewcontroller -

the following custom vc presentation code: -(void)presentviewcontroller:(uiviewcontroller*)vc { uiwindow *w = [[[uiapplication sharedapplication] delegate] window]; uiviewcontroller *parentcontroller = (tabbarviewcontroller *)[w rootviewcontroller]; [parentcontroller addchildviewcontroller:vc]; if ([vc respondstoselector:@selector(beginappearancetransition:animated:)]) // ios 6 { [vc beginappearancetransition:yes animated:yes]; } uiview *toview = vc.view; [parentcontroller.view addsubview:toview]; toview.frame = parentcontroller.view.bounds; cgaffinetransform tr = cgaffinetransformscale(self.view.transform, 1.0f, 1.0f); toview.transform = cgaffinetransformscale(self.view.transform, 0.01f, 0.01f);; cgpoint oldcenter = toview.center; toview.center = ((rootviewcontrollerex*)vc).cellcenter; [uiview animatewithduration:4.5 animations:^{ toview.transform = tr; toview.center = oldcenter; } co...

sql - outputting null values when converting vb transformation from dts to ssis -

i struggling converting old dts packages use activex vbscript transformations ssis packages. input 8 character string in yyyymmdd format. transformation converting date if possible. if not, value should null. here dts code theyear = mid(dtssource("ship_date"),1,4) themonth = mid(dtssource("ship_date"),5,2) theday = mid(dtssource("ship_date"),7,2) thedate = themonth &"/"&theday&"/"&theyear if isdate(thedate) dtsdestination("ship_date") = thedate end if here have ssis transformation dim theyear string dim themonth string dim theday string dim thedate string if row.shipdate.length >= 8 theyear = row.shipdate.substring(0, 4) themonth = row.shipdate.substring(4, 2) theday = row.shipdate.substring(6, 2) thedate = themonth & "/" & theday & "/" & theyear if isdate(thedate) row.outshipdate = thedate else row.outshipdate = n...

SOAP request authentication in VB.NET -

i'm trying write soap request 3rd party web service in vb. i've added service reference automatically added following web.config: <basichttpbinding> <binding name="soap11"> <security mode="none"> <transport clientcredentialtype="none" proxycredentialtype="none" realm="" /> <message clientcredentialtype="username" algorithmsuite="default" /> </security> </binding> </basichttpbinding> now have write following request: <soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:header> <wsse:security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> <wsse:usernametoken> <wsse:username>username</wsse:username> ...