Posts

Showing posts from August, 2015

asp.net mvc - RazorPDF save pdf file to server directory in MVC4 -

i assembling , displaying pdf using razorpdf in mvc4 , save pdf file file system @ same time return view. the following line of code in controller action calling view: return new pdfresult(claims, "pdf"); i able write pdf directory system changing code base of razorpdf render method. rendor method creates pdfwriter object associated response stream: // associate output response stream var pdfwriter = pdfwriter.getinstance(document, viewcontext.httpcontext.response.outputstream); pdfwriter.closestream = false; the solution create pdfwriter object associated filestream object illustrated below: // create pdf file in directory system var filestream = new filestream(mypdffilepath, filemode.create); var pdfwriter2 = pdfwriter.getinstance(document, filestream); i closed objects: filestream.close(); pdfwriter.close(); pdfwriter2.close(); i had incorporate pdfresult , pdfview classe...

javascript - How to put div under content when resize window? -

lets have simple html (+css) page header, 2 divs below (left , right) , footer below them. want make right div go under left 1 when resize window. have 2 examples of effect: example #1 - simple example it's 100% thinking of , here another, more complicated too: example #2 how effect called? need javascript make it? this effect called responsive web design uses media queries target specific device sizes. you can learn more how use , work media queries watching these intro videos: https://www.youtube.com/watch?v=tpmb7xhclo0 https://www.youtube.com/watch?v=f_fhyxuh_to also, here great article can save lot of time , frustration: http://css-tricks.com/snippets/css/media-queries-for-standard-devices/

Assign "selected" to radio label with jquery -

i have group of radio inputs associated labels. there css magic pretty buttons, , works fine. need able change selected attribute of label. <input type='radio' id='radio1' name='resolution' value='0' selected /> <input type='radio' id='radio2' name='resolution' value='1' /> <label for='radio1' class='cb-enable selected' ><span>open</span></label> <label for='radio2' class='cb-disable ' ><span>closed</span></label> how go setting label selector jquery? $("input:radio[name='resolution']").change(function(){ $("label").removeclass("selected"); $("label[for='" + this.id + "']").toggleclass("selected", this.checked); }); http://jsfiddle.net/qkl5t/

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

this svg contains rect overflows svg element: <svg id='svg' width='10' height='10'> <rect x='-10' y='-10' width='30' height='30'/> </svg> chrome 28 , opera 12 return getboundingclientrect() svg element width , height of 10. firefox 23 reports width , height of 30. correct? jsfiddle the relevant spec cssom , delegates svg spec if svg element not "have associated css layout box". haven't found definition of "having associated css layout box", correct result seem hinge on definition, getbbox returns 30x30 rect in browsers. this firefox bug fixed now, fix in firefox nightlies , should make through firefox 33 released on 14 october 2014. see bug 530985 details.

Creating audio file in internal memory in Android -

i want audio file created during audio capture stored in internal memory , played there. getting media player prepare failed() when trying here's example of how using mediarecorder . first add correct permissions (you need add more if choose use external storage). <uses-permission android:name="android.permission.record_audio" /> this records audio in internal storage: mediarecorder recorder = new mediarecorder(); recorder.setaudiosource(mediarecorder.audiosource.mic); recorder.setoutputformat(mediarecorder.outputformat.mpeg_4); recorder.setaudioencoder(mediarecorder.audioencoder.amr_nb); recorder.setoutputfile(getfilesdir()+"/audio.m4a"); recorder.prepare(); recorder.start(); ... recorder.stop(); recorder.reset(); recorder.release() this plays audio internal storage: mediaplayer mediaplayer = new mediaplayer(); mediaplayer.setdatasource(getfilesdir()+"/audio.m4a"); mediaplayer.prepare(); mediaplayer.start(); getfilesdir...

java - How to access other elements in click listeners in libgdx -

how modify lable info's text calling settext method? for e.g. depending in button pressed want set label's text appropriately i error when try accessing label : cannot refer non-final variable inside inner class defined in different method skin skin = new skin(gdx.files.internal("uiskin.json")); stage = new stage(); gdx.input.setinputprocessor(stage); table = new table(); table.setfillparent(true); stage.addactor(table); string sentence = "one 2 3 4 5 6 7 eight"; string[] temp = sentence.split(" "); arraylist<string> words = new arraylist<string>(arrays.aslist(temp)); info = new label( "welcome android!", skin ); for(int i=0; i<words.size();i++) { textbutton button = new textbutton( words.get(i), skin); table.add(button); button.addlistener(new clicklistener() { ...

javascript - iFrame Security Risks from Embedding by Hacker -

within app ( http://www.example.com ) running iframe ( https://www.example.com/iframe-application ). the main page (www.example.com) renders custom data based on cookies set iframe. iframe has smarts, javascript, secure cookies, etc. iframe has no text, images, etc. javascript code. is there risk embed iframe in site , access secure cookies, login tokens, etc? by default cookies bound domain name, in normal case should not possible. if got xss vuln. on site, access cookies, rather sure escape inputstrings.

Perl script not running from ksh file -

i'm trying run bit of perl inside ksh file , not getting expect it. rather getting sort of error if doing syntactically incorrect, finishes running , creates lots of .bak files has not prepended $data onto every line of file have expected. what i've got far ( contains function declared earlier in file part works fine): if [[ $# != 3 ]];then echo "please specify 1 folder containing data files 1 , 1 system id." else file in `ls $1`;do filepath=$1$file filename=`echo $filepath | awk -f'/' '{print$5}'` contains $filename "accums" && ( contains $filename ".bak" || ( echo "loading file: "$filename date=echo $filename | awk -f'_' '{print$5}' | sed 's/.txt//' data=$filename"|"$2"|"$3"|"$date"|" echo $data echo /usr/l...

javascript - Can you work out why my .js file doesn't seem to be linking to my html? -

here's jsfiddle of site (very premature), seems work fine on there, i'm not getting results @ locally, either in preview window in komodo or when open in safari. here links js file, jquery , jquery ui i'm using: <script type="text/javascript" src="js/scripts.js"</script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"</script> <script type="text/javascript" src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"</script> i know links work because link directly file or website when click on in komodo. what's going wrong me? i've made other working sites 1 isn't going me. help? also, if shed light on jquery question eternally great full : attempting use jquery change img src of draggable object when dropped put ' > ' in front of ' </script> '

ajax - Motivation behind AngularJs's data-ng-include - poor UX -

in angularjs can this: <header data-ng-include="views/header.html"></header> which afaik asynchronously downloads views/header.html client , interprets template. i want ask if there sane motivation use because encountered pretty bad usex experience. have black twitter bootstrap header , causes header show moment later , therefore "hits" user right in eyes once other content visible. on top of request every time eventhough 304. you can use ng-include separate html re-used, can bind data-ng-include variable on scope , change view similar ng-view , using $routeprovider configuration. i'm not entirely sure attempted reload , seeing not modified response. assume ng-include operate under same caching rules normal page perhaps different since ajax request assume.

dom - Compiling dynamic HTML strings from database -

the situation nested within our angular app directive called page, backed controller, contains div ng-bind-html-unsafe attribute. assigned $scope var called 'pagecontent'. var gets assigned dynamically generated html database. when user flips next page, called db made, , pagecontent var set new html, gets rendered onscreen through ng-bind-html-unsafe. here's code: page directive angular.module('myapp.directives') .directive('mypage', function ($compile) { return { templateurl: 'page.html', restrict: 'e', compile: function compile(element, attrs, transclude) { // nothing return { pre: function prelink(scope, element, attrs, controller) { // nothing }, post: function postlink(scope, element, attrs, controller) { // nothing } ...

Using R to select data based on another dataset -

i have large datasets (d1)like below: snp position chromosome rs1 10010 1 rs2 10020 1 rs3 10030 1 rs4 10040 1 rs5 10010 2 rs6 10020 2 rs7 10030 2 rs8 10040 2 rs9 10010 3 rs10 10020 3 rs11 10030 3 rs12 10040 3 i have dataset(d2) below: snp position chromosome rsa 10015 1 rsb 10035 3 now, want select range of snps in d1 based on d2(position+-5 , same chromosome), , write results txt file, results should this: snp(d2) snp(d1) position(d1) chromosome rsa rs2 10020 1 rsa rs3 10030 1 rsb rs11 10030 3 rsb rs12 10040 3 i new in r, can please tell me how in r? kind of reply highly appreciated. d2$low <- d2$position-5 ; d2$high<- d2$position+5 you might think somehting : d2$matched <- which(d1$position >=d2$low & d2$high >= d1$position) .... not really, need bit more involved.: d1$matched <- apply(d1, 1, function(p) which(p['position'] >=d2[,'lo...

sql - ReCursive/While Loop -

i trying build view looks @ table has 3 columns; building, lane, lot. need able loop through table dynamically display building, lane , lot on 1 row. sample: >building lane lot > 1 1001 56789 > 1 1002 12489 > 1 1002 37159 > 1 1002 71648 > 3 3001 27489 > 3 3001 67154 > 3 3002 47135 > 3 3003 84271 > 3 3003 96472 > 3 3003 94276 results > building lane lots > 1 1001 56789 > 1 1002 12489, 37159, 71648 > 3 3001 27489, 67154 > 3 3002 47135 > 3 3003 84271, 96472, 94276 i tried recursion union received message had exceded max amount of 100. tried loop kept going , did not concantenate had hoped. far in table there on 300 lot numbers 1 building in 1 lane potential of huders more. it looks you're looking ...

linker - gcc for ARM - move code and stack -

i working on project arm cortex-m3 (silabs) soc. need move interrupt vector [edit] , code away bottom of flash make room "boot loader". boot loader starts @ address 0 come when core comes out of reset. function validate main image, loaded @ higher address , possibly replace main image new one. therefore, boot loader have vector table @ 0, followed code. @ higher, fixed address, 8kb, main image, starting vector table. i have found this page describes vector table offset register boot loader can use (with interrupts masked, obviously) point hardware new vector table. my question how "main" image linked work when written flash, starting not @ zero. i'm not familiar arm assembly assume code not position independent. i'm using silabs's precision32 ide uses gcc toolchain. i've found how add linker flags. question gcc flag(s) provide change base of vector table , code. thank you. vectors.s .cpu cortex-m3 .thumb .word 0x20008000 ...

sorting - how to sort mapper output key with multi-fields? -

i want sort mapper output records first 2 fields before feeding them reducer , , here how did it: hadoop streaming \-d mapred.job.name="multi_field_key_sort"\ -d mapred.job.map.capacity=100\ -d mapred.reduce.tasks=1\ -d stream.num.map.output.key.fields=2\ -d mapred.output.key.comparator.class=org.apache.hadoop.mapred.lib.keyfieldbasedcomparator\ -d mapred.text.key.comparator.options="-k1,2n"\ -input "..."\ -output "..."\ -mapper "..."\ -reducer "cat"\ but final results not sorted first 2 fields, sorted 1st fields, why? wrong hadoop job conf?

Android about set Image on the List -

i have little trouble android. have data in database(phpadmin) , data type varchar(20). content of data "r.drawable.imagename". how should data database? , if data,how should put data array(the type of array integer). because want set image on list. graph: (database)────>(get data)────>(put list) tks ur help. p.s. sorry english not well.except u can understand want ask. since mentioned "phpadmin" ( phpmyadmin ?), i'm assuming you're using mysql database on server somewhere instead of local sqlite database on android device (which recommend). as far know, mysql support in android sdk limited or non-existent, have create small php/perl/... wrapper around mysql database , have return data json or xml consumed android application. as loading resources, suggest store drawable identifier image_name opposed r.drawable.image_name . way, can following id of needed resource , store in array of integers: int resource_id = getresources().getid...

ios - Update uipopover height when cell is added -

i have table view (without scrolling) inside uipopovercontroller has 4 cells. , needs have cell (1 max). if animating adding , subtracting of cell, can update popover's height well? here how create popover table view: - (void)createpopovertable { //set array _arraylist = [nsmutablearray arraywithobjects:@"one", @"two", @"three", @"four", nil]; //make row selections persist. self.clearsselectiononviewwillappear = no; //view height nsinteger rowscount = [_arraylist count]; nsinteger singlerowheight = [self.tableview.delegate tableview:self.tableview heightforrowatindexpath:[nsindexpath indexpathforrow:0 insection:0]]; nsinteger totalrowsheight = (rowscount * singlerowheight) + 20; //view width cgfloat largestlabelwidth = 0; (nsstring *item in _arraylist) { //check size of font using default label cgsize labelsize = [item sizewithfont:[uifont boldsystemfontofsize:20.0f]]...

java - How to compile servlet on remote server? -

i want upload servlet file on remote apache tomcat server , want compile it. wanted know under directory should keep file , how compile it? should use putty? relatively new servlets. here servlet code: import java.sql.connection; import java.sql.preparedstatement; import java.sql.drivermanager; import java.sql.resultset; import javax.servlet.annotation.webservlet; import javax.servlet.http.*; @webservlet(name= "db-connect", urlpatterns="/db-connect") public class dbconnect extends httpservlet{ private connection con = null; private preparedstatement preparedstatement = null; protected void doget(httpservletrequest request, httpservletresponse response) { try { class.forname("com.mysql.jdbc.driver"); con = drivermanager.getconnection("jdbc:mysql://http://localhost:3307/abc?autoreconnect=true"); preparedstatement = con.preparestatement("select * person"); resultset rs = preparedstatemen...

An sample application on calling the webservices from android, which is returnig the error, "Unfortunately,MyTest has stopped". -

Image
i have code, makes call web service provided www,tempuri.org. while trying run application, application stopping unexpectedly , showing message - "unfortunately, mytest has stopped".. here java file - mainactivity.java :- package com.example.mytest; import org.ksoap2.soapenvelope; import org.ksoap2.serialization.soapobject; import org.ksoap2.serialization.soapprimitive; import org.ksoap2.serialization.soapserializationenvelope; import org.ksoap2.transport.httptransportse; import android.os.bundle; import android.app.activity; import android.view.menu; import android.widget.textview; public class mainactivity extends activity { public static final string soap_action = "http://tempuri.org/celciustofarenheit"; public static final string method_name = "celciustofarenheit"; public static final string namespace= "http://tempuri.org/"; public static final string url = "http://www.w3schools.com/webservices/tempconvert.a...

Android - SQLite could not read row 0, col -1 error -

i have application populates 11 database tables , fetches data , displays in logcat. application used work until changed primary key autoincrement. change worked fine tables 1 table gave me problem. here dbadapter, , part generate user database (the 1 that's giving me problem): //variables user table public static final string table_user = "user"; public static final string user_id = "_id"; public static final string username = "username"; public static final string password = "password"; public static final string l_name = "l_name"; public static final string m_name = "m_name"; public static final string f_name = "f_name"; public static final string office = "office"; public static final string cellphonenumber = "cellphone_number"; public static final string landline = "landline"; public static final string address = "address"; public static final string email = ...

Boost graph library breadth first search yielding incorrect predecessor map -

running breadth-first search on unweighted, directed graph on 2 vertices each vertex connected other yields predecessor map source of breadth-first search not own predecessor. following program sufficient produce behavior: #include <vector> #include <boost/graph/adjacency_list.hpp> #include <boost/graph/breadth_first_search.hpp> using namespace boost; using std::vector; enum family { one, two, n }; typedef adjacency_list< vecs, vecs, directeds> graph; typedef graph_traits<graph>::vertex_descriptor vertex; int main() { graph g(n); const char *name[] = { "one", "two" }; add_edge(one, two, g); add_edge(two, one, g); vector<vertex> p(num_vertices(g)); breadth_first_search(g, two, visitor(make_bfs_visitor( record_predecessors(&p[0], on_tree_edge())))); //at point, p[0] == 1 , p[1] == 0 return 0; } this seems contradict boost graph l...

angularjs - jQuery Sparkline in a cell in ng-grid using CellTemplate and Directive -

i trying bring jquery sparkline @ each row in 1 cell in ng-grid. column contains numeric array data. plunkr --> http://plnkr.co/edit/1enecx6fqwcjynlvyvfw?p=preview i using directive cell template achieve this. cell template: directive: app.directive('ngage', function() { return{ restrict: 'c', replace: true, translude: true, scope: {ngagedata: '@'}, template: '<div>' + '<div class="sparklines"></div>' + '</div>', link: function(scope,element,attrs){ // var arrvalue= "3386.24000,1107.04000,3418.80000,3353.68000,4232.80000,3874.64000,3483.92000,2735.04000,2474.56000,3288.56000,4395.60000,1107.04000"; //console.log(attrs.ngagedata); var arrvalue = attrs.ngagedata; var myvalues = new array(); myvalues = arrvalue.split(","); $('.sparklines').sparkline(myvalues); } } })...

Import .csv file into cassandra -

i want import csv file cassandra. when write command on cassandra cqlsh, got error: command is: copy table ( id, name) 'table.csv' header = true; and error: can't open 'table.csv' reading: [errno 2] no such file or directory: 'table.csv' can 1 tell me mean? thanks. table.csv file should in cassandra installation directory(where run cqlsh). file name case senstive, check orginal file name case.

How to debug "exit status 1" error when running exec.Command in Golang -

when run code below: cmd := exec.command("find", "/", "-maxdepth", "1", "-exec", "wc", "-c", "{}", "\\") var out bytes.buffer cmd.stdout = &out err := cmd.run() if err != nil { fmt.println(err) return } fmt.println("result: " + out.string()) i getting error: exit status 1 however not helpful debug exact cause of error. how more detailed information? the solution use stderr property of command object. can done this: cmd := exec.command("find", "/", "-maxdepth", "1", "-exec", "wc", "-c", "{}", "\\") var out bytes.buffer var stderr bytes.buffer cmd.stdout = &out cmd.stderr = &stderr err := cmd.run() if err != nil { fmt.println(fmt.sprint(err) + ": " + stderr.string()) return } fmt.println("result: " + out.string()) running ...

Php, session.save_path -

i wanted ask session.save_path php.ini file ( http://php.net/session.save-path ), question session saved if not setting path( ;session.save_path = ), is on pc memory? , is on files located outside php directory? ,so far see session.save_path set , can view files, , when session.save_path unset( http://php.net/session.save-path ), don't know files if there any, if can me thankful, thank , have nice day. phpinfo() friend here, in output you'll find original (left column) , overridden (right column) session.save_path .

How to initialize an array of vector<int> in C++ with predefined counts? -

excuse me, i'm new in stl in c++. how can initialize array of 10 vector pointer each of points vector of 5 int elements. my code snippet follows: vector<int>* neighbors = new vector<int>(5)[10]; // error thanks this creates vector containing 10 vector<int> , each 1 of 5 elements: std::vector<std::vector<int>> v(10, std::vector<int>(5)); note if size of outer container fixed, might want use std::array instead. note initialization more verbose: std::array<std::vector<int>, 10> v{{std::vector<int>(5), std::vector<int>(5), std::vector<int>(5), std::vector<int>(5), std::vector<int>(5), std::vector<int>(5), std::vector<int>(5), ...

c - MikroC, Drawing line graph -

i'm trying create function draw line graph within specific window on glcd screen. lets window's x-axle runs pixel 24 through 205 (left right) , y-axle runs pixel 55 through 5 (low high). i'll need graph add new value (or dot) whenever new data available. can call graph refreshing within data collection routine. thats no problem. the latest value needs added right position on graph, 205. need clear line , draw new value/dot. no problem. t6963c_line(205, 5, 205, 55, t6963c_black); //clearing whole line t6963c_dot(205, posy, t6963c_white); //drawing new dot but i'm not sure is, how shift previous values/dots 1 place left on refreshing (each time new value/dot added on x-position 205), until reaches border of window, 22. any appriciated! addition: int posy1[181]; int i1; for(i1 = 0; i1 < 181 - 1; i1++) { t6963c_dot(i1 + 24, posy1[i1], t6963c_black); //erase old dots } for(i1 = 0; i1 < 181 - 1; i1++) { posy1[i1] = posy1[i1 + ...

Convert java data object to service object -

when writing service tend have separation between data object(orm) , service object(one marshalled json/xml etc.) , end writing converter takes data object(s) input , produces service object(s). converter nothing gets data data object using getters , sets of them service object. i hope people able relate process. want know if jdk has optimize scenario. i thinking more in terms of optimized array copy jvm @ system level. what call "data object" called "entity". call "service object" called "data transfer object" ("dto"). those 2 java objects other java objects, , jvm doesn't have specific thing optimize transformation of entities dtos. this process extremely fast anyway compared cost of executing sql query , entities, , serializing dtos send them on network. if have optimize, it's not transformation of entities dtos.

Facebook FQL query friends of friends events doesn't work anymore? -

for reason following doesn't work anymore. query hangs , doesn't return anything. ideas? have shutdown particular query? select name, venue, location, start_time, eid event eid in ( select eid event_member (uid in (select uid2 friend uid1 = me()) or uid = me()) ) , start_time > now() facebook made changes in api , may affect request. to check this, go to: facebook > apps > app > settings > advanced. there "migration" panel parameters: events timezone: enables real timezone support events. after migration, event times returned iso-8601 formatted strings, in fql. october 2013 breaking changes: the quarterly platform changes in effect on october 2, 2013. you can check will done in october breaking change, problem should due "events timezone" because using datetimes events in fql query. try disable new api feature (check disable , save settings).

python - DuckDuckGo search returns 'List Index out of range' -

here duck duck go search script. import duckduckgo r = duckduckgo.query('duckduckgo') print r.results[0].url it returns; list index out of range. if print r.results get; [<duckduckgo.result object @ 0x0000000002e98f60>] but if search other 'duckduckgo'. returns empty value [] i havefollowed did in example code. https://github.com/mikejs/python-duckduckgo that documented behaviour . there different result attributes. your first query returns list of results. r = duckduckgo.query('duckduckgo') if r.type == 'answer': print r.results # [<duckduckgo.result object>] your other search returns disambiguation , results in r.related not in r.results r = duckduckgo.query('python') if r.type == 'disambiguation': print r.related # [<duckduckgo.result object>] edit : python-duckduckgo uses duckduckgo api not give search result links our instant answer api gives free access many ...

c++ - floating point representation in memory is just not clear for me -

my task get fraction of float store in int. seemed easy. did test: float f = 3.1415f; printf("int pres. of float: %d\n" "int: %d", *((int *)&f), 31415); output: int pres. of float: 1078529622 int: 31415 i changed them base 2 see 31415 present. 0100 0000 0100 1001 0000 1110 0101 0110 - 3.1415 0111 1010 1011 0111 - 31415 i don't know do. how fraction simple integer? if take 2.5, instead of 3.1415, because it's easy understand... so assumption 2.5 , 25 should have same binary format. not case. 25 = 0x19 = 11001. 2.5 = 10.1. not @ same thing. if feel doing same sort of math 3.1415, goes this: 3 = 11 (i can that) 1/8 = 0.001 0.1415 - 0.125 = 0.0165 1/64 = 0.000001 0.0165 - 0.015625 = 0.000875 1/2048 = 0.00000000001 and still have fractions of 0.1415 left deal @ point, rough result 11.00100100001. now, if compare binary output (starting @ mantissa part), , inserting dec...

html - steps of creating webpage in bangla -

language code bn http://www.w3schools.com/tags/ref_language_codes.asp?output=print i have tried create page in bengali output ??????????? here have tried <!doctype html> <html lang="bn"> <head> <title > ডোমেইন সার্ভিস </title> </head> <body> ডোমেইন সার্ভিস </body> </html> would please let me know steps need create page in bengli. the language code has nothing characters available you. used such things screen reader pronunciation dictionary selection, search engine filtering , automated translation services. to use characters want need to: save document in character encoding supports characters want use. in general, should utf-8. how depends on choice of editor. if server side programming need ensure track encoding data in , keep in encodings support characters need. badly configured databases common way break encoding. tell browser encoding using. should done via content-type http respons...

javascript - html5 communication with server side -

in traditional web application write jsp renders html code browser , communicate server using form submit or through java script. involves page transition 1 using browser refresh many times. now improved html5 still can use same approach want achieve more of desktop application , feel means no browser refresh. confused how can achieved. do need write big single html5 file contains web application code , show or hide divisions using java script need show @ point of time. communicate server using java script. or, have minimal first html5 page user lands first time. later on create html5 content dynamically using java script , communicate server using java script. looks more difficult. or, there way can move 1 page other without effect of page loading/refresh etc. in general using html5 should approch? for example of shopping cart, first view user list of items purchase. user moves next view such details of item. next view can payment. if have resource or example explain...

jquery - Force second handler to be executed, bind with on -

i have written template parser in javascript. renders 'project' calendar , appends click handler. when click project container starts loading project content in other window. far good. @ 1 point need overwrite click handler , replace one. sounds easy @ first, program uses mix of push , polling services , project has been rendered several times minute (it complete replaced, @ least in first iteration). the normal click handler added using jquery's click() method. special click handler added using jquery's on() method, since projects have clickable new handler. now, every time project re-rendered click handler appended , executed before handler added on :( i could set flag @ templater can decide handler should add project, interfere our program paradigms using each module must complete executable without interacting other modules. any suggestions? prioritize handlers? you can remove previous click hander before binding new one. $yourobject.off(...

asp.net mvc - n2cms parent pages DroppableZone -

i try make parent page showing part in child page cannot try using code not working start page\ @{ html.droppablezone(content.traverse.startpage, "recursive-right").render(); } im using n2cms dinamico edition recursive zones supported in dinamico of v2.5.1. try upgrading , see if fixes issue. install-package n2cms.dinamico or latest bits here: https://github.com/n2cms/n2cms/releases

android - ListFragment but unique id? -

hiho! need android:id="@id/android:list"? android:id="@+id/mylist" didn't work. if have more 1 page listviews, how can right list view without unique id? how can use unique id in listview sherlocklistfragment or listfragment? you can't. 1 list per listactivity/listframgent. use super class implementation.

c# - How to skip the empty pages when reading MS Word document with Microsoft.Office.Interop.Word -

i have application reads text ms word document microsoft.office.interop.word this: microsoft.office.interop.word.document docs = word.documents.open(ref path, ref miss, true, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss); string totaltext = ""; (int = 0; < docs.paragraphs.count; i++) { totaltext += " \r\n " + docs.paragraphs[i + 1].range.text.tostring(); } docs.close(); word.quit(); i need value of totaltext after "for".but sometimes, when ms word document have 2 pages content , 100 empty ones extremely ...

MongoDB cross join of collections using MapReduce -

i have 2 collections in mongodb user { "_id" : objectid("..."), "type" : "user", "user_id" : "u1" } { "_id" : objectid("..."), "type" : "user", "user_id" : "u2" } { "_id" : objectid("..."), "type" : "user", "user_id" : "u3" } item { "_id" : objectid("..."), "type" : "item", "item_id" : "i1" } { "_id" : objectid("..."), "type" : "item", "item_id" : "i2" } { "_id" : objectid("..."), "type" : "item", "item_id" : "i3" } { "_id" : objectid("..."), "type" : "item", "item_id" : "i4" } i planning cross join yield following collection user_item { "_id" : ...

php - function rightshift($num, $bits) is not working in server -

function rightshift($num, $bits) { return bcdiv($num, bcpow('2', $bits)); } echo rightshift(1024,8)); in php working in local system not working in server. i'm guessing local system windows, server linux? the windows build of php has built-in support, while linux builds need compiled option. see http://www.php.net/manual/en/bc.installation.php . doesn't seem enabled default. how enable depend on hosting provider. if have full access server, recompile php flag set , you'll fine. here's page targeted @ dreamhost, guides should apply server environment you're allowed install own php: http://wiki.dreamhost.com/bcmath

c++ - How do I create a vector using the data from the vector -

i manage insert values range vector, in range vector have data rangea, rangeb, rangec.. using data, want create vector range under block vector, how supposed go it? vector <string> range; for(int i=0;i<range.size();i++) { cout<<"range: "<<range[i]<<endl; vector <string> block[i]; <<<<<<< } output: range: rangea range: rangeb range: rangec thanks in advance! vector <string> range; for(int i=0;i<range.size();i++) { cout<<"range: "<<range[i]<<endl; // create vector of size // each element of default // value "default" vector <string> block(i,string("default")); }

Making function for php condition statement -

i'm new php, i'm making online cart website in php admin panels, i've 3 type of users 1: admin (all roles) 2: sellers (who sell items) 3: customers/buyers (who buy items) function user_access($user){ $_session['access'] == '$user'; return $user; } if(user_access('admin')){ echo "you logged in admin"; } else { echo "undefine access"; } but outpul same :( how can make functions type of conditions, wordpress. sorry bad english, this: function user_access($user){ $_session['access'] == '$user'; return $user; } should just: function user_access($user){ return $_session['access'] == $user; } so, need remove quotes around $user , , return result of comparison, not $user variable.

arraylist printing error can some suggest a solution -

i need print arraylist can help. changed normal double double still not work please help. import java.util.*; public class heights { static arraylist <double> heights = new arraylist <double>(); public static void main(string[] args) { //use use method addsomeheight(5.1); addsomeheight(6.2); addsomeheight(6.3); addsomeheight(5.4); addsomeheight(5.5); addsomeheight(5.6); addsomeheight(5.7); addsomeheight(5.8); addsomeheight(5.9); addsomeheight(6.9); //declare new method } private static void addsomeheight(double x) { (double x1 : heights){ system.out.println(x1); } } } you're not adding value list, it's empty. method addsomeheight() doesn't add argument list. ignores it, , prints list instead. please respect java naming conventions: variables start lowercase letter, , methods camelcased.

mysql - SQL: group by from other table and invert result -

i have problem sql query have table message , table recipient message is id author date -------------------- 0 1 2013-07-08 05:38:47 1 1 2013-07-13 05:38:47 2 1 2013-07-15 05:38:47 3 1 2013-07-15 05:38:47 4 2 2013-07-17 05:38:47 5 1 2013-07-28 05:38:47 recipient is id m_id recipient -------------------- 0 0 2 1 1 2 2 2 3 3 3 2 4 4 1 5 5 2 i need return rows table message group recipient column table recipient last date in message table i'll try this select m.* message m inner join recipient r on (m.id = r.m_id) m.author = 1 group r.recipient order m.id desc return is id author date -------------------- 2 1 2013-07-15 05:38:47 0 1 2013-07-08 05:38:47 but need id author date -------------------- 5 1 2013-07-28 05:38:47 2 1 2013-07-15 05:38...

jquery - Referencing an element within a has()? -

if have following code: $('.object').has('span').each(function () { $(this).// things each match.... }); is there easy way target span of $(this)? something like $(this + 'span').//do things span of current element i sure easy do, tried researching on google terms generic i'm struggling find reference! target span of $(this)? you can use find select descendant elements selector: $(this).find("span") // or $("span", this)

Rename the pdf file inside sub-directories to the name of the sub directory -

i using win 7 platform. need create bat file simplifies job. folders , files arranged in structure. file1 folder1 ->abcd.pdf folder2 ->shhd.pdf.............................. foldern ->gfdfgd.pdf file2 folder1 ->gbg.pdf folder2 ->kjc67z.pdf.............................. foldern ->iuxz4i.pdf -- -- -- filen folder1 ->ah455.pdf folder2 ->jfhd45.pdf.............................. foldern ->juvxzr.pdf i want generate batch file renames pdf file name of folder contains. example, in above structure "abcd.pdf" renamed folder1.pdf. respectively done pdf files. also folder named "test" created inside each directory(file1,file2..etc) contains renamed pdf files of respective directory. if copy folders inside file1 myfolder & run bat file, folder named test created , pdf file renamed , copied test folder. but want is, want run bat file in h:\ drive. lets assume h:\ drive contains directories file1, file2....fil...

c# - Variable-Sized GridViewItem in GridView -

Image
in gridview (windows 8 app), use following item template show items : <datatemplate x:key="projecttemplate"> <grid width="500" background="midnightblue"> <grid.rowdefinitions> <rowdefinition height="auto"/> <rowdefinition height="auto"/> <rowdefinition height="auto"/> </grid.rowdefinitions> <textblock grid.row="0" text="{binding name}" margin="20, 10" style="{staticresource subheadertextstyle}" textwrapping="wrap" foreground="whitesmoke"/> <stackpanel grid.row="1" orientation="horizontal" margin="20, 10, 10, 10" background="midnightblue"> <textblock text="last modified :" style="{staticresource titletextstyle}" foreground="whitesmoke"/> ...

JavaScript interactive form in alert box? -

is possible put form alert box , display user? afterwards want submit data presume work same via 'post' method or such. i had quick play around couldn't work, not on search engines either. thanks help! an alert box not editable. can use javascript create new browser window form in it. general form this: window.open('url open','window name') fall foul of popup blockers if handle 'when' badly. this quite nice simple walk through live examples http://www.pageresource.com/jscript/jwinopen.htm

android - Smoother ImageSwitcher - How to? -

i'm trying out simple project scroll between images it's animation bad now. when slide switch between images doesnt "attach" finger while swipe, instead fades out awkwardly , next image comes in sliding. think has animation parameters used don't know else use. what want achieve scrolling horizontally between tabs in app, while 1 image sliding out, other 1 sliding in next it, attached each other sideways. here code: xml: <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <imageswitcher android:id="@+id/splashscreenimages" android:layout_width="fill_parent" android:layout_height="fill_parent" > </imageswitcher> </relativelayout> ja...