Posts

Showing posts from August, 2012

HTML/CSS footer on mobile site doesn't work on IPhone safari How to fix? -

i'm having trouble mobile website. client wants these text based buttons/links on bottom added them, i'm little rusty on using size percentages. i need make , stay on same line, stretch accordingly text isn't small read. can make looks , works fine on samsung or nexus, using iphone caused third text element move next line rather shrink. mobile website: http://teetimelawn.com/m/html/index.html edit (screnshot of iphone simulator showing problem): http://i.imgur.com/r0re0i5.png how typically looks on android phones liks nexus: http://i.imgur.com/tkplv4v.jpg html: <section id="footer"> <div id="footer"> <div id="full"><a href="http://www.teetimelawncare.com">full site</a></div> <div id="foot"><a href="tel:18156096969">call us</a></div> <div id="footer-right">tee time lawn care &copy; </d

razor - Appaling RazorEngine 3.3 performance, compared to StringTemplate4 -

is there reason or doing wrong, why razorengine slow parse 100 different templates? looking stringtemplate, , performed 2 tests compare, per below. [test] public void teststringtemplate() { csstopwatch stopwatch = new csstopwatch(); stopwatch.start(); stringbuilder sb = new stringbuilder(); (int = 0; < 100; i++) { string template = @"hello there name <name> <surname> " + i; textparsetests.testmodel model = new textparsetests.testmodel(); model.name = "karl"; model.surname = "cassar"; template t = new template(template); t.add("name", model.name); t.add("surname", model.surname); var result = t.render(); sb.appendline(result); } stopwatch.stop(); var ms = stopwatch.elapsedmilliseconds; int k = 5; //109ms }

c++ - What is difference between int (*p)[3] and int *p[3]? -

this question has answer here: c pointer array/array of pointers disambiguation 11 answers i totally understand " int *p[3] " ( p array of 3 pointer meaning can have 3 different rows of number of ints allocating memory our size of different rows). my confusion lies " int (*p)[3] " signifies? "p" stores address of 3 contiguous memory of int or else? please clarify , how use use in program distinguish them. thanks lot in advance. @revised sorry putting duplicate question. didn't search doubt intensively. doubt still remains novice programmer. went through both pages of q/a c pointer array/array of pointers disambiguation and int (*p) [4]? second link partly clears doubt eliminate doubt please explain above question in reference stack , heap: example int *p[3]; // (1) take 12(3*4bytes) bytes of stack , heap depen

How do you add borders onto a heatmap created by the pheatmap R package? -

i creating heatmap using following code: pheatmap(tissuedata3, color = colorramppalette(rev(c("#d73027", "#fc8d59", "#fee090", "#ffffbf", "#e0f3f8", "#91bfdb", "#4575b4")))(100), cellwidth = 20, cellheight = 2.8, border=true, treeheight_row=0, treeheight_column=0, kmeans_k = na, show_rownames = t, show_colnames = t, fontsize=2, scale="none", clustering_method = "complete", cluster_rows = false, cluster_cols = true, clustering_distance_rows = "euclidean", clustering_distance_cols = "euclidean", legend=true, ) however, resulting heatmap not contain borders. know how add borders cells , heatmap whole? i think correct parameter border_color default "grey60", suspected (incorrectly turned out) getting partial name match argument "border" value becomes colors()[1] [1] "white&q

Bootstrap Carousel slide issue (Issue with Handlebars perhaps?) -

hoping can shed light on issue i'm having bootstraps carousel , handlebars. http://padpeep.com/collection/52 i hoping simple, handlebars loads in data php template forms slider. slider , thumbnail renders can't thumbs click , change slider position thumb. this bit doesnt work. see console output show foo (the slide id) not action click. $('.thumbbtn').on("click", function() { //var count = slide id var foo = $(this).attr("data-count"); //log console.log("thumbbuttonclick" + foo); //change carousel slide $('#mycarousel').carousel(foo); }); error: uncaught typeerror: property '5' of object # not function i got error when forgot include jquery ui library. add line after include jquery. <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/jquery-ui.min.js"></scrip

Display the last part of URL javascript? -

i need display last part of url using javascript! i using code display entire url: <script language="javascript"> document.writeln(document.location); var url = $(this).attr("href"); var part = url.substring(url.lastindexof('/') + 1); </script> if url this: domain.com/something/file i need display "file". <script type="text/javascript"> var segment_str = window.location.pathname; // return segment1/segment2/segment3/segment4 var segment_array = segment_str.split( '/' ); var last_segment = segment_array.pop(); document.write(last_segment); // alerts segment4 </script> jsfiddle: http://jsfiddle.net/hnmv3/1/

SAS Macro variable to represent what is in an IN statement in Proc SQL -

i have query want run through sas in proc sql getting data 1 of our company databases. @ top of query, ease of use mostly, want able put list of input variables. interested in getting data in dates , states. dates care contiguous make sas macro variable start date , end date , use between statement. that's easy enough. but, states, can't such thing. so, thought like %let states = ('ct', 'md', 'me', 'nc', 'wv'); and later on, want statement where (state_tp in &states) now, not work. and, i've tried several other variations can't seem work. possible? while code fine is, better solution (that might have less issues anyway) create dataset desired states, , join against (or use exists clause if better needs). easier maintain (as can keep dataset in editable format separate code, in excel) , may faster in cases. data states; input state_tp $; datalines; ct md me nc wv ;;;; run; proc sql; create table

javascript - Incrementing letters in string - treating char as int without using .charCodeAt(0) -

here assignment: replace every letter in string letter following in alphabet (ie. c becomes d, z becomes a). now i've done type of thing in c lessons using fancy modulo 26 business , lot of subtraction , offsetting of ascii values. is going take more lines in javascript (since instead of treating char int have use fromcharcode , charcodeat ), or javascript have shortcuts task? you can try using this:- string.fromcharcode('a'.charcodeat(0) + 1) working jsfiddle

excel - Formula to recognize a column in a table via a cell reference -

i'm using =averageifs function in excel , trying have recognize want input column reference. i have dropdown table if wants find value in table, can automatically see it. in c11:c14 have dropdown values. works except c14 , references column in table in different worksheet. i've tried inputting "master!table1[sum 10%]" c14 , formula won't recognize trying call column. thoughts? =averageifs(c14, table1[division],c13, table1[product domain], c12, table1[lead source], c11) please check name scope table1 workbook , try indirect(c14) instead of c14 .

javascript can't assign variable values due to asynchronous function. -

in javascript code below, cannot user_likes take value of response. can console output "response", , has values need. however, when try console output user_likes, undefined. gives? function fqluserlikes(user_id) { var user_likes; fb.api( { method: 'fql.query', query: 'select page_id,name,type page page_id in (select page_id page_fan uid=' + user_id + ')' }, function(response) { user_likes=response; } ); console.log(user_likes); return user_likes; } thanks help, i.n. your method asynchronous, when try log , return variable, hasn't been assigned yet. take below snippet: //do need in here! function(response) { user_likes=response; }); //the below code executed before callback above. //also, should console, , not console. js case sensi. console.log(user_likes); return user_likes;

opengl - Smooth water borders -

Image
i trying make 3d terrain water, water borders doesn't smooth. here picture: the water plane @ water level shader effects. is there method make borders smoother? the water seems stop @ grids of terrain mesh. simulation permit overlap of water , terrain in same patch?

runtime error - Cannot run mpi program -

i trying run simple mpi code on 2 linux vm. have set nfs folder share executable.i aslo have ssh connection passphrase , able ssh both machines. the problem when use mpirun -f flag specify host file execution breaks , bunch of errors(i prompt entering passphrase , after errors pops up). code compiled fine , able run program on single machine successfully. here list. know long can use slightest of now. sorry , thank you [proxy:0:1@rahul1-virtualbox] version_fn (./pm/pmiserv/pmip_utils.c:453): ui version string not match proxy version [proxy:0:1@rahul1-virtualbox] match_arg (./utils/args/args.c:153): match handler returned error [proxy:0:1@rahul1-virtualbox] hydu_parse_array (./utils/args/args.c:175): argument matching returned error [proxy:0:1@rahul1-virtualbox] parse_exec_params (./pm/pmiserv/pmip_cb.c:769): error parsing input array [proxy:0:1@rahul1-virtualbox] procinfo (./pm/pmiserv/pmip_cb.c:853): unable parse argument list [proxy:0:1@rahul1-virtualbox] hyd_pmcd_pmip_c

php - Blog page showing same as homepage -

i'm trying have posts post on page(blog) , 'home' page display front page. both pages have own templates assigned them (home home, blog blog). in reading settings, i've set front page home, posts page blog. when go url.com/blog, displays same template home page. i'm not sure why won't display 2 blog posts. in home.php template, have following code, issue? <!-- display featured images --> <?php $args = array('post_type'=> 'page'); query_posts( $args ); ?> <!-- featured images --> <div class="main-thumb left"> <?php if ( have_posts() ) { while ( have_posts() ) { the_post(); ?> <li> <a href="<?php echo get_permalink(); ?>"> <div class="tint"> <div class="overlay

breeze - How do I bind the column with the property? -

i'm trying connect slickgrid , breeze.js , got problem. breeze generates js model you, , object properties has , set methods like: var p1 = myobj.property1(); var p2 = myobj.property2(); myobj.property1("test"); but in slickgrid columns model, how bind column property? columns : [ { id: "id", name: "id", field: "property1" //this way see every row on page text "function..." }, { id: "prop2", name: "prop2", field: "property2" } ] try using breeze "backingstore" adapter instead of default "ko" (knockout) adapter. this requires single line of breeze configuration near top of file breeze.config.initializeadapterinstance("modellibrary", "backingstore", true); the backingstore adapter creates es5 props model instead of "knockout" properties.

google app engine - GAE (Python) form file upload + email file as attachment -

i need implement rather simple web form on google app engine (gae-python) accepts form input (name, email, telephone) , resume (typically txt, pdf or doc/docx) file. once form submitted, want contents of form emailed , if file submitted in form, included attachment in same email designated email address. i don't need file exist after emailed/attached. sort of temp file, or stored in temp blob store. with html5 , jquery, there lot of fancy user interfaces implement file uploads. there recommended approach use 1 of these work nicely gae, being able degrade gracefully if browser not support modern methods (namely ie)? i using jinja2 framework, if relevant. (i python novice way) thanks in advance! for upload file blob in gae need blobstore_handlers built-in framework called webapp . docs have complete sample upload files , not think there other ways upload blobstore. when have blob see first sample of page docs attach blob email. now, "temp file solut

java - strange behaviour : export CLASSPATH=$(JARS=(./lib/*.jar); IFS=:; echo "${JARS[*]}") -

export classpath=$(jars=(./lib/*.jar); ifs=:; echo "${jars[*]}") if put line in bash_script.sh , chmod +x bash_script.sh and run ./bash_script.sh it gives error. syntax error: "(" unexpected (expecting ")") how ever able run thing directly prompt , expected result. as $ export classpath=$(jars=(./lib/*.jar); ifs=:; echo "${jars[*]}") i wondering reason strange behaviour. make sure have #!/bin/bash @ top of shell script. array syntax var=(...) bash-ism. won't work in plain sh ( #!/bin/sh ). by way, looks line my answer here . if so, encourage use updated solution rather this. there's no need manually build classpath list. java supports convenient wildcard syntax directories containing jar files. java -cp "$lib/*" (read more)

api - How can I filter sales_order_shipment.list by order increment_id -

i want find shipments on order (sales order info not appear have information) data::printer dump format [0] "sales_order_shipment.list", [1] [ [0] { increment_id { eq 100000025 } } ] but filters shipment increment id. this [0] "sales_order_shipment.list", [1] [ [0] { order_increment_id { eq 100000025 } } ] which throws sql error. suspect need join tables via api somehow, i'm not sure how can that. this possible using filter on order's order_id value. note order_id different order's increment_id usual customer facing reference number. therefore step required convert order's reference order_id . i can describe method: get order data order number ( increment_id ) using sales_order.info api call get order_id order data use order_id filter in sales_order_shipment.list this give list of shipments each increment_id . id shipment's referen

.htaccess - Rewrite only working for first use -

on godaddy linux hosting, mod rewrite working, having strange problem. simple code looks this: options +followsymlinks -multiviews rewriteengine on rewritebase / ## clean urls rewriterule ^blog/([^/.]+)/?$ blog.php?title=$1 [l] then test went blog.php?title=testing did supposed , rewrote url blog/testing . when went blog.php?title=test or blog.php?title=new did not rewrite url, tried going blog/test , blog/new , gave me 404 error. thought broke. went blog.php?title=testing , worked again. worked first url entered. also have domain set in folder under root. root example.com site example.com/something godaddy turns something.com . i want clean urls, still want php able use $_get on querystring, want nice seo url example.com/blog/title first rule should redirect php file pretty url second rule should internally redirect pretty url old 1 internally not visible user: options +followsymlinks -multiviews rewriteengine on rewritebase / # redirect /blog.php?ti

tfs - Running unit test in the build agent using Visual Studio Services -

i'm trying run unit tests in build server of visual studio. unfortunately, message: no test found. make sure installed test discoverers & executors, platform & framework version settings appropriate , try again. i gave test setting files run, specified run settings, set msbuild x86 , target platform x86: emulator wvga tried specify regex pattern find test dlls. still no luck. doing wrong ? i'm using mstest. edit : apparently, believe mistakenly thought windows phone unit test project different normal unit test project. able see test sources when use normal unit test project. correct me if i'm wrong. question what's point of windows phone unit test app? if using third party test framework need install on controller server. check http://www.visualstudio.com/get-started/create-and-run-unit-tests-vs#frameworks

android - Some appwidgets won't update? -

i writing launcher activity host appwidgets. here doing. my container view appwidgets customized viewgroup. when adding widgets, call config activity first widget being added. i calling appwidgethost.startlistening() in main activity.onstart() , stoplistening() in onstop() when adding widget, here application.getappwidgetmanager().bindappwidgetidifallowed(appwidgetid, componentname); appwidgethostview hostview = application.getappwidgethost().createview(context, appwidgetid, appwidgetinfo); hostview.setappwidget(widgetid, appwidgetinfo); myviewgroup.addview(hostview); i not seeing remoteexception in logs , calling appwidgethost.startlistening() aggressively doesn't help. in addition, not widgets fail update, stock clock widget, example, works fine. happens on minimalistic text widget , others. once widget has been added, able update 1~2 minutes before stop working. other related observation when tap minimalistic widget, modify layout , save. new layout won't appli

mysql - SQL Optimization, Nested Query -

what better way implement such view query doesn't take long. select * table id in ( select id table group id having count(id) > 1 ) our server need run every 10 mins. thought of indexing id wasn't sure if right way go. select t.* table t join ( select id table group id having count(id) > 1 ) on a.id=t.id

.net - clicking a button without id -

hello people ive tried multiple ways of trying click button without , id code below for each element htmlelement in webbrowser1.document.getelementsbytagname("button") if element.innertext.contains(" yt-uix-button yt-uix-button-primary yt-uix-button- size-default") element.invokemember("click") exit end if next element error: object reference not set instance of object.

visual studio 2010 - MSBuild Tasks Execution -

vs 2010 - .net 4.0 in .csproj file if dropped following code @ bottom of file inside tag why not run? <target name="foobared" > <message text="hello foobar" /> </target> i trying understand makes target execute. have .targets file target in getting imported proj file , runs fine. i have .targets file target in no condition , not run. 1) change importance of message task. add importance="high" message task . 2) 'foobared' not default build target. you'll either need pass "/t:foobared" msbuild.exe command, or cause target execute using dependsontargets, aftertargets, or beforetargets .

javascript - Why does jQuery only return integer height if setting a double value clearly renders differently? -

i've got image 924px in height. image has been created appropriate @ height. stretching not desireable. ontop of image, need overlay variable number of same-height div elements. in particular instance need overlay 88. such, math pretty clear: 924 / 88 = 10.5 each div element must 10.5 pixels in height overlay image. visually, looks great! have 88 elements , they're 10.5 pixels in height. if set height 11px or 10px see visual differences. however, using jquery: $('div').height(); // 10 $('div').css('height'); //10px ?? huh? they're 10.5 pixels in height, not 10. if dig element's style property -- see 10.5 pixels. what's going on? can jquery play nice double values height/width? why opposed? using jquery.height() converts actual amount of pixels taking on screen. you may find, if iterated through every div on page mixture of height 10's , 11's, since can't render on half pixel, render things take

What is the default insertion order in zend lucene index? -

i'm building application need bring posibility navigate trough 1 index or more (without query). when inserting documents on index thought available on same order been inserted, isn't that. if insert in 1 field numerical values or alphanumeric representations. i thought getting documents (1, 2, 3, 10, 14, 28, 56, 57) like: for($x=0;$x<$index->maxdoc();$x++){ echo $index->getdocument($x)->idfield."<br>"; } ... wold 1, 2, 3, 10, 14, 28, 56, 57... right?, doesn't happen. 57, 1, 28, 2, 10, 3, 14, 56... , that's question. there default order on insertion? your best friend in figuring out going lucene source code. find default order, may not liking. by way, why need navigate through index without query? (maybe there different way approach problem.)

C Token Parsing -

so i'm trying implement token parser doesn't use c library functions strtok() etc i'm having few issues access violations , after reading several similar questions on here still haven't got nailed down. willing offer pointers? int main(int argc, char* argv[]) { int maxtokens = 10; char* tokens[10]; int i; for(i = 0; < maxtokens; i++) { tokens[i] = null; } char* str = "this,is,a,test,string"; int result = parseline(str, ',', tokens, maxtokens); printf("%d tokens found!", result); system("pause"); return 0; } int parseline(char* str, char delimeter, char* tokens[], int maxtokens) { char* srcstr = str; int strlen = 0; int tokencount = 0; if(srcstr[strlen] != delimeter && srcstr[strlen] != '\0') { tokens[tokencount] = (char*) malloc(sizeof(char)*strlen+1); tokens[tokencount] = &srcstr[strlen]; tokencount++;

C: Segmentation fault with printing Link List -

i'm pretty new c, wanted build program allows users store ip addresses obtained traceroute/tracert first stored text file. allows them print next/previous hop. used linked list, printing gives me segmentation error. i tried looking through can't find error, point out error , guide me? in advance!! (sorry poor indentation!!) # include <stdio.h> # include <string.h> # include <stdlib.h> int id = 0; int list = 0; int nodes = 0; file *readfile(char *filename) { file *rawdata = fopen(filename, "r"); return rawdata; } void printmenu() { printf(" ========== menu =============\n\n"); printf("1. report id of previous hops of network node\n"); printf("2. identify next hops of network node\n"); printf("3. quit\n"); } int getinput() { int choice; printf("please select choice (1 3) =>: "); scanf("%d", &choice); return choice; } struct nodeinfo { int id; int i

user interface - Insert a new line in listbox on Matlab GUIDE -

i'm building gui using guide , have listbox want receive several messages after click in send_button every time click on button message shows in first line. function send_button_callback(hobject, eventdata, handles) % hobject handle send_button (see gcbo) % eventdata reserved - defined in future version of matlab % handles structure handles , user data (see guidata) % text dstid = get(handles.dest_id,'string'); msg = get(handles.message_box,'string'); % message_box = editbox % build message , send msg = {['< ', dstid, ' > ', msg]}; % dstid = number set(handles.message_list, 'string', msg); % message_list = listbox what should in order have like <3> message 1 <3> message 2 <3> message 3 i think happens because msg string don't know how insert '\n' or that. you can cell array of strings containing items of listbox get(handles.message_list,'strin

php - Adding datas into an array / coupling arrays -

i haves 2 arrays : the first 1 : $positions = array(0 => array(6.35,3.93), 1 => array(16.85,3.93), 2 => array(6.35,10.9), 3 => array(16.85,10.9), 4 => array(6.35,18.48), 5 => array(16.85,18.48), 6 =>a rray(6.35,25.45), 7 => array(16.85,25.45)); the second 1 : $coupons = array ( [0] => ngp7xdaerk [1] => lntkt38dxj [2] => ubg2fplvnx [3] => ymmko6ef16 [4] => zszcasrwrj [5] => cl6uj1a7vs [6] => lrjc5vnpl6 [7] => mexuzqbols ) ; i'd merge 2 arrays have : array(0 => array(6.35,3.93, ngp7xdaerk ), 1 => array(16.85,3.93, lntkt38dxj ), ... i'm not familiar handling arrays that, i've heard of array_push , array_merge, know have use foreach loop in order avoid keys added, don't know how make concrete such informtion ^^ could guys me ? :) thanks lot :) assuming arrays both same length. use this: $positions = array(0 => array(6.35,3.93), 1 => array(16.85,3.93), 2 => array(6.35,10.9

javascript - .load() is not working - jQuery -

i have code this: $('#message').load('conversation.php?link=projects/living room/room'); when run code, says "syntax error, unrecognised expression" in error console in chrome. but if run same code this: $('#message').load('conversation.php?link=projects/livingroom/room'); this work fine. differece between these 2 lines is, in first 1 there space in work (living room) , in second line there no space in word (livingroom). what happening here. why .load() displays error when put space , no error no space? if , @matt ball points out in comments above, $.load() has special interpretation url not need, recommend replacing $.load() better suits requirements. in case, $.get() includes proper callback more appropriate needs. in case, clear part of problem url including spaces. but part of url including spaces in data parameters, better consistency , reliability ought supplied parameters jquery functions instead of tr

c - Can't compare two CLLocationCoordinate2Ds (negative zero??) -

i'm having hardest time comparing 2 (what should identical) cllocationcoordinate2d structs in ios app. reason no matter how compare them, latitude won't it's equal. the code: double dlat = self.mapview.centercoordinate.latitude - self.centeronnextview.coordinate.latitude; double dlong = self.mapview.centercoordinate.longitude - self.centeronnextview.coordinate.longitude; nslog(@"dlat: %f dlong: %f, dlat == 0.0: %d, dlat == -0.0: %d, dlong == 0.0: %d, dlong == -0.0: %d", dlat, dlong, dlat == 0.0, dlat == -0.0, dlong == 0.0, dlong == -0.0); if ( ( dlat == 0.0 || dlat == -0.0 ) && ( dlong == 0.0 || dlong == -0.0 ) ) { nslog(@"we equal!"); } i tried if ( [@(dlat) isequaltonumber:@(0)] && [@(dlong) isequaltonumber:@(0)] ) comparison check, failed too. here's output: dlat: -0.000000 dlong: 0.000000 dlat == 0.0: 0 (false) dlat == -0.0: 0 (false) dlong == 0.0: 1 (true) dlong == -0.0: 1 (true) for reason keep getting

android - Switching between activities along with fragments -

i have functionality below. start activity -> in oncreate(), display fragment1 in activity 1, fragment1, using getactivity() method activity instance. activity1 //replace fragment replacelistfragment(new fragment1(), r.id.fragment_main_layout_container); here fragment1 code. public void onactivitycreated(bundle savedinstancestate) { super.onactivitycreated(savedinstancestate); activity = (activity1) getactivity(); } navigate activity b -> in oncreate(), display fragment2 activity2 //replace fragment replacelistfragment(new fragment2(), r.id.fragment_main_layout_container); here fragment2 code. public void onactivitycreated(bundle savedinstancestate) { super.onactivitycreated(savedinstancestate); activity = (activity2) getactivity(); } here button click code in fragment2 finish(); intent intent = new intent(activity, activity1.class); startactivity(intent); first nav

ios - Is it possible to switch view to tableview from same view? -

i have viewcontroller.xib contains view, buttons,toolbarbutton, text box , tableview. when load initial screen comes without table view fine. when click on toolbarbutton say, viewtable, want view move tableview. have filled tableview data default objects this: - (void)viewdidload { tabledata = [[nsarray alloc] initwithobjects:@"object1",@"object2",@"object3",@"object4", nil]; [super viewdidload]; } - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section { return [tabledata count]; } - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { uitableviewcell *cell = nil; cell = [tableview dequeuereusablecellwithidentifier:@"my cell"]; if(cell==nil) { cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:@"my cell"]; } cell.textlabel.text=[tabledata objectat

css selectors - How to select only some children in CSS? -

i have divs in html, dynamic number of divs how select divs 2,5,8,11 ? i tried :nth-child(2n+3) not need here's code: <!doctype html> <html> <head> <style> .a:nth-child(2n+3) { background:#ff0000; } </style> </head> <body> <p class="a">the first paragraph.</p> <p class="a">the second paragraph.</p> <p class="a">the third paragraph.</p> <p class="a">the fourth paragraph.</p> <p class="a">the fifth paragraph.</p> <p class="a">the sixth paragraph.</p> <p class="a">the seventh paragraph.</p> <p class="a">the 8 paragraph.</p> <p class="a">the ninth paragraph.</p> <p class="a">the seventh paragraph.</p> <p class="a">the 8 paragraph

android - SimpleCursorAdapter not returning position -

i searched stackoverflow similar questions. none of solutions seem work. this customadapter class. public class contactadapter extends simplecursoradapter { context cont; public contactadapter(context context, int layout, cursor c, string[] from, int[] to) { super(context, layout, c, from, to, 0); cont = context; } @override public view getview(final int position, view convertview, viewgroup parent) { view view = super.getview(position, convertview, parent); button button = (button)view.findviewbyid(r.id.delete_button); button.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { toast.maketext(cont, position, toast.length_short).show(); } }); return view; } } as per docs should position of current item in toast. throws following exceptions. 08-13 13:46:01.904: e/androidruntime(5980): android.content.res.resources$notfoundexception: string resource id

model view controller - Do I need Javascript MVC in Hybrid App? -

i developing application android using appframework + intel xdk (appmobi). application involves lot of javascript codes, reading on internet suggest use mvc approach (backbone js, intel mvc, etc). regarding performance, people know told me using mvc decrease application performance. so, can give me suggestion, should use mvc or keep traditional way? if mvc needed, mvcs framework performs better intel appframework (jqmobi)? thanks

sql - MySQL - which query will be faster -

i have database (mysql) contains information photos, ratings (people can vote) , comments. create table if not exists `photos` ( `id` int not null auto_increment, `description` nvarchar(2000), `author` int, `contest` int, `phonemodel` nvarchar(200), `photothumbpath` nvarchar(2000), `photopath` nvarchar(2000), `date` timestamp default current_timestamp, `state` int default 1, foreign key (`author`) references `users`(`id`), foreign key (`contest`) references `contests`(`id`), primary key (`id`) ) engine=myisam default charset=utf8 auto_increment=1 ; create table if not exists `photocomments` ( `id` int not null auto_increment, `author` int, `photo` int, `comment` nvarchar(2000), `date` timestamp default current_timestamp, `replyto` int, foreign key (`author`) references `users`(`id`), foreign key (`photo`) references `contests`(`id`), foreign key (`replyto`) references `photocomments`(`id`), primary key (`id`) ) engine=myisam def

iphone - Xcode Get image url from rss feed -

newbie xcode , thrilled answer question. trying image url tag rss feed , add custom table view cell. other text fine. this rss row: <item> <title>this title</title> <description>this description</description> <link>http://www.something.com</link> <pubdate>fri, 09 aug 2013</pubdate> <enclosure type="image/jpg" url="http://www.thisistheurliwant.com" /> </item> this part of code without image logic: - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { customcellnews *cell = [tableview dequeuereusablecellwithidentifier:@"cell" forindexpath:indexpath]; cell.titlelabel.text = [[feeds objectatindex:indexpath.row] objectforkey: @"title"]; cell.descriptionlabel.text = [[feeds objectatindex:indexpath.row] objectforkey: @"description"]; //set cell image here return cell; } - (void)parser:(nsxmlparser *)parser dids

asp.net mvc 3 - Can we cache images, css and java script in MVC3 through Output Cache? -

can cache images, css , javascript of specific view (not partial view) in mvc3 through outputcache attribute. want cache home controller view.i tried contents cached not images , css. instead of output cache attribute can use following methods have caching of static resources: 1.using max-age. put below section in web.config in <configuration> -> <system.webserver> section <staticcontent> <!-- tell client cache static files year --> <clientcache cachecontrolmode="usemaxage" cachecontrolmaxage="365.00:00:00" /> </staticcontent> 2.using url versioning. can done bundling. if using mvc3 @ combres on nuget . in mvc4 or above build-in option: bundling , minification

python - Internal Server error. Flask -

i running script while , seems give me error. @app.route('/') def hello(): return ''' <form method="post" action="/people"> <font size = "4">i looking for?</font><br> <font size = 2>please enter atleast 2 words. </font><br><br> <input name="search" type="text" width=1000px> <br> <input type="submit" value="people search"/> <br> </form> <form method="post" action="/science"> <input name="search" type="text" width=1000px> <input type="submit" value="science search"/> </form>'''

javascript - store newline character with string in a variable -

i have stored string in xml ... reading in ariabel , printing below code $("#"+obj.id +" .fronttext").html("<h2>"+ftitle[origimg]+"</h2>"+"<br/>"+backtext[origimg]); i want print newline in backtext . how thid tried \n, bute not working. code:: <backtxt>harbourfront tower 1 18-storey office buillding houses many blue-chip multinational corporations. developed part of harbourfront precinct rejuvenation project meet growing demand of businesses relocating fringe of cbd. development located near supporting amenities , public transport. </backtxt> i want print : harbourfront tower 1 18-storey office buillding houses many blue-chip multinational corporations. developed part of harbourfront precinct rejuvenation project meet growing demand of businesses relocating fringe of cbd. development located near supporting amenities , public transpo

jquery - Putting 2 images in option of drop-down -

this question has answer here: adding images option tag [duplicate] 1 answer i trying put 2 images in option-tag of dropdown-box. 1 image works background-image porperty. tried following code not working. best way this? <select> <option> <img src="fist.jpg" height="10" width="10"/> <img src="second.jpg" height="10" width="10"/> </option> </select> you can't put images in option tag. depending on you're trying do, can use multiple background images in css3. background-image: url(first.jpg), url(second.jpg);

jasper reports - Is there a parameter that can be passed through URL so that Input control screen doesn't load ? (JasperReports) -

the short version: im looking varuble can pass along hyperling input control screen isn't loaded (something ...&loadinputcontrol=false ) the long version: i have drill down report (lets reportone) input controls need populated when report run 1st time input control screen appears , after user enters , runs report, user can drill down drill down report (let reporttwo) once in drill down report (reporttwo) user can click link wich takes user 1st report (reportone) what happening 1st report (reportone) input control loaded parameters sent drill down report (reporttwo) but want report automatically run when called drill down report (reporttwo) a.k.a skip input control screen extra: i'm using ireport 5.0.0 i'm using hyperlinks drill down/up report if disable "always prompt" option input controls user won't see input controll screen 1st time report run simplest solution have been doing in reports,just create separate folder do

Image on popup window in google maps v3 api? -

Image
how can put image on popup window when click on marker (bondi beach) in google maps v3 ? : here code : var locations = [ // here put image ['bondi beach', -33.890542, 151.274856, 4], ]; var map = new google.maps.map(document.getelementbyid('map'), { zoom: 7, center: new google.maps.latlng(46.713251, 7.833252), maptypeid: google.maps.maptypeid.roadmap, }); map.setoptions({styles: styles}); var infowindow = new google.maps.infowindow(); var marker, i; (i = 0; < locations.length; i++) { marker = new google.maps.marker({ position: new google.maps.latlng(locations[i][1], locations[i][2]), map: map }); google.maps.event.addlistener(marker, 'click', (function(marker, i) { return function() { infowindow.setcontent(locations[i][0]); infowindow.open(map, marker); } })(marker, i)); } try : <div id="map" style="width:500px;height:500px;"></div> script : var locations =

sql - Slow Query when Joined View contains PIVOT -

i have following view containing pivot: create view [vwphonenumberbypref] select * from( select objectkey, objecttypename,r_id,maskednumber ( select * ,row_number() on (partition objectkey, objecttypename order preference) r_id vwphonenumbermasked ) r_id<=3 )as p pivot( max(maskednumber) r_id in ([1],[2],[3]) )as pvt which when run using where objectkey = 1234 returns result instantly. when use query in join though: select * tblperson p inner join vwphonenumberbypref ph on p.personid = ph.objectkey it takes 10 seconds , in execution plan, doing sort on over 200,000 rows. when not used in join, doing "sort" on single row. tried doing join using cross apply makes marginally faster, still takes long , still sorting 200,000 odd rows. how can improve performance? additional info: create view [vwphonenumbermasked] select ph.objecttypename, ph.objectkey, dbo.applymask(ph.phonenumber, pt.mask), ph.preference tblphonenumbe

linux - Java execute a application in specific session -

i invoking application on windows xp, 7 machines remote linux using winexe. not able execute application in foreground executes in background. tried psexec no success. can me? you have run application under same user loged on on windows-machine , use start @ beginning of cmd command.

android - EditText to Integer -

i want parse edittext value integer without using string. possible? like: integer s1=edt1.gettext().toint(); integer s1=integer.parseint(edt1.gettext(); i think have use tostring() before can convert integer . gettext() returns , editable - can tell - not valid argument of integer conversion methods. int woohoo = integer.parseint(edittext.gettext().tostring()); you don't need create intermediate string if that's you're asking. can pass results of methods used input parseint() method.

list - Sort links with javascript? -

i'd sort list links alphabetical code: !doctype html> <html> <head> <title>sort list items alphabetically javascript</title> <script type="text/javascript"> function sortunorderedlist(ul, sortdescending) { if(typeof ul == "string") ul = document.getelementbyid(ul); var lis = ul.getelementsbytagname("li"); var vals = []; for(var = 0, l = lis.length; < l; i++) vals.push(lis[i].innerhtml); vals.sort(); if(sortdescending) vals.reverse(); for(var = 0, l = lis.length; < l; i++) lis[i].innerhtml = vals[i]; } window.onload = function() { var desc = false; document.getelementbyid("test").onclick = function() { sortunorderedlist("list", desc); desc = !desc; return false; } } </script> </head> <body> <div id="test"&

wolfram mathematica - Local variable and Block usage -

i wrote code executes function receives (future) client, in loop parameters. call func(name it). inside function client generate expression in same variables(by getuncertainty - each variable must cleared before use). , simple idea use block. later , code executed handles di , outside function.so, di , must globals(there more, flexible). btw, know not efficient, efficiency not issue. func[v_, a_, r_] := (v = v; = a; r = r; block[{v, a, r},i = v + 10 + r 100; di = getuncertainty[i, {v, a, r}];] ; print[di]) the problem client must reset vars hand. means function parameters can't v_,a_,r_ , otherwise vars in block replace values. didn't manage overcome in other way. another question in similar issue. if have vars = {v,a,r,dr} , block[vars , ..code.. ] , throws error not list.whereas block[ {v,a,r,dr},..code..] works. how overcome this? thanks. its hard unravel trying do, best approach may never assign values symbols need used pure symbols in context

sql server - Couldn't send and store String data to database through WCF -

i have created windows 8 app, have table in sql server database store people's name, " [name] varchar (50)" i have manage send , save integer values database, when modified coding store string, not work, table data empty. please help! itemdetail.html <div> <input id="join1" type="text" /> <button id="joinbtn">insert</button> </div> itemdetail.js var joinbutton = document.getelementbyid('joinbtn'); // register click event joinbutton.addeventlistener("click", joinbuttonclick, false); function joinbuttonclick() { // retrieve element var baseuri2 = "http://localhost:45573/addservice.svc/join"; var jointext = document.getelementbyid('join1').value; winjs.xhr({ type: "post", url: baseuri2, headers: { "content-type": "applicat

matlab - how to covert 1/4 elements of a matrix to zero -

i have 512x512 matrix .i want convert 1/4 elements of matrix 0/how can can help.my program folows clc; clear all; close all; a=imread('images.jpg'); b=rgb2gray(a); figure,imshow(b); c=double(b); figure,imshow(a); figure,imshow(c); d=rand(512,512); e=exp(2*pi*d); f=c.*e; %figure,imshow(f); g=fft2(f); h=rand(512,512); i=exp(2*pi*h); j=g.*i; k=fft2(j) %here k matrix of order 512x512.in next step want chanage 1/4 elements ero can help if want points chosen randomly: if have 512 x 512 array: v=randperm(512^2); v=v(1:512*128); k(v)=0; the above can abbreviated in recent matlab versions k(randperm(512^2,512*64))=0; edit more generally, image array "k" (case size(k) nc x nr) ns = numel(k); v=randperm(ns); v=v(1:round(ns/4)); k(v) = 0; or in recent version of matlab ns = numel(k); k(randperm(ns,round(ns/4)))=0; (case size(k) nc x nr x 3) ns = numel(k)/3; v=randperm(ns); v=v(1:round(ns/4)); k(v)=0; k(v+ns)=0; k(v+ns*2)=0;

asp.net - OnClick Event for Button in GridView is not working -

here datagridview <asp:gridview id="gvpredstave" runat="server" cssclass="gridview" alternatingrowstyle-cssclass="even" autogeneratecolumns="true"> <columns> <asp:templatefield> <itemtemplate> <asp:button id="btnrezervisi" runat="server" text="rezervisi" onclick="button1_click" /> </itemtemplate> </asp:templatefield> </columns> </asp:gridview> this code click on button in gridview protected void button1_click(object sender, eventargs e) { response.redirect("aktivnerezervacije.aspx?korisnicko_ime=" + korisnicko_ime); conn.close(); } when click on button got error in browser: invalid postback or callback argument. event validation enabled using <pages enableeventvalidation="true"/&g

datetime - SonataIntlBundle. Invalid type for path "sonata_intl.timezone". Expected scalar, but got array -

i've installed sonataintlbundle symfony 2.0 (i can't use > 2.0 version constraint of server). in config.yml: sonata_intl: timezone: default: europe/madrid but exception: invalidtypeexception: invalid type path "sonata_intl.timezone". expected scalar, got array. when change configuration in config.yml this: sonata_intl: timezone: europe/madrid it works nothing happens , dates still shown in english not in spanish want. someone knows how can configured bundle symfony 2.0 , works or way dates in list in sonataadminbundle in spanish? thanks the 2.0 branch not supported sensio , sonata project ... i don't why cannot install symfony2.3 on server ?

javascript - Play a mp3 file from a selected list form -

i need select mp3 or wave file pull down menu play, pause, stop , change volume. got started code w3cl plays first selection (normal) not play (ar or ps) need add volume control enter code here <audio id="mytune"> <source src="normal.mp3"> <source src="ar.mp3"> <source src="ps.mp3"> </audio> <button onclick="document.getelementbyid('mytune').play()">play music</button> <button onclick="document.getelementbyid('mytune').pause()">pause music</button> <button onclick="document.getelementbyid('mytune').pause(); document.getelementbyid('mytune').currenttime = 0;">stop music</button> select name="mytune" onchange='mytune(this.value);'> <option value="normal.mp3" selected> normal <option value="ar.mp3">

asp.net - dynamic url where text box data changes url -

here have. sharepoint page has textbox , search button. textbox data tied of tables , fills them in according company code typed textbox. i'm trying add url take user out new page see sharepoint list filtered on company code entered in original textbox. so far can make url go whatever company choose hardcoding url this: http://mysite/lists/call%20log/company%20by%20category.aspx?view={7c16bc72-8f1a-457a-9908-af9e66de97dc}&filterfield1=linktitle&filtervalue1=abccompany for whatever reason unable or can't figure out how set filtervalue1 = <<text textbox>> . here sample of code: <webpartpages:spproxywebpartmanager runat="server" id="proxywebpartmanager"> </webpartpages:spproxywebpartmanager> enter co id , click &quot;search&quot;&nbsp; <asp:textbox runat="server" id="tb_coid" width="83px"></asp:textbox> &nbsp; <asp:button runat="server" text=&q

PHP Object Constructor database connection -

i starting in oop using mysqli , came problem. this code: class database{ public $mysqli; public function __construct($db_host, $db_user, $db_password, $db_name){ $this->con = new mysqli($db_host, $db_user, $db_password, $db_name); } } the code above working. when need instantiate class, need declare hostname, username , database name in main page not secure , vulnerable ( guess ). $db = new database("hostofdatabase", "dbroot", "", "databaseofmine"); i want ask if right way of putting database connection in class constructor. didn't understand other solutions found in forum though. hope enlighten me bit. cheers! i'll try elaborate on other solutions found on forum, since said didn't understand them. remember (assuming webserver configured), php source code not accessible externally (i.e., not accessible visitors). there isn't intrinsically wrong storing credentials in source code. main pr

text to speech - Android tts flush -

please don't advise use tts.stop() flush text tts queue. i want ask suppose if have hashmap<string, string> params = new hashmap<string, string>(); params.put(texttospeech.engine.key_param_utterance_id,"tag2"); tts.speak("hi",texttospeech.queue_add,params); tts.speak("hello",texttospeech.queue_add,params); and there bunch of other sentences added queue. my question action if tts.speak("flushing",texttospeech.queue_flush,null); done or tts.speak("flushing",texttospeech.queue_flush,params); done where params same earlier one is action different in both cases, i.e sentences flushed when params parameter or utterance id same them? thanks! there no difference, application queue flushed. hashmap param pass info speech engine. in case, if passing null onutterancecompleted not called. see document http://developer.android.com/reference/android/speech/tts/texttospeech.html#queue_flush

Get type of generic parameter -

i wrote small function better handling types. function evaluate(variable: any, type: string): { switch (type) { case 'string': return string(variable); case 'number': return isnumber(variable) ? number(variable) : -1; case 'boolean': { if (typeof variable === 'boolean') return variable; if (typeof variable === 'string') return (<string>variable).tolowercase() === 'true'; if (typeof variable === 'number') return variable !== 0; return false; } default: return null; } } function isnumber(n: any): boolean { return !isnan(parsefloat(n)) && isfinite(n); } i try same generics, don't know how type generic parameter. it´s possible? typeof javascript operator. can used @ run time types javascript knows about. generics typescript concept helps check